From b81ea02552e1d9c123bb632b5964a0db1c8ee2b3 Mon Sep 17 00:00:00 2001 From: Aranclanos Date: Mon, 24 Aug 2015 04:25:47 -0300 Subject: [PATCH] Hardsuit helmets will now store the suit as a var and they will qdel eachother when deleted. --- code/modules/clothing/spacesuits/hardsuit.dm | 1 + code/modules/clothing/suits/toggles.dm | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index 06bdfc347d6..334c76fca27 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -10,6 +10,7 @@ var/basestate = "hardsuit" var/brightness_on = 4 //luminosity when on var/on = 0 + var/obj/item/clothing/suit/space/hardsuit/suit item_color = "engineering" //Determines used sprites: hardsuit[on]-[color] and hardsuit[on]-[color]2 (lying down sprite) action_button_name = "Toggle Helmet Light" flags = BLOCKHAIR | STOPSPRESSUREDMAGE | THICKMATERIAL | NODROP diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm index d8d1f409691..9a3efc5d2ad 100644 --- a/code/modules/clothing/suits/toggles.dm +++ b/code/modules/clothing/suits/toggles.dm @@ -90,7 +90,6 @@ user << "Alt-click on [src] to toggle the [togglename]." //Hardsuit toggle code - /obj/item/clothing/suit/space/hardsuit/New() MakeHelmet() if(!jetpack) @@ -98,15 +97,24 @@ verbs -= /obj/item/clothing/suit/space/hardsuit/verb/Jetpack_Rockets ..() /obj/item/clothing/suit/space/hardsuit/Destroy() - qdel(helmet) + if(helmet) + helmet.suit = null + qdel(helmet) qdel(jetpack) ..() +/obj/item/clothing/head/helmet/space/hardsuit/Destroy() + if(suit) + suit.helmet = null + qdel(suit) + ..() + /obj/item/clothing/suit/space/hardsuit/proc/MakeHelmet() if(!helmettype) return if(!helmet) var/obj/item/clothing/head/helmet/space/hardsuit/W = new helmettype(src) + W.suit = src helmet = W /obj/item/clothing/suit/space/hardsuit/ui_action_click() @@ -121,7 +129,7 @@ ..() /obj/item/clothing/suit/space/hardsuit/proc/RemoveHelmet() - if(!helmettype) + if(!helmet) return suittoggled = 0 if(ishuman(helmet.loc))