From 680e95aaa62963de2464e4464664be21fcb9a223 Mon Sep 17 00:00:00 2001 From: Leopold <62264115+TheLeopold@users.noreply.github.com> Date: Fri, 15 Mar 2024 20:01:34 +0000 Subject: [PATCH] Better shelter 2: Bluespace boogaloo (#8314) * does it work? * oh my god it actually works * thank god I don't need this * and this too * hands and pockets check * leftover * inventory check * Dusty go away * Update last_shelter.dm * better func? * blacklist * fix runtime * smelter can't destroy cruciform * it works! * Update last_shelter.dm * remove Search * qdel check, resus unlist --- code/__HELPERS/atoms.dm | 10 +++++++ .../objects/items/devices/last_shelter.dm | 28 +++++++++++++++++-- .../core_implant/cruciform/cruciform.dm | 7 ++++- .../core_implant/cruciform/rituals/base.dm | 1 + .../core_implant/cruciform/rituals/priest.dm | 24 ---------------- code/modules/mob/living/carbon/human/death.dm | 1 + code/modules/mob/living/carbon/human/human.dm | 5 ++++ 7 files changed, 49 insertions(+), 27 deletions(-) diff --git a/code/__HELPERS/atoms.dm b/code/__HELPERS/atoms.dm index 93ad2cabebc..d670920888f 100644 --- a/code/__HELPERS/atoms.dm +++ b/code/__HELPERS/atoms.dm @@ -18,6 +18,16 @@ return null//If we get here, the holder must be buried many layers deep in nested containers, or else is somehow contained in nullspace +/atom/proc/is_inside(LIST) + var/atom/A = loc + while(!is_type_in_list(A, LIST)) + if(isnull(A)) + return null + A = A.loc + if(isturf(A)) + return FALSE + return A + /atom/proc/add_overlay(overlay) ASSERT(overlay) diff --git a/code/game/objects/items/devices/last_shelter.dm b/code/game/objects/items/devices/last_shelter.dm index 14959581caf..59ed8cf4585 100644 --- a/code/game/objects/items/devices/last_shelter.dm +++ b/code/game/objects/items/devices/last_shelter.dm @@ -1,5 +1,14 @@ GLOBAL_DATUM(last_shelter, /obj/item/device/last_shelter) +//can't get cruciform from inside one of these +var/list/shelter_blacklist = list( + /mob, + /obj/machinery/neotheology/reader, + /obj/item/storage/bsdm, + /obj/machinery/recycle_vendor, + /obj/machinery/r_n_d/destructive_analyzer + ) + /obj/item/device/last_shelter name = "Last Shelter" desc = "Powerful scanner that can teleport a cruciforms of pilgrims lost in this sector of space." @@ -64,12 +73,12 @@ GLOBAL_DATUM(last_shelter, /obj/item/device/last_shelter) scan = FALSE if(istype(src.loc, /mob/living/carbon/human)) user.put_in_hands(cruciform) - to_chat(user, SPAN_NOTICE("The [src] has found the lost cruciform in a deep space. Now this fate of the disciple rests in your hands.")) + to_chat(user, SPAN_NOTICE("The [src] has found the lost cruciform. Now this fate of the disciple rests in your hands.")) else visible_message(SPAN_NOTICE("[src] drops [cruciform].")) cruciform.forceMove(get_turf(src)) else - to_chat(user, SPAN_WARNING("The [src] can't find any working cruciforms in deep space. You can try to use [src] again later.")) + to_chat(user, SPAN_WARNING("The [src] can't find any working cruciforms. You can try to use [src] again later.")) scan = FALSE if(alert) @@ -91,8 +100,23 @@ GLOBAL_DATUM(last_shelter, /obj/item/device/last_shelter) /obj/item/device/last_shelter/proc/get_cruciform() var/datum/mind/MN = request_player() + if(!MN) + var/list/cruciforms_temporary = lost_cruciforms.Copy() + while(cruciforms_temporary.len) + var/obj/item/implant/core_implant/picked = pick_n_take(cruciforms_temporary) + var/container = picked.is_inside(shelter_blacklist) + if(container) + if(ishuman(container)) + var/mob/living/carbon/human/body = container + if((body.stat == DEAD) && (world.time >= (body.timeofdeath + NECROZTIME))) + picked.uninstall() + return picked + continue + else + return picked return FALSE + var/mob/living/carbon/human/H = new /mob/living/carbon/human(src) H.randomize_appearance() for(var/stat in ALL_STATS) diff --git a/code/modules/core_implant/cruciform/cruciform.dm b/code/modules/core_implant/cruciform/cruciform.dm index fadd1b530aa..bddb789562d 100644 --- a/code/modules/core_implant/cruciform/cruciform.dm +++ b/code/modules/core_implant/cruciform/cruciform.dm @@ -1,6 +1,7 @@ #define OBELISK_UPDATE_TIME 5 SECONDS var/list/disciples = list() +var/list/lost_cruciforms = list() /obj/item/implant/core_implant/cruciform name = "cruciform" @@ -64,6 +65,11 @@ var/list/disciples = list() unregister_wearer() wearer.stats.removePerk(/datum/perk/sanityboost) wearer.stats.removePerk(/datum/perk/active_sanityboost) + lost_cruciforms |= src + return ..() + +/obj/item/implant/core_implant/cruciform/Destroy() + lost_cruciforms -= src return ..() /obj/item/implant/core_implant/cruciform/get_mob_overlay(gender) @@ -220,7 +226,6 @@ var/list/disciples = list() add_module(new CRUCIFORM_CLONING) - ////////////////////////// ////////////////////////// diff --git a/code/modules/core_implant/cruciform/rituals/base.dm b/code/modules/core_implant/cruciform/rituals/base.dm index 4342a2891a6..d00ebba952b 100644 --- a/code/modules/core_implant/cruciform/rituals/base.dm +++ b/code/modules/core_implant/cruciform/rituals/base.dm @@ -303,6 +303,7 @@ fail("Soul transfer failed.", user, C) return FALSE set_personal_cooldown(user) + lost_cruciforms -= CI return TRUE diff --git a/code/modules/core_implant/cruciform/rituals/priest.dm b/code/modules/core_implant/cruciform/rituals/priest.dm index 08c81949c92..485309bd551 100644 --- a/code/modules/core_implant/cruciform/rituals/priest.dm +++ b/code/modules/core_implant/cruciform/rituals/priest.dm @@ -507,27 +507,3 @@ eotp.nano_ui_interact(H) return TRUE - -/datum/ritual/cruciform/priest/acolyte/search - name = "Search" - phrase = "Ut ostenderet viam filio suo." - desc = "Find the location of disciple." - success_message = "Your prayers have been heard." - fail_message = "Your prayers have not been answered." - power = 25 - -/datum/ritual/cruciform/priest/acolyte/search/perform(mob/living/carbon/human/user, obj/item/implant/core_implant/C, list/targets) - var/list/OBJS = get_front(user) - - var/obj/machinery/power/eotp/EOTP = locate(/obj/machinery/power/eotp) in OBJS - if(!EOTP) - fail("You must be in front of the Eye of the Protector.", user, C) - return FALSE - - var/mob/living/carbon/human/H = pick_disciple_global(user, TRUE) - if (!H) - return - var/area/t = get_area(H) - log_game("[key_name(user)] locates [H] in [t] using Search litany.") - to_chat(user, span_info("[H], faithful cruciform follower, currently at [t.name].")) - return TRUE diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index 27d4ec61f65..80aa5efae67 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -61,6 +61,7 @@ var/obj/item/implant/core_implant/cruciform/C = get_core_implant(/obj/item/implant/core_implant/cruciform) if(C && C.active) + lost_cruciforms |= C var/obj/item/cruciform_upgrade/upgrade = C.upgrade if(upgrade && upgrade.active && istype(upgrade, CUPGRADE_MARTYR_GIFT)) var/obj/item/cruciform_upgrade/martyr_gift/martyr = upgrade diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index c4e5eeb2e41..7d898e92a24 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1385,6 +1385,11 @@ var/list/rank_prefix = list(\ jitteriness += 3 SECONDS updatehealth() switch_from_dead_to_living_mob_list() + + var/obj/item/implant/core_implant/cruciform/CI = get_core_implant(/obj/item/implant/core_implant/cruciform, req_activated = FALSE) + if(CI && CI.active) + lost_cruciforms -= CI + if(mind) for(var/mob/observer/ghost/G in GLOB.player_list) if(G.can_reenter_corpse && G.mind == mind)