From 2fa0d8367e23c8bd4b0ed886c28e0e01dc5e40ba Mon Sep 17 00:00:00 2001 From: warriorstar-orion Date: Sun, 10 Nov 2024 16:32:11 -0500 Subject: [PATCH] fix: runtime when detonating gibtonite ores (#27295) --- code/datums/ores.dm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/datums/ores.dm b/code/datums/ores.dm index 7e0747669ab..7774a485cff 100644 --- a/code/datums/ores.dm +++ b/code/datums/ores.dm @@ -108,6 +108,9 @@ /// Note that this is only for explosions caused while the gibtonite is still /// unmined, in contrast to [/obj/item/gibtonite/proc/GibtoniteReaction]. var/notify_admins = FALSE + /// The callback for the explosion that occurs if the gibtonite is not + /// defused in time. + var/explosion_callback /datum/ore/gibtonite/New() // So you don't know exactly when the hot potato will explode @@ -135,7 +138,7 @@ RegisterSignal(source, COMSIG_PARENT_ATTACKBY, PROC_REF(on_parent_attackby)) detonate_start_time = world.time - addtimer(CALLBACK(src, TYPE_PROC_REF(/datum/ore/gibtonite, detonate), source), detonate_time) + explosion_callback = addtimer(CALLBACK(src, TYPE_PROC_REF(/datum/ore/gibtonite, detonate), source), detonate_time, TIMER_STOPPABLE) /datum/ore/gibtonite/on_mine(turf/source, mob/user, triggered_by_explosion = FALSE) switch(stage) @@ -146,7 +149,8 @@ if(GIBTONITE_ACTIVE) detonate(source) - return MINERAL_ALLOW_DIG + // Detonation takes care of this for us. + return MINERAL_PREVENT_DIG if(GIBTONITE_STABLE) var/obj/item/gibtonite/gibtonite = new(source) if(remaining_time <= 0) @@ -172,6 +176,10 @@ if(stage == GIBTONITE_STABLE) return + // Don't explode twice please + if(explosion_callback) + deltimer(explosion_callback) + stage = GIBTONITE_DETONATE explosion(source, 1, 3, 5, adminlog = notify_admins)