Fixes a bitrunning runtime & adds a component initialize result (#90099)

## About The Pull Request
Noticed that bitrunning virtual spawners were runtiming if the server
was already emagged. Basically, the guardrail component is added
(virtual_entity), then immediately deleted because it's emagged, leading
to a race condition in `JoinParent()` where parent is null. I still want
to keep this "valid, but delete me" state for components, so I made
`COMPONENT_REDUNDANT` (thx @LemonInTheDark).

I can't say for certain because I couldn't repro, but this /probably/
fixes #89992
## Why It's Good For The Game
Fixes a runtime
Allows devs to add components that execute an arbitrary amount of logic
while still qdeling themselves due to some in-game incompatibility issue
## Changelog
N/A
This commit is contained in:
Jeremiah
2025-03-20 13:51:47 +01:00
committed by GitHub
parent 639908387e
commit 70d356506f
6 changed files with 47 additions and 19 deletions
+10
View File
@@ -49,12 +49,14 @@
/// Cooldown between being able to toggle broadcasting
COOLDOWN_DECLARE(broadcast_toggle_cd)
/obj/machinery/quantum_server/post_machine_initialize()
. = ..()
RegisterSignals(src, list(COMSIG_MACHINERY_BROKEN, COMSIG_MACHINERY_POWER_LOST), PROC_REF(on_broken))
RegisterSignal(src, COMSIG_QDELETING, PROC_REF(on_delete))
/obj/machinery/quantum_server/Destroy(force)
. = ..()
@@ -64,6 +66,7 @@
QDEL_NULL(exit_turfs)
QDEL_NULL(generated_domain)
/obj/machinery/quantum_server/examine(mob/user)
. = ..()
@@ -88,6 +91,7 @@
if(isobserver(user) && (obj_flags & EMAGGED))
. += span_notice("Ominous warning lights are blinking red. This server has been tampered with.")
/obj/machinery/quantum_server/emag_act(mob/user, obj/item/card/emag/emag_card)
. = ..()
@@ -102,6 +106,7 @@
balloon_alert(user, "system jailbroken...")
playsound(src, 'sound/effects/sparks/sparks1.ogg', 35, vary = TRUE)
/obj/machinery/quantum_server/update_appearance(updates)
if(isnull(generated_domain) || !is_operational)
set_light(l_on = FALSE)
@@ -110,6 +115,7 @@
set_light(l_range = 2, l_power = 1.5, l_color = is_ready ? LIGHT_COLOR_BABY_BLUE : LIGHT_COLOR_FIRE, l_on = TRUE)
return ..()
/obj/machinery/quantum_server/update_icon_state()
if(isnull(generated_domain) || !is_operational)
icon_state = base_icon_state
@@ -118,6 +124,7 @@
icon_state = "[base_icon_state]_[is_ready ? "on" : "off"]"
return ..()
/obj/machinery/quantum_server/attackby(obj/item/weapon, mob/user, params)
. = ..()
@@ -129,6 +136,7 @@
capacitor_coefficient = 0.1
points = 100
/obj/machinery/quantum_server/crowbar_act(mob/living/user, obj/item/crowbar)
. = ..()
@@ -142,6 +150,7 @@
return TRUE
return FALSE
/obj/machinery/quantum_server/screwdriver_act(mob/living/user, obj/item/screwdriver)
. = ..()
@@ -152,6 +161,7 @@
return TRUE
return FALSE
/obj/machinery/quantum_server/RefreshParts()
var/capacitor_rating = 1.15
var/datum/stock_part/capacitor/cap = locate() in component_parts