From f747a6213d37d28fd51920f07500dbe9596d9ae5 Mon Sep 17 00:00:00 2001 From: Heroman Date: Wed, 1 Dec 2021 21:05:06 +1000 Subject: [PATCH 1/2] Makes NIFs not get automatically lost (hopefully) --- code/modules/client/preference_setup/vore/08_nif.dm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/modules/client/preference_setup/vore/08_nif.dm b/code/modules/client/preference_setup/vore/08_nif.dm index 62ebbdbeac0..0baa90a3601 100644 --- a/code/modules/client/preference_setup/vore/08_nif.dm +++ b/code/modules/client/preference_setup/vore/08_nif.dm @@ -38,11 +38,17 @@ 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 or get their NIF extracted, it will save as 'gone' anyway + //Let's give a more minor punishment for not properly backing up instead! + pref.nif_durability -= rand(10, 15) 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]" From 9106a08f1a0351410462e8e28b35800d0c064be2 Mon Sep 17 00:00:00 2001 From: Heroman Date: Sun, 26 Dec 2021 05:57:32 +1000 Subject: [PATCH 2/2] Makes NIF save on every durability change --- 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, 15 insertions(+), 6 deletions(-) diff --git a/code/modules/client/preference_setup/vore/08_nif.dm b/code/modules/client/preference_setup/vore/08_nif.dm index 0baa90a3601..c6183413442 100644 --- a/code/modules/client/preference_setup/vore/08_nif.dm +++ b/code/modules/client/preference_setup/vore/08_nif.dm @@ -46,9 +46,8 @@ pref.nif_savedata = null */ //No we do not, that's lame and admins have to re-NIF them later. - //If they leave round or get their NIF extracted, it will save as 'gone' anyway - //Let's give a more minor punishment for not properly backing up instead! - pref.nif_durability -= rand(10, 15) + //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 6dc40db443e..6edd37d320c 100644 --- a/code/modules/nifsoft/nif.dm +++ b/code/modules/nifsoft/nif.dm @@ -197,6 +197,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() @@ -205,6 +208,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()) @@ -233,7 +243,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 f0286667df1..eba5c5cbbe2 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