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