Files
Leland Kemble ae8f7e5a07 Fixes arcade machine experiment endlessly winning (#94177)
## About The Pull Request

Physical experiments don't call `unregister_events()` on completion like
normal experiments do, due to how they're finished. This led to the
arcade experiment never unregistering its victory signal and completing
over and over again. This pr unregisters the arcade's signal upon
completion, preventing this spam.

This also applies the same fix to the `meat_wall_explosion` experiment,
which isn't doable because it isn't referenced anywhere(anybody know
what's up with that? seems like a neat experiment), but it'd also have
not unregistered its signal upon completion.

## Why It's Good For The Game

fixes #94174

## Changelog
🆑

fix: Video game winning experiment no longer completes over and over 

/🆑
2025-11-29 11:40:26 -07:00

61 lines
2.7 KiB
Plaintext

/datum/experiment/physical/meat_wall_explosion
name = "Extreme Cooking Experiment"
description = "There has been interest in using our engineering equipment to see what kind of new cooking appliances we can create"
/datum/experiment/physical/meat_wall_explosion/register_events()
if(!iswallturf(currently_scanned_atom))
linked_experiment_handler.announce_message("Incorrect object for experiment.")
return FALSE
if(!currently_scanned_atom.has_material_type(/datum/material/meat))
linked_experiment_handler.announce_message("Object is not made out of the correct materials.")
return FALSE
RegisterSignal(currently_scanned_atom, COMSIG_ATOM_BULLET_ACT, PROC_REF(check_experiment))
linked_experiment_handler.announce_message("Experiment ready to start.")
return TRUE
/datum/experiment/physical/meat_wall_explosion/unregister_events()
UnregisterSignal(currently_scanned_atom, COMSIG_ATOM_BULLET_ACT)
/datum/experiment/physical/meat_wall_explosion/check_progress()
. += EXPERIMENT_PROG_BOOL("Fire an emitter at a tracked meat wall", is_complete())
/datum/experiment/physical/meat_wall_explosion/proc/check_experiment(datum/source, obj/projectile/proj)
SIGNAL_HANDLER
if(istype(proj, /obj/projectile/beam/emitter))
UnregisterSignal(currently_scanned_atom, COMSIG_ATOM_BULLET_ACT)
finish_experiment(linked_experiment_handler)
/datum/experiment/physical/meat_wall_explosion/finish_experiment(datum/component/experiment_handler/experiment_handler, datum/techweb/linked_web_override)
. = ..()
new /obj/effect/gibspawner/generic(currently_scanned_atom)
var/turf/meat_wall = currently_scanned_atom
var/turf/new_turf = meat_wall.ScrapeAway()
new /obj/effect/gibspawner/generic(new_turf)
new /obj/item/food/meat/steak/plain(new_turf)
/datum/experiment/physical/arcade_winner
name = "Playtesting Experiences"
description = "How do they make these arcade games so fun? Let's play one and win it to find out."
/datum/experiment/physical/arcade_winner/register_events()
if(!istype(currently_scanned_atom, /obj/machinery/computer/arcade))
linked_experiment_handler.announce_message("Incorrect object for experiment.")
return FALSE
RegisterSignal(currently_scanned_atom, COMSIG_ARCADE_VICTORY, PROC_REF(win_arcade))
linked_experiment_handler.announce_message("Experiment ready to start.")
return TRUE
/datum/experiment/physical/arcade_winner/unregister_events()
UnregisterSignal(currently_scanned_atom, COMSIG_ARCADE_VICTORY)
/datum/experiment/physical/arcade_winner/check_progress()
. += EXPERIMENT_PROG_BOOL("Win an arcade game at a tracked arcade cabinet.", is_complete())
/datum/experiment/physical/arcade_winner/proc/win_arcade(datum/source)
SIGNAL_HANDLER
UnregisterSignal(currently_scanned_atom, COMSIG_ARCADE_VICTORY)
finish_experiment(linked_experiment_handler)