From e316b76ddb73b6bd02ff70ee176cb9f8552a4624 Mon Sep 17 00:00:00 2001 From: Leshana Date: Wed, 14 Jun 2017 16:04:45 -0400 Subject: [PATCH] Fix runtime errors when uninstalling some nifsofts * /datum/nifsoft/uninstall() sets nif = null, so any overriden uninstall() that calls parent can't access the nif after that. Luckily the only nifsofts that did this were just clearing flags that they set on install(). * We have an automatic flag set/clearing mechanism using some variables which sets them on install and clears on uninstall, so we switch to that and its all good. --- code/modules/nifsoft/software/10_combat.dm | 18 ++---------------- .../modules/nifsoft/software/13_soulcatcher.dm | 11 +---------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/code/modules/nifsoft/software/10_combat.dm b/code/modules/nifsoft/software/10_combat.dm index fa5e40f3935..ef94ec715b5 100644 --- a/code/modules/nifsoft/software/10_combat.dm +++ b/code/modules/nifsoft/software/10_combat.dm @@ -8,14 +8,7 @@ wear = 3 access = 999 //Prevents anyone from buying it without an emag. activates = FALSE //It's armor. - - install() - if((. = ..())) - nif.set_flag(NIF_C_BRUTEARMOR,NIF_FLAGS_COMBAT) - - uninstall() - . = ..() - nif.clear_flag(NIF_C_BRUTEARMOR,NIF_FLAGS_COMBAT) + combat_flags = NIF_C_BRUTEARMOR // Default on when installed, clear when uninstalled /datum/nifsoft/burn_armor name = "Dragon's Skin" @@ -27,14 +20,7 @@ wear = 3 access = 999 //Prevents anyone from buying it without an emag. activates = FALSE //It's armor. - - install() - if((. = ..())) - nif.set_flag(NIF_C_BURNARMOR,NIF_FLAGS_COMBAT) - - uninstall() - . = ..() - nif.clear_flag(NIF_C_BURNARMOR,NIF_FLAGS_COMBAT) + combat_flags = NIF_C_BURNARMOR // Default on when installed, clear when uninstalled /datum/nifsoft/painkillers name = "Nova Shock" diff --git a/code/modules/nifsoft/software/13_soulcatcher.dm b/code/modules/nifsoft/software/13_soulcatcher.dm index 422944b573a..b46c039e413 100644 --- a/code/modules/nifsoft/software/13_soulcatcher.dm +++ b/code/modules/nifsoft/software/13_soulcatcher.dm @@ -15,6 +15,7 @@ cost = 1265 wear = 1 p_drain = 0.01 + other_flags = (NIF_O_SCMYSELF|NIF_O_SCOTHERS) // Default on when installed, clear when uninstalled var/setting_flags = (NIF_SC_CATCHING_ME|NIF_SC_CATCHING_OTHERS|NIF_SC_ALLOW_EARS|NIF_SC_ALLOW_EYES|NIF_SC_BACKUPS) var/list/brainmobs = list() @@ -28,16 +29,6 @@ qdel_null_list(brainmobs) return ..() - install() - if((. = ..())) - nif.set_flag(NIF_O_SCMYSELF,NIF_FLAGS_OTHER) - nif.set_flag(NIF_O_SCOTHERS,NIF_FLAGS_OTHER) - - uninstall() - if((. = ..())) - nif.clear_flag(NIF_O_SCMYSELF,NIF_FLAGS_OTHER) - nif.clear_flag(NIF_O_SCOTHERS,NIF_FLAGS_OTHER) - activate() if((. = ..())) show_settings(nif.human)