From 9edb69e93bda7446999302244d4ba587400c8bed Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Tue, 4 Jul 2023 21:52:43 +1000 Subject: [PATCH] I hate mecha.dm I hate mecha.dm I hate mecha.dm. --- code/game/mecha/mecha.dm | 32 ++++++++++--------------- code/game/objects/items/bells.dm | 2 +- code/modules/mob/living/bot/floorbot.dm | 2 +- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 69181f5f7c..b41d11fd1b 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -479,12 +479,6 @@ radio.icon_state = icon_state radio.subspace_transmission = 1 -/obj/mecha/proc/do_after(delay as num) - sleep(delay) - if(src) - return 1 - return 0 - /obj/mecha/proc/enter_after(delay as num, var/mob/user as mob, var/numticks = 5) var/delayfraction = delay/numticks @@ -1641,7 +1635,7 @@ return var/obj/item/stack/nanopaste/nanopaste = W - while(!QDELETED(user) && !QDELETED(src) && do_after(user, 1 SECOND, src)) + while(!QDELETED(user) && !QDELETED(src)) // Get a component to attempt a repair on. var/obj/item/mecha_parts/component/component @@ -1656,12 +1650,8 @@ to_chat(user, SPAN_NOTICE("Nothing to repair!")) break - // Spend some time on the work. - if(!do_after(user, 1 SECOND, src)) - break - // Something has destroyed us or the mech, or we're incapacitated or moved away. - if(QDELETED(user) || QDELETED(src) || QDELETED(component) || component.loc != src) + if(QDELETED(user) || QDELETED(src) || QDELETED(component) || component.loc != src || !do_after(user, 1 SECOND, src)) break // Out of repair gel. @@ -2716,14 +2706,16 @@ src.occupant_message("Recalibrating coordination system.") src.log_message("Recalibration of coordination system started.") var/T = src.loc - if(do_after(100)) - if(T == src.loc) - src.clearInternalDamage(MECHA_INT_CONTROL_LOST) - src.occupant_message("Recalibration successful.") - src.log_message("Recalibration of coordination system finished with 0 errors.") - else - src.occupant_message("Recalibration failed.") - src.log_message("Recalibration of coordination system failed with 1 error.",1) + sleep(100) + if(QDELETED(src)) + return + if(T == src.loc) + src.clearInternalDamage(MECHA_INT_CONTROL_LOST) + src.occupant_message("Recalibration successful.") + src.log_message("Recalibration of coordination system finished with 0 errors.") + else + src.occupant_message("Recalibration failed.") + src.log_message("Recalibration of coordination system failed with 1 error.",1) if(href_list["drop_from_cargo"]) var/obj/O = locate(href_list["drop_from_cargo"]) if(O && (O in src.cargo)) diff --git a/code/game/objects/items/bells.dm b/code/game/objects/items/bells.dm index 66e1d0dce0..27ba85d998 100644 --- a/code/game/objects/items/bells.dm +++ b/code/game/objects/items/bells.dm @@ -88,7 +88,7 @@ if(!istype(W)) return if(W.is_wrench() && isturf(loc)) - if(do_after(5)) + if(do_after(user, 5, src)) if(!src) return to_chat(user, "You dissasemble the desk bell") new /obj/item/stack/material/steel(get_turf(src), 1) diff --git a/code/modules/mob/living/bot/floorbot.dm b/code/modules/mob/living/bot/floorbot.dm index 004e8a4c39..a3d8de85a2 100644 --- a/code/modules/mob/living/bot/floorbot.dm +++ b/code/modules/mob/living/bot/floorbot.dm @@ -285,7 +285,7 @@ while(amount + 4 <= maxAmount) busy = TRUE update_icons() - if(do_after(5 SECONDS)) + if(do_after(src, 5 SECONDS)) if(M) M.use(1) addTiles(4)