/obj/structure/trash_pile name = "trash pile" desc = "A pile of trash, perhaps something of use can be found?" icon = 'icons/obj/trash_piles.dmi' icon_state = "randompile" anchored = TRUE density = FALSE layer = BELOW_OBJ_LAYER var/hide_person_time = 30 var/hide_item_time = 15 var/list/used_players = list() var/busy = FALSE /obj/structure/trash_pile/Initialize() . = ..() icon_state = "pile[rand(1,11)]" GLOB.trash_piles += src /obj/structure/trash_pile/Destroy() GLOB.trash_piles -= src for(var/atom/movable/AM in src) AM.forceMove(src.loc) . = ..() /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 if(istype(A, /mob/living)) 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) return FALSE return TRUE /obj/structure/trash_pile/attackby(obj/item/I, mob/user, params) if(user.a_intent == INTENT_HELP) if(can_hide_item(I)) to_chat(user,"You begin to stealthily hide [I] in the [src].") if(do_mob(user, user, hide_item_time)) if(src.loc) if(user.transferItemToLoc(I, src)) to_chat(user,"You hide [I] in the trash.") else to_chat(user, "\The [I] is stuck to your hand, you cannot put it in the trash!") else to_chat(user,"The [src] is way too full to fit [I].") return . = ..() /obj/structure/trash_pile/MouseDrop_T(atom/movable/O, mob/user) if(user == O && iscarbon(O)) dive_in_pile(user) return . = ..() /obj/structure/trash_pile/proc/eject_mob(var/mob/living/M) M.forceMove(src.loc) to_chat(M,"You've been found!") playsound(M.loc, 'sound/machines/chime.ogg', 50, FALSE, -5) M.do_alert_animation(M) /obj/structure/trash_pile/proc/do_dive(mob/user) if(contents.len) for(var/mob/M in contents) to_chat(user,"There's someone in the trash already!") eject_mob(M) return FALSE return TRUE /obj/structure/trash_pile/proc/dive_in_pile(mob/user) user.visible_message("[user] starts diving into [src].", \ "You start diving into [src]...") var/adjusted_dive_time = hide_person_time if(user.restrained()) //hiding takes twice as long when restrained. adjusted_dive_time *= 2 if(do_mob(user, user, adjusted_dive_time)) if(src.loc) //Checking if structure has been destroyed if(do_dive(user)) to_chat(user,"You hide in the trashpile.") user.forceMove(src) /obj/structure/trash_pile/container_resist(mob/user) user.forceMove(src.loc) /obj/structure/trash_pile/relaymove(mob/user) container_resist(user)