Improvements to the recent clothing menu toggle hardsuit helmet feature.

This commit is contained in:
Ghommie
2020-07-03 01:08:28 +02:00
parent 54b4672f13
commit 92c846fdbf
2 changed files with 23 additions and 15 deletions

View File

@@ -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, "<span class='notice'>The helmet on the hardsuit disengages.</span>")
if(message)
to_chat(H, "<span class='notice'>The helmet on the hardsuit disengages.</span>")
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, "<span class='warning'>You must be wearing [src] to engage the helmet!</span>")
if(message)
to_chat(H, "<span class='warning'>You must be wearing [src] to engage the helmet!</span>")
return
if(H.head)
to_chat(H, "<span class='warning'>You're already wearing something on your head!</span>")
if(message)
to_chat(H, "<span class='warning'>You're already wearing something on your head!</span>")
return
else if(H.equip_to_slot_if_possible(helmet,SLOT_HEAD,0,0,1))
to_chat(H, "<span class='notice'>You engage the helmet on the hardsuit.</span>")
if(message)
to_chat(H, "<span class='notice'>You engage the helmet on the hardsuit.</span>")
suittoggled = TRUE
H.update_inv_wear_suit()
playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, 1)
return TRUE
else
RemoveHelmet()
return RemoveHelmet(message)

View File

@@ -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("<span class='danger'>[usr] tries to [hardsuit_head ? "retract" : "extend"] [src]'s helmet.</span>", \
"<span class='userdanger'>[usr] tries to [hardsuit_head ? "retract" : "extend"] [src]'s helmet.</span>", \
target = usr, target_message = "<span class='danger'>You try to [hardsuit_head ? "retract" : "extend"] [src]'s helmet.</span>")
if(!do_mob(usr, src, POCKET_STRIP_DELAY))
if(!do_mob(usr, src, hardsuit_head ? head.strip_delay : POCKET_STRIP_DELAY))
return
visible_message("<span class='danger'>[usr] [hardsuit_head ? "retract" : "extend"] [src]'s helmet</span>", \
"<span class='userdanger'>[usr] [hardsuit_head ? "retract" : "extend"] [src]'s helmet</span>", \
target = usr, target_message = "<span class='danger'>You [hardsuit_head ? "retract" : "extend"] [src]'s helmet.</span>")
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("<span class='danger'>[usr] [hardsuit_head ? "retract" : "extend"] [src]'s helmet</span>", \
"<span class='userdanger'>[usr] [hardsuit_head ? "retract" : "extend"] [src]'s helmet</span>", \
target = usr, target_message = "<span class='danger'>You [hardsuit_head ? "retract" : "extend"] [src]'s helmet.</span>")
return
if(href_list["item"])
var/slot = text2num(href_list["item"])
if(slot in check_obscured_slots())
to_chat(usr, "<span class='warning'>You can't reach that! Something is covering it.</span>")
return
return
if(href_list["pockets"])
var/strip_mod = 1
var/strip_silence = FALSE