Fixes infinite loop in closet resist code (#92355)

This commit is contained in:
LemonInTheDark
2025-07-29 00:15:54 -07:00
committed by GitHub
parent 14e2e0d1ee
commit cba36db2a2
2 changed files with 11 additions and 13 deletions

View File

@@ -1038,15 +1038,13 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
return TRUE
/obj/structure/closet/container_resist_act(mob/living/user, loc_required = TRUE)
if(isstructure(loc))
relay_container_resist_act(user, loc)
if(opened)
return
if(ismovable(loc))
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
var/atom/movable/AM = loc
AM.relay_container_resist_act(user, src)
var/atom/movable/movable_parent = loc
movable_parent.relay_container_resist_act(user, src)
return
if(!welded && !locked)
open()
@@ -1075,7 +1073,7 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
to_chat(user, span_warning("You fail to break out of [src]!"))
/obj/structure/closet/relay_container_resist_act(mob/living/user, obj/container)
container.container_resist_act(user)
container_resist_act(user)
/// Check if someone is still resisting inside, and choose to either keep shaking or stop shaking the closet
/obj/structure/closet/proc/check_if_shake()

View File

@@ -73,22 +73,22 @@
if(!hasmob)
disposal_holder.destinationTag = sort_tag
/obj/item/delivery/relay_container_resist_act(mob/living/user, obj/object)
/obj/item/delivery/relay_container_resist_act(mob/living/user, obj/container)
if(ismovable(loc))
var/atom/movable/movable_loc = loc //can't unwrap the wrapped container if it's inside something.
movable_loc.relay_container_resist_act(user, object)
movable_loc.relay_container_resist_act(user, container)
return
to_chat(user, span_notice("You lean on the back of [object] and start pushing to rip the wrapping around it."))
if(do_after(user, 5 SECONDS, target = object))
if(!user || user.stat != CONSCIOUS || user.loc != object || object.loc != src)
to_chat(user, span_notice("You lean on the back of [container] and start pushing to rip the wrapping around it."))
if(do_after(user, 5 SECONDS, target = container))
if(!user || user.stat != CONSCIOUS || user.loc != container || container.loc != src)
return
to_chat(user, span_notice("You successfully removed [object]'s wrapping!"))
object.forceMove(loc)
to_chat(user, span_notice("You successfully removed [container]'s wrapping!"))
container.forceMove(loc)
unwrap_contents()
post_unwrap_contents(user)
else
if(user.loc == src) //so we don't get the message if we resisted multiple times and succeeded.
to_chat(user, span_warning("You fail to remove [object]'s wrapping!"))
to_chat(user, span_warning("You fail to remove [container]'s wrapping!"))
/obj/item/delivery/update_icon_state()
. = ..()