Files
Paradise/code/modules/clothing/suits/toggles.dm
T
Fox McCloudandGitHub 70b46d8aea Life refactor (#13471)
* Life Refactor WIP

* part 2

* part 3

* runtime fix

* newlines

* tweaks

* perspective checks

* fixes

* remote view tweaks

* more fixes

* robot fixes

* better updating

* cleaned up icon procs

* less proc call overhead

* performance gains

* more optimization

* shorter lists, removal of unecesary code

* gene OOP and dna styling cleanup

* oops

* axe disabilities

* typeless loop

* various tweaks and fixes

* brain checks

* runtime fixes

* cryo vision fixes
2020-06-03 19:43:30 -06:00

78 lines
2.0 KiB
Plaintext

//Hardsuit toggle code
/obj/item/clothing/suit/space/hardsuit/New()
MakeHelmet()
..()
/obj/item/clothing/suit/space/hardsuit/Destroy()
if(helmet)
helmet.suit = null
QDEL_NULL(helmet)
QDEL_NULL(jetpack)
return ..()
/obj/item/clothing/head/helmet/space/hardsuit/Destroy()
if(suit)
suit.helmet = null
return ..()
/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()
..()
ToggleHelmet()
/obj/item/clothing/suit/space/hardsuit/equipped(mob/user, slot)
if(!helmettype)
return
if(slot != slot_wear_suit)
RemoveHelmet()
..()
/obj/item/clothing/suit/space/hardsuit/proc/RemoveHelmet()
if(!helmet)
return
suittoggled = FALSE
if(ishuman(helmet.loc))
var/mob/living/carbon/H = helmet.loc
if(helmet.on)
helmet.attack_self(H)
H.unEquip(helmet, TRUE)
helmet.forceMove(src)
H.update_inv_wear_suit()
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)
/obj/item/clothing/suit/space/hardsuit/dropped()
..()
RemoveHelmet()
/obj/item/clothing/suit/space/hardsuit/proc/ToggleHelmet()
var/mob/living/carbon/human/H = src.loc
if(!helmettype)
return
if(!helmet)
return
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>")
return
if(H.head)
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, FALSE, FALSE))
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)
else
RemoveHelmet()