mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-28 11:02:41 +00:00
NB. In some cases we go from a more complex image() to a single icon_state string and I assume this works for every case but do not care to check because of the sheer scale of extra fiddly effort. Buyer beware, not my code.
52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
/obj/structure/coatrack
|
|
name = "coat rack"
|
|
desc = "Rack that holds coats."
|
|
icon = 'icons/obj/coatrack.dmi'
|
|
icon_state = "coatrack0"
|
|
var/obj/item/clothing/suit/coat
|
|
var/list/allowed = list(/obj/item/clothing/suit/storage/toggle/labcoat, /obj/item/clothing/suit/storage/det_trench)
|
|
|
|
/obj/structure/coatrack/attack_hand(mob/user as mob)
|
|
user.visible_message("[user] takes [coat] off \the [src].", "You take [coat] off the \the [src]")
|
|
if(!user.put_in_active_hand(coat))
|
|
coat.loc = get_turf(user)
|
|
coat = null
|
|
update_icon()
|
|
|
|
/obj/structure/coatrack/attackby(obj/item/W as obj, mob/user as mob)
|
|
var/can_hang = 0
|
|
for (var/T in allowed)
|
|
if(istype(W,T))
|
|
can_hang = 1
|
|
if (can_hang && !coat)
|
|
user.visible_message("[user] hangs [W] on \the [src].", "You hang [W] on the \the [src]")
|
|
coat = W
|
|
user.drop_from_inventory(coat, src)
|
|
update_icon()
|
|
else
|
|
to_chat(user, "<span class='notice'>You cannot hang [W] on [src]</span>")
|
|
return ..()
|
|
|
|
/obj/structure/coatrack/CanPass(atom/movable/mover, turf/target)
|
|
var/can_hang = 0
|
|
for (var/T in allowed)
|
|
if(istype(mover,T))
|
|
can_hang = 1
|
|
|
|
if (can_hang && !coat)
|
|
src.visible_message("[mover] lands on \the [src].")
|
|
coat = mover
|
|
coat.loc = src
|
|
update_icon()
|
|
return 0
|
|
else
|
|
return 1
|
|
|
|
/obj/structure/coatrack/update_icon()
|
|
cut_overlays()
|
|
if (istype(coat, /obj/item/clothing/suit/storage/toggle/labcoat))
|
|
add_overlay("coat_lab")
|
|
if (istype(coat, /obj/item/clothing/suit/storage/toggle/labcoat/cmo))
|
|
add_overlay("coat_cmo")
|
|
if (istype(coat, /obj/item/clothing/suit/storage/det_trench))
|
|
add_overlay("coat_det") |