From 08cba9e799772767184e0759dacce4caef49c332 Mon Sep 17 00:00:00 2001
From: jjpark-kb <55967837+jjpark-kb@users.noreply.github.com>
Date: Fri, 31 Jul 2020 20:31:06 -0400
Subject: [PATCH] adds a busy check
---
code/game/objects/structures/trash_piles.dm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/code/game/objects/structures/trash_piles.dm b/code/game/objects/structures/trash_piles.dm
index f4a5a522..f280db2f 100644
--- a/code/game/objects/structures/trash_piles.dm
+++ b/code/game/objects/structures/trash_piles.dm
@@ -13,7 +13,7 @@
var/list/used_players = list()
- var/obj/hidden_obj
+ var/busy = FALSE
/obj/structure/trash_pile/Initialize()
. = ..()
@@ -27,6 +27,9 @@
. = ..()
/obj/structure/trash_pile/attack_hand(mob/user)
+ if(busy)
+ return
+ busy = TRUE
var/turf/T = get_turf(src)
if(contents.len) //There's something hidden
var/atom/A = contents[contents.len] //Get the most recent hidden thing
@@ -34,20 +37,25 @@
var/mob/living/M = A
to_chat(user,"You found someone in the trash!")
eject_mob(M)
+ busy = FALSE
else if (istype(A, /obj/item))
var/obj/item/I = A
to_chat(user,"You found something!")
I.forceMove(src.loc)
+ busy = FALSE
else
if(user in used_players)
to_chat(user, "You already have looted [src].")
+ busy = FALSE
return
if(!do_after(user, rand(2 SECONDS, 4 SECONDS), FALSE, src))
+ busy = FALSE
return
for(var/i=0, i 10)