Files
VOREStation/code/modules/clothing/suits/toggles.dm
2017-01-18 17:02:01 -06:00

59 lines
1.6 KiB
Plaintext

//Hoods for winter coats and chaplain hoodie etc
/obj/item/clothing/suit/storage/hooded
var/obj/item/clothing/head/hood
var/hoodtype = null //so the chaplain hoodie or other hoodies can override this
var/suittoggled = 0
var/hooded = 0
action_button_name = "Toggle Hood"
/obj/item/clothing/suit/storage/hooded/New()
MakeHood()
..()
/obj/item/clothing/suit/storage/hooded/Destroy()
qdel(hood)
return ..()
/obj/item/clothing/suit/storage/hooded/proc/MakeHood()
if(!hood)
var/obj/item/clothing/head/winterhood/W = new hoodtype(src)
hood = W
/obj/item/clothing/suit/storage/hooded/ui_action_click()
ToggleHood()
/obj/item/clothing/suit/storage/hooded/equipped(mob/user, slot)
if(slot != slot_wear_suit)
RemoveHood()
..()
/obj/item/clothing/suit/storage/hooded/proc/RemoveHood()
icon_state = "[initial(icon_state)]"
suittoggled = 0
if(ishuman(hood.loc))
var/mob/living/carbon/H = hood.loc
H.unEquip(hood, 1)
H.update_inv_wear_suit()
hood.loc = src
/obj/item/clothing/suit/storage/hooded/dropped()
RemoveHood()
/obj/item/clothing/suit/storage/hooded/proc/ToggleHood()
if(!suittoggled)
if(ishuman(loc))
var/mob/living/carbon/human/H = src.loc
if(H.wear_suit != src)
H << "<span class='warning'>You must be wearing [src] to put up the hood!</span>"
return
if(H.head)
H << "<span class='warning'>You're already wearing something on your head!</span>"
return
else
H.equip_to_slot_if_possible(hood,slot_head,0,0,1)
suittoggled = 1
icon_state = "[initial(icon_state)]_t"
H.update_inv_wear_suit()
else
RemoveHood()