From 569c821cb4ad2f102f9539f42ff0ca6a820eb2f8 Mon Sep 17 00:00:00 2001 From: CHOMPStation2StaffMirrorBot <94713762+CHOMPStation2StaffMirrorBot@users.noreply.github.com> Date: Fri, 3 Apr 2026 22:44:48 -0700 Subject: [PATCH] [MIRROR] Fixes some bugs with spectral tech (#12632) Co-authored-by: Cameron Lennox --- code/game/objects/items/ghost_hunting/trap.dm | 15 ++++++++++-- .../entrepreneur/entrepreneur_items.dm | 2 +- .../experiment/handlers/experiment_handler.dm | 10 ++++++++ .../experiment/instances/spectral.dm | 23 ++++++++----------- code/modules/research/tg/server.dm | 7 ------ 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/code/game/objects/items/ghost_hunting/trap.dm b/code/game/objects/items/ghost_hunting/trap.dm index 9ebddd9cf3..b8e39fb34d 100644 --- a/code/game/objects/items/ghost_hunting/trap.dm +++ b/code/game/objects/items/ghost_hunting/trap.dm @@ -25,6 +25,17 @@ ghost_reporter = new(null) START_PROCESSING(SSobj, src) + var/static/list/ghost_signals = list( + COMSIG_GLOB_GHOST_CAPTURED = TYPE_PROC_REF(/datum/component/experiment_handler, try_run_spectral_experiment), + COMSIG_GLOB_WIGHT_CAPTURED = TYPE_PROC_REF(/datum/component/experiment_handler, try_run_spectral_experiment), + ) + + AddComponent(/datum/component/experiment_handler, \ + allowed_experiments = list(/datum/experiment/ghost_capture), \ + config_mode = EXPERIMENT_CONFIG_UI, \ + config_flags = EXPERIMENT_CONFIG_ALWAYS_ACTIVE, \ + experiment_signals = ghost_signals) + /obj/item/ghost_trap/Destroy() STOP_PROCESSING(SSobj, src) var/mob/our_entity = captured_entity?.resolve() @@ -191,12 +202,12 @@ if(isobserver(passing_entity)) to_chat(passing_entity, span_info("((You are incapable of moving or 'jumping' to turf by clicking, but can still escape via teleport or orbit!))")) - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_GHOST_CAPTURED, passing_entity) + SEND_SIGNAL(src, COMSIG_GLOB_GHOST_CAPTURED, passing_entity) /obj/item/ghost_trap/Crossed(atom/movable/AM) if(istype(AM, /obj/effect/shadow_wight)) - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_WIGHT_CAPTURED, AM) + SEND_SIGNAL(src, COMSIG_GLOB_WIGHT_CAPTURED, AM) visible_message(span_danger("A flurry of beams shoot into the air from \the [src] and into [AM], capturing and disintegrating it!")) return diff --git a/code/modules/entrepreneur/entrepreneur_items.dm b/code/modules/entrepreneur/entrepreneur_items.dm index c62d5c8302..0984d9e9a6 100644 --- a/code/modules/entrepreneur/entrepreneur_items.dm +++ b/code/modules/entrepreneur/entrepreneur_items.dm @@ -366,7 +366,7 @@ //Loop for the 'advanced' emfs, which detect actual ghosts/phasers. if(advanced) - for(var/mob/living/entity in range(detection_range, our_turf)) + for(var/mob/entity in range(detection_range, our_turf)) if(isobserver(entity)) var/mob/observer/dead/ghost = entity if(ghost.following || !ghost.interact_with_world || ghost.admin_ghosted) //Ghosts orbiting us or someone else, or have opted out of interactions. diff --git a/code/modules/research/tg/experisci/experiment/handlers/experiment_handler.dm b/code/modules/research/tg/experisci/experiment/handlers/experiment_handler.dm index e83fb5666a..1b52674139 100644 --- a/code/modules/research/tg/experisci/experiment/handlers/experiment_handler.dm +++ b/code/modules/research/tg/experisci/experiment/handlers/experiment_handler.dm @@ -143,6 +143,16 @@ playsound(source, 'sound/machines/ping.ogg', 25) source.atom_say("Destructive analysis complete.") +/** + * Hooks on to RD server to try and run a spectral experiment. + */ +/datum/component/experiment_handler/proc/try_run_spectral_experiment(obj/source, atom/scan_target) + SIGNAL_HANDLER + + if(action_experiment(source, scan_target)) + playsound(source, 'sound/machines/ping.ogg', 25) + source.atom_say("Spectral analysis complete.") + /** * Hooks on doppler array scans to try and run a explosive experiment. */ diff --git a/code/modules/research/tg/experisci/experiment/instances/spectral.dm b/code/modules/research/tg/experisci/experiment/instances/spectral.dm index 53c440277b..163090be06 100644 --- a/code/modules/research/tg/experisci/experiment/instances/spectral.dm +++ b/code/modules/research/tg/experisci/experiment/instances/spectral.dm @@ -3,20 +3,15 @@ name = "Spectral Capture" description = "There's supposed 'ghosts' and 'specters' roaming around this section of space! Let's capture one of these entities for science!" exp_tag = "Spectral" - allowed_experimentors = list(/obj/machinery/rnd/server) + allowed_experimentors = list(/obj/item/ghost_trap) + var/ghost_captured = FALSE /datum/experiment/ghost_capture/is_complete() - return completed + return ghost_captured -/datum/experiment/ghost_capture/New() - ..() - RegisterSignal(SSdcs, COMSIG_GLOB_GHOST_CAPTURED, PROC_REF(ghost_captured)) - RegisterSignal(SSdcs, COMSIG_GLOB_WIGHT_CAPTURED, PROC_REF(ghost_captured)) - return TRUE - -/datum/experiment/ghost_capture/proc/ghost_captured(datum/source, mob/captured_entity) - SIGNAL_HANDLER - // We don't actually care about the mob that's captured, just that something was captured. - completed = TRUE - UnregisterSignal(SSdcs, COMSIG_GLOB_GHOST_CAPTURED) - UnregisterSignal(SSdcs, COMSIG_GLOB_WIGHT_CAPTURED) +/datum/experiment/ghost_capture/perform_experiment_actions(datum/source, atom/movable/captured_entity) + if(isobserver(captured_entity) || isliving(captured_entity) || isliving(/obj/effect/shadow_wight)) + // We don't actually care about the mob that's captured, just that something was captured. + ghost_captured = TRUE + return TRUE + return FALSE diff --git a/code/modules/research/tg/server.dm b/code/modules/research/tg/server.dm index cda3f61bd1..f6ba9de14a 100644 --- a/code/modules/research/tg/server.dm +++ b/code/modules/research/tg/server.dm @@ -24,13 +24,6 @@ stored_research.techweb_servers |= src name += " [num2hex(rand(1,65535), -1)]" //gives us a random four-digit hex number as part of the name. Y'know, for fluff. - //So we can be listening for experiments that are global. - AddComponent(/datum/component/experiment_handler, \ - allowed_experiments = list(/datum/experiment/ghost_capture), \ - config_mode = EXPERIMENT_CONFIG_UI, \ - config_flags = EXPERIMENT_CONFIG_ALWAYS_ACTIVE) - - /obj/machinery/rnd/server/Destroy() if(stored_research) stored_research.techweb_servers -= src