From 92c846fdbffff90fc7862f36d8d6a4c33506f5d3 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Fri, 3 Jul 2020 01:08:28 +0200 Subject: [PATCH] Improvements to the recent clothing menu toggle hardsuit helmet feature. --- code/modules/clothing/suits/toggles.dm | 20 ++++++++++++------- code/modules/mob/living/carbon/human/human.dm | 18 +++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm index 639f2d3bfb..60f8cc179a 100644 --- a/code/modules/clothing/suits/toggles.dm +++ b/code/modules/clothing/suits/toggles.dm @@ -164,7 +164,7 @@ RemoveHelmet() ..() -/obj/item/clothing/suit/space/hardsuit/proc/RemoveHelmet() +/obj/item/clothing/suit/space/hardsuit/proc/RemoveHelmet(message = TRUE) if(!helmet) return suittoggled = FALSE @@ -174,16 +174,18 @@ helmet.attack_self(H) H.transferItemToLoc(helmet, src, TRUE) H.update_inv_wear_suit() - to_chat(H, "The helmet on the hardsuit disengages.") + if(message) + to_chat(H, "The helmet on the hardsuit disengages.") playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, 1) else helmet.forceMove(src) + return TRUE /obj/item/clothing/suit/space/hardsuit/dropped(mob/user) ..() RemoveHelmet() -/obj/item/clothing/suit/space/hardsuit/proc/ToggleHelmet() +/obj/item/clothing/suit/space/hardsuit/proc/ToggleHelmet(message = TRUE) var/mob/living/carbon/human/H = loc if(!helmettype) return @@ -192,15 +194,19 @@ if(!suittoggled) if(ishuman(src.loc)) if(H.wear_suit != src) - to_chat(H, "You must be wearing [src] to engage the helmet!") + if(message) + to_chat(H, "You must be wearing [src] to engage the helmet!") return if(H.head) - to_chat(H, "You're already wearing something on your head!") + if(message) + to_chat(H, "You're already wearing something on your head!") return else if(H.equip_to_slot_if_possible(helmet,SLOT_HEAD,0,0,1)) - to_chat(H, "You engage the helmet on the hardsuit.") + if(message) + to_chat(H, "You engage the helmet on the hardsuit.") suittoggled = TRUE H.update_inv_wear_suit() playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, 1) + return TRUE else - RemoveHelmet() + return RemoveHelmet(message) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 8451dc4060..a2d53f6f0a 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -227,25 +227,27 @@ SEND_SIGNAL(src, COMSIG_CARBON_EMBED_RIP, I, L) return if(href_list["toggle_helmet"]) - var/hardsuit_head = head && istype(head, /obj/item/clothing/head/helmet/space/hardsuit) + if(!istype(head, /obj/item/clothing/head/helmet/space/hardsuit)) + return + var/obj/item/clothing/head/helmet/space/hardsuit/hardsuit_head = head visible_message("[usr] tries to [hardsuit_head ? "retract" : "extend"] [src]'s helmet.", \ "[usr] tries to [hardsuit_head ? "retract" : "extend"] [src]'s helmet.", \ target = usr, target_message = "You try to [hardsuit_head ? "retract" : "extend"] [src]'s helmet.") - if(!do_mob(usr, src, POCKET_STRIP_DELAY)) + if(!do_mob(usr, src, hardsuit_head ? head.strip_delay : POCKET_STRIP_DELAY)) return - visible_message("[usr] [hardsuit_head ? "retract" : "extend"] [src]'s helmet", \ - "[usr] [hardsuit_head ? "retract" : "extend"] [src]'s helmet", \ - target = usr, target_message = "You [hardsuit_head ? "retract" : "extend"] [src]'s helmet.") - if(!istype(wear_suit, /obj/item/clothing/suit/space/hardsuit)) + if(!istype(wear_suit, /obj/item/clothing/suit/space/hardsuit) || (hardsuit_head ? (!head || head != hardsuit_head) : head)) return var/obj/item/clothing/suit/space/hardsuit/hardsuit = wear_suit //This should be an hardsuit given all our checks - hardsuit.ToggleHelmet() + if(hardsuit.ToggleHelmet(FALSE)) + visible_message("[usr] [hardsuit_head ? "retract" : "extend"] [src]'s helmet", \ + "[usr] [hardsuit_head ? "retract" : "extend"] [src]'s helmet", \ + target = usr, target_message = "You [hardsuit_head ? "retract" : "extend"] [src]'s helmet.") return if(href_list["item"]) var/slot = text2num(href_list["item"]) if(slot in check_obscured_slots()) to_chat(usr, "You can't reach that! Something is covering it.") - return + return if(href_list["pockets"]) var/strip_mod = 1 var/strip_silence = FALSE