Skip to content

Commit

Permalink
Fixes armor light staying on after removal (#6004)
Browse files Browse the repository at this point in the history
# About the pull request
Fixes #5672 , just put a conditional to check if the armor contains a
light source that is currently turned on, if so we just turn it off when
the user removes it from their inventory.

# Changelog
:cl:
fix: Fixes armor light staying on after removal.

---------

Co-authored-by: harryob <[email protected]>
  • Loading branch information
vero5123 and harryob committed Apr 6, 2024
1 parent e98fdc5 commit 5cadb4a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,8 @@ cases. Override_icon_state should be a list.*/

if(item.flags_equip_slot & slotdefine2slotbit(slot))
if(is_type_in_list(item, uniform_restricted))
if(light_on)
turn_light(toggle_on = FALSE)
user.drop_inv_item_on_ground(src)
to_chat(user, SPAN_NOTICE("You drop \the [src] to the ground while unequipping \the [item]."))

Expand Down
10 changes: 8 additions & 2 deletions code/game/objects/items/storage/internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@
else
user.drop_inv_item_on_ground(master_item)
user.put_in_r_hand(master_item)
return
else
user.drop_inv_item_on_ground(master_item)
user.put_in_r_hand(master_item)

if(master_item.light_on)
master_item.turn_light(toggle_on = FALSE)
return
if("l_hand")
if(master_item.time_to_unequip)
user.visible_message(SPAN_NOTICE("[user] starts taking off \the [master_item]."))
Expand All @@ -73,10 +76,13 @@
else
user.drop_inv_item_on_ground(master_item)
user.put_in_l_hand(master_item)
return
else
user.drop_inv_item_on_ground(master_item)
user.put_in_l_hand(master_item)

if(master_item.light_on)
master_item.turn_light(toggle_on = FALSE)
return
master_item.add_fingerprint(user)
return FALSE
return FALSE
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/human/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@
interact_item.add_fingerprint(src)
if(do_after(src, get_strip_delay(src, target_mob), INTERRUPT_ALL, BUSY_ICON_GENERIC, target_mob, INTERRUPT_MOVED, BUSY_ICON_GENERIC))
if(interact_item && Adjacent(target_mob) && interact_item == target_mob.get_item_by_slot(slot_to_process))
if(interact_item.light_on)
interact_item.turn_light(toggle_on = FALSE)
target_mob.drop_inv_item_on_ground(interact_item)
log_interact(src, target_mob, "[key_name(src)] removed [key_name(target_mob)]'s [interact_item.name] ([slot_to_process]) successfully.")

Expand Down

0 comments on commit 5cadb4a

Please sign in to comment.