From 5da68ce4e3924ccdb75544c3e0f7d889ca88a722 Mon Sep 17 00:00:00 2001 From: Roxy <75404941+TealSeer@users.noreply.github.com> Date: Thu, 24 Apr 2025 12:14:48 -0400 Subject: [PATCH] Add code to migrate old invalid NIF paths in save files (#3615) ## About The Pull Request `modular_persistence.json` on player saves holds the path of any NIFs they have installed and ended the round with, but when we refactored `/obj/item/organ/internal` to just be `/obj/item/organ` these save files weren't updated, meaning people lost their NIFs and now we get runtime errors when an affected person joins the game. This code will check their save on load and update the path appropriately (which will then be written to the file at round end) ## Why It's Good For The Game They lost NIFs due to a bug ## Proof Of Testing I can't really do pictures for this but I got a save file that had invalid NIFs installed and used it to test locally and it worked, also tested save files without NIFs and clients that don't have a `modular_persistence.json` at all, no runtimes ## Changelog :cl: fix: characters who had their NIFs disappear a few months ago should have them back now /:cl: --- .../modules/modular_implants/code/nif_persistence.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modular_skyrat/modules/modular_implants/code/nif_persistence.dm b/modular_skyrat/modules/modular_implants/code/nif_persistence.dm index a633dab637c..32492ad9619 100644 --- a/modular_skyrat/modules/modular_implants/code/nif_persistence.dm +++ b/modular_skyrat/modules/modular_implants/code/nif_persistence.dm @@ -75,6 +75,10 @@ if(!persistence.nif_path) return + // if nif_path exists but isn't a valid path it probably needs to be migrated post-organ refactor + if(!text2path(persistence.nif_path)) + persistence.nif_path = replacetext(persistence.nif_path, "/obj/item/organ/internal", "/obj/item/organ") + var/obj/item/organ/cyberimp/brain/nif/new_nif = new persistence.nif_path new_nif.durability = persistence.nif_durability