converts certain donk outpost objects to use SSqueuelinks instead of globals (#85637)

## About The Pull Request
converts certain donk outpost objects to use SSqueuelinks instead of
globals

## Why It's Good For The Game

i dont think every cool ruin should have its own global vars + this
allows multiple of the ruin to be spawned without breaking if someone
wants to do that for some reason
its better to just do it like this

## Changelog
🆑
code: that one cool haunted donk outpost ruins tripwires and such use a
subsystem instead of globals. no real gameplay effect
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
jimmyl
2024-09-13 13:59:21 +02:00
committed by GitHub
co-authored by Ghom
parent 5c67278b84
commit ef14af1ff6
3 changed files with 45 additions and 50 deletions
@@ -31,8 +31,8 @@
var/datum/action/cooldown/mob_cooldown/targeted_mob_ability/donk_laser
//is this being used as part of the haunted trading post ruin? if true, stuff there will self destruct when this mob dies
var/donk_ai_master = FALSE
// list of stuff tagged to self destruct when this mob dies
GLOBAL_LIST_EMPTY(selfdestructs_when_boss_dies)
/// the queue id for the stuff that selfdestructs when we die
var/selfdestruct_queue_id = "hauntedtradingpost_sd"
/mob/living/basic/cybersun_ai_core/Initialize(mapload)
. = ..()
@@ -45,21 +45,20 @@ GLOBAL_LIST_EMPTY(selfdestructs_when_boss_dies)
BARRAGE_ABILITY_TYPEPATH = BB_CYBERSUN_CORE_BARRAGE,
)
grant_actions_by_list(innate_actions)
if(mapload && donk_ai_master)
return INITIALIZE_HINT_LATELOAD
/mob/living/basic/cybersun_ai_core/LateInitialize()
SSqueuelinks.add_to_queue(src, selfdestruct_queue_id)
SSqueuelinks.pop_link(selfdestruct_queue_id)
/mob/living/basic/cybersun_ai_core/MatchedLinks(id, list/partners) // id == queue id (for multiple queue objects)
if(id != selfdestruct_queue_id)
return
for(var/datum/partner as anything in partners) // all our partners in the selfdestruct queue are now registered to qdel if I die
partner.RegisterSignal(src, COMSIG_QDELETING, TYPE_PROC_REF(/datum, selfdelete))
/mob/living/basic/cybersun_ai_core/death(gibbed)
if(donk_ai_master == TRUE)
//disable all the tripwire traps
for (var/obj/item/pressure_plate/puzzle/invisible_tripwire as anything in GLOB.selfdestructs_when_boss_dies)
qdel(invisible_tripwire)
//and the electric overload traps
for (var/obj/effect/overloader_trap as anything in GLOB.selfdestructs_when_boss_dies)
qdel(overloader_trap)
//then disable the AI defence holograms
for (var/obj/structure/holosign/barrier/cyborg/cybersun_ai_shield as anything in GLOB.selfdestructs_when_boss_dies)
qdel(cybersun_ai_shield)
//then the power generator
for (var/obj/machinery/power/smes/magical/cybersun as anything in GLOB.selfdestructs_when_boss_dies)
qdel(cybersun)
do_sparks(number = 5, source = src)
return ..()