Skip to content

Commit

Permalink
bugfix: duplicate coat on throwing to the coat rack (ss220-space#4200)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsnerr authored Jan 13, 2024
1 parent 9f789d6 commit ea50b60
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions code/game/objects/structures/coathanger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
for(var/T in allowed)
if(istype(W,T))
can_hang = TRUE
continue
break

if(can_hang && !coat)
add_fingerprint(user)
Expand All @@ -43,22 +43,38 @@
else
return ..()

/obj/structure/coatrack/CanPass(atom/movable/mover, turf/target, height=0)
/obj/structure/coatrack/MouseDrop_T(obj/item/W, mob/user)
var/can_hang = FALSE
for(var/T in allowed)
if(istype(mover,T))
if(istype(W,T))
can_hang = TRUE
continue
break

if(can_hang && !coat)
visible_message("[mover] lands on \the [src].")
coat = mover
coat.loc = src
add_fingerprint(user)
user.visible_message("[user] hangs [W] on \the [src].", "You hang [W] on the \the [src].")
coat = W
user.drop_transfer_item_to_loc(W, src)
update_icon()
return 0
else
return ..()

// Hanging a coat on the hanger only after a bump. Force stoping throwing
/obj/structure/coatrack/Bumped(atom/movable/moving_atom)
..()

if (coat)
return

for (var/T in allowed)
if (!istype(moving_atom, T))
continue
visible_message("[moving_atom] lands on \the [src].")
moving_atom.forceMove(src)
coat = moving_atom
update_icon()
return

/obj/structure/coatrack/update_icon()
overlays.Cut()
if(istype(coat, /obj/item/clothing/suit/storage/labcoat))
Expand Down

0 comments on commit ea50b60

Please sign in to comment.