From cd80228460f4c1406144c873178ddf502cbd605f Mon Sep 17 00:00:00 2001 From: Casey Date: Sat, 8 Jan 2022 12:39:30 -0500 Subject: [PATCH] Merge pull request #11944 from Heroman3003/nifnerf Makes NIFs not get automatically lost (hopefully) --- code/modules/client/preference_setup/vore/08_nif.dm | 5 +++++ code/modules/nifsoft/nif.dm | 12 +++++++++++- code/modules/reagents/reagents/other_vr.dm | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/code/modules/client/preference_setup/vore/08_nif.dm b/code/modules/client/preference_setup/vore/08_nif.dm index 62ebbdbeac..c618341344 100644 --- a/code/modules/client/preference_setup/vore/08_nif.dm +++ b/code/modules/client/preference_setup/vore/08_nif.dm @@ -38,11 +38,16 @@ if((character.type == /mob/living/carbon/human) && ispath(pref.nif_path) && pref.nif_durability) new pref.nif_path(character,pref.nif_durability,pref.nif_savedata) + /* //And now here's the trick. We wipe these so that if they die, they lose the NIF. //Backup implants will start saving this again periodically, and so will cryo'ing out. pref.nif_path = null pref.nif_durability = null pref.nif_savedata = null + */ + //No we do not, that's lame and admins have to re-NIF them later. + //If they leave round after they get their NIF extracted, it will save as 'gone' anyway + //The NIF will save automatically every time durability changes too now. var/savefile/S = new /savefile(pref.path) if(!S) WARNING ("Couldn't load NIF save savefile? [pref.real_name]") S.cd = "/character[pref.default_slot]" diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm index b588c905d3..796de72a92 100644 --- a/code/modules/nifsoft/nif.dm +++ b/code/modules/nifsoft/nif.dm @@ -198,6 +198,9 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable wear *= (rand(85,115) / 100) //Apparently rand() only takes integers. durability -= wear + if(human) + persist_nif_data(human) + if(durability <= 0) stat = NIF_TEMPFAIL update_icon() @@ -206,6 +209,13 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable notify("Danger! General system insta#^!($",TRUE) to_chat(human,"Your NIF vision overlays disappear and your head suddenly seems very quiet...") +//Repair update/check proc +/obj/item/device/nif/proc/repair(var/repair = 0) + durability = min(durability + repair, initial(durability)) + + if(human) + persist_nif_data(human) + //Attackby proc, for maintenance /obj/item/device/nif/attackby(obj/item/weapon/W, mob/user as mob) if(open == 0 && W.is_screwdriver()) @@ -234,7 +244,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable user.visible_message("[user] closes up \the [src].","You re-seal \the [src] for use once more.") playsound(src, 'sound/items/Screwdriver.ogg', 50, 1) open = FALSE - durability = initial(durability) + repair(initial(durability)) stat = NIF_PREINSTALL update_icon() diff --git a/code/modules/reagents/reagents/other_vr.dm b/code/modules/reagents/reagents/other_vr.dm index f0286667df..eba5c5cbbe 100644 --- a/code/modules/reagents/reagents/other_vr.dm +++ b/code/modules/reagents/reagents/other_vr.dm @@ -47,7 +47,7 @@ var/obj/item/device/nif/nif = H.nif //L o c a l if(nif.stat == NIF_TEMPFAIL) nif.stat = NIF_INSTALLING - nif.durability = min(nif.durability + removed, initial(nif.durability)) + nif.repair(removed) /datum/reagent/firefighting_foam name = "Firefighting Foam" @@ -120,7 +120,7 @@ var/obj/item/device/nif/nif = H.nif //L o c a l if(nif.stat == NIF_TEMPFAIL) nif.stat = NIF_INSTALLING - nif.durability = min(nif.durability + removed*0.1, initial(nif.durability)) + nif.repair(removed*0.1) //Special toxins for solargrubs /datum/reagent/grubshock