From 2992a387c31a3b2ed168e62ee9d96732367f36e4 Mon Sep 17 00:00:00 2001 From: tralezab <40974010+tralezab@users.noreply.github.com> Date: Thu, 18 Aug 2022 10:41:20 -0700 Subject: [PATCH] Necropolis Tendrils now need to be interacted with to drop their loot, and multiple people can receive multiple chests. (#69193) Tendrils no longer immediately drop their chests, they will drop it once you have used an empty hand on the collapsing tendril. You can only spawn a chest once, but every unique mob that interacts can spawn one chest. --- .../structures/lavaland/necropolis_tendril.dm | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/code/game/objects/structures/lavaland/necropolis_tendril.dm b/code/game/objects/structures/lavaland/necropolis_tendril.dm index 43d84b93ac4..f211ace452a 100644 --- a/code/game/objects/structures/lavaland/necropolis_tendril.dm +++ b/code/game/objects/structures/lavaland/necropolis_tendril.dm @@ -41,9 +41,13 @@ GLOBAL_LIST_INIT(tendrils, list()) /obj/structure/spawner/lavaland/deconstruct(disassembled) new /obj/effect/collapse(loc) - new /obj/structure/closet/crate/necropolis/tendril(loc) return ..() +/obj/structure/spawner/lavaland/examine(mob/user) + var/list/examine_messages = ..() + examine_messages += span_notice("Once this thing gets hurts enough, it triggers a violent final retaliation.") + examine_messages += span_notice("You'll only have a few moments to run up, grab some loot with an open hand, and get out with it.") + return examine_messages /obj/structure/spawner/lavaland/Destroy() var/last_tendril = TRUE @@ -69,26 +73,60 @@ GLOBAL_LIST_INIT(tendrils, list()) /obj/effect/collapse name = "collapsing necropolis tendril" - desc = "Get clear!" + desc = "Get your loot and get clear!" layer = TABLE_LAYER icon = 'icons/mob/nest.dmi' icon_state = "tendril" anchored = TRUE density = TRUE + /// weakref list of which mobs have gotten their loot from this effect. + var/list/collected = list() + /// a bit of light as to make less unfair deaths from the chasm var/obj/effect/light_emitter/tendril/emitted_light /obj/effect/collapse/Initialize(mapload) . = ..() emitted_light = new(loc) visible_message(span_boldannounce("The tendril writhes in fury as the earth around it begins to crack and break apart! Get back!")) - visible_message(span_warning("Something falls free of the tendril!")) + balloon_alert_to_viewers("interact to grab loot before collapse!", vision_distance = 7) playsound(loc,'sound/effects/tendril_destroyed.ogg', 200, FALSE, 50, TRUE, TRUE) addtimer(CALLBACK(src, .proc/collapse), 50) +/obj/effect/collapse/examine(mob/user) + var/list/examine_messages = ..() + if(isliving(user)) + if(has_collected(user)) + examine_messages += span_boldnotice("You've grabbed what you can, now get out!") + else + examine_messages += span_boldnotice("You might have some time to grab some goodies with an open hand before it collapses!") + return examine_messages + +/obj/effect/collapse/attack_hand(mob/living/collector, list/modifiers) + . = ..() + if(has_collected(collector)) + to_chat(collector, span_danger("You've already gotten some loot, just get out of there with it!")) + return + visible_message(span_warning("Something falls free of the tendril!")) + var/obj/structure/closet/crate/necropolis/tendril/loot = new /obj/structure/closet/crate/necropolis/tendril(loc) + collector.start_pulling(loot) + collected += WEAKREF(collector) + /obj/effect/collapse/Destroy() + QDEL_NULL(collected) QDEL_NULL(emitted_light) return ..() +///Helper proc that resolves weakrefs to determine if collector is in collected list, returning a boolean. +/obj/effect/collapse/proc/has_collected(mob/collector) + for(var/datum/weakref/weakref as anything in collected) + var/mob/living/resolved = weakref.resolve() + //it could have been collector, it could not have been, we don't care + if(!resolved) + continue + if(resolved == collector) + return TRUE + return FALSE + /obj/effect/collapse/proc/collapse() for(var/mob/M in range(7,src)) shake_camera(M, 15, 1)