From ca70c0f7882b2443182b9feca2bc002f89c7efca Mon Sep 17 00:00:00 2001 From: Sun-Soaked <45698967+MemedHams@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:46:58 -0500 Subject: [PATCH] bugfixathon opacity fixed click fixed disarming fixed det time tweak --- code/datums/wires/mines.dm | 116 ++++++++++++----------- code/game/objects/items/devices/mines.dm | 21 ++-- 2 files changed, 77 insertions(+), 60 deletions(-) diff --git a/code/datums/wires/mines.dm b/code/datums/wires/mines.dm index 527804b009a5..ae607b2d382c 100644 --- a/code/datums/wires/mines.dm +++ b/code/datums/wires/mines.dm @@ -9,86 +9,96 @@ ..() /datum/wires/mine/interactable(mob/user) - var/obj/item/mine/P = holder - if(P.open_panel) + var/obj/item/mine/ourmine = holder + if(ourmine.open_panel) return TRUE //are you feelin lucky, punk? /datum/wires/mine/on_pulse(wire) - var/obj/item/mine/B = holder + var/obj/item/mine/ourmine = holder switch(wire) if(WIRE_BOOM)//oopsies - holder.visible_message(span_userdanger("[icon2html(B, viewers(holder))] \The [B] makes a shrill noise! It's go-")) - B.triggermine() + holder.visible_message(span_userdanger("[icon2html(ourmine, viewers(holder))] \The [ourmine] makes a shrill noise! It's go-")) + ourmine.triggermine() //scrambles det time, up to 10 seconds, down to 10 miliseconds(basically instant) if(WIRE_TIMING) - holder.visible_message(span_danger("[icon2html(B, viewers(holder))] \The [B] buzzes ominously.")) - playsound(B, 'sound/machines/buzz-sigh.ogg', 30, TRUE) - B.blast_delay = rand(1,100) + holder.visible_message(span_danger("[icon2html(ourmine, viewers(holder))] \The [ourmine] buzzes ominously.")) + playsound(ourmine, 'sound/machines/buzz-sigh.ogg', 30, TRUE) + ourmine.blast_delay = rand(1,100) //Resets the detonation pin, allowing someone to step off the mine. Minor success. if(WIRE_DISABLE) - if(B.clicked == TRUE) - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] You hear something inside \the [B] click softly.")) - playsound(B, 'sound/weapons/empty.ogg', 30, TRUE) - B.clicked = FALSE + if(ourmine.clicked == TRUE) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] You hear something inside \the [ourmine] click softly.")) + playsound(ourmine, 'sound/weapons/empty.ogg', 30, TRUE) + ourmine.clicked = FALSE + if(ourmine.foot_on_mine?.resolve()) + ourmine.foot_on_mine = null + if(isopenturf(ourmine.loc) || ourmine.oldslow) + var/turf/open/locturf = ourmine.loc + locturf.slowdown = ourmine.oldslow else - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] \The [B]'s detonation pad shifts slightly. Nothing happens.")) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s detonation pad shifts slightly. Nothing happens.")) if(WIRE_DISARM)//Disarms the mine, allowing it to be picked up. Major success. - if(B.armed && B.anchored) - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] \The [B]'s arming lights fade, and the securing bolts loosen. Disarmed. ")) - playsound(B, 'sound/machines/click.ogg', 100, TRUE) - B.armed = FALSE - B.clicked = FALSE - B.anchored = FALSE - if(isopenturf(B.loc) || B.oldslow) - var/turf/open/locturf = B.loc - locturf.slowdown = B.oldslow - B.update_appearance(UPDATE_ICON_STATE) - else if(B.anchored) - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] \The [B]'s yellow arming light flickers.")) + if(ourmine.armed && ourmine.anchored) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s arming lights fade, and the securing bolts loosen. Disarmed. ")) + playsound(ourmine, 'sound/machines/click.ogg', 100, TRUE) + ourmine.armed = FALSE + ourmine.clicked = FALSE + ourmine.anchored = FALSE + ourmine.alpha = 204 + if(isopenturf(ourmine.loc) || ourmine.oldslow) + var/turf/open/locturf = ourmine.loc + locturf.slowdown = ourmine.oldslow + ourmine.update_appearance(UPDATE_ICON_STATE) + else if(ourmine.anchored) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s yellow arming light flickers.")) else - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] \The [B]'s securing bolt shifts. Nothing happens.")) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s securing bolt shifts. Nothing happens.")) /datum/wires/mine/on_cut(wire, mend) - var/obj/item/mine/B = holder + var/obj/item/mine/ourmine = holder switch(wire) if(WIRE_BOOM) if(!mend) - holder.visible_message(span_userdanger("[icon2html(B, viewers(holder))] \The [B] makes a shrill noise! It's go-")) - B.triggermine() + holder.visible_message(span_userdanger("[icon2html(ourmine, viewers(holder))] \The [ourmine] makes a shrill noise! It's go-")) + ourmine.triggermine() //sets det time to 3 seconds, reset back to previous time on mend. if(WIRE_TIMING) var/olddelay //define the olddelay here so it exists if(!mend) - holder.visible_message(span_danger("[icon2html(B, viewers(holder))] \The [B]'s timer goes dark.")) - olddelay = B.blast_delay//store old delay - B.blast_delay = 3 + holder.visible_message(span_danger("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s timer goes dark.")) + olddelay = ourmine.blast_delay//store old delay + ourmine.blast_delay = 3 SECONDS else - holder.visible_message(span_danger("[icon2html(B, viewers(holder))] \The [B]'s timer flickers back on.")) - B.blast_delay = olddelay//reset to old delay + holder.visible_message(span_danger("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s timer flickers back on.")) + ourmine.blast_delay = olddelay//reset to old delay //Disables the detonation pin. Nothing will happen when the mine is triggered. //Mine can still be exploded by cutting wires & damage. if(WIRE_DISABLE) if(!mend) - B.clickblock = TRUE - if(B.clicked == TRUE) - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] You hear something inside \the [B] shift out of place.")) - playsound(B, 'sound/weapons/empty.ogg', 30, TRUE) - B.clicked = FALSE - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] \The [B]'s detonation pad becomes loose.")) + ourmine.clickblock = TRUE + if(ourmine.clicked == TRUE) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] You hear something inside \the [ourmine] shift out of place.")) + playsound(ourmine, 'sound/weapons/empty.ogg', 30, TRUE) + ourmine.clicked = FALSE + ourmine.foot_on_mine = null + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s detonation pad becomes loose.")) + else + ourmine.clickblock = FALSE if(WIRE_DISARM) if(!mend) - if(B.armed && B.anchored) - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] \The [B]'s arming lights fade, and the securing bolts loosen. Disarmed. ")) - playsound(B, 'sound/machines/click.ogg', 100, TRUE) - B.armed = FALSE - B.clicked = FALSE - B.anchored = FALSE - if(isopenturf(B.loc) || B.oldslow) - var/turf/open/locturf = B.loc - locturf.slowdown = B.oldslow - B.update_appearance(UPDATE_ICON_STATE) - else if(B.anchored) - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] \The [B]'s yellow arming light flickers.")) + if(ourmine.armed && ourmine.anchored) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s arming lights fade, and the securing bolts loosen. Disarmed. ")) + playsound(ourmine, 'sound/machines/click.ogg', 100, TRUE) + ourmine.armed = FALSE + ourmine.clicked = FALSE + ourmine.anchored = FALSE + ourmine.alpha = 204 + if(isopenturf(ourmine.loc) || ourmine.oldslow) + var/turf/open/locturf = ourmine.loc + locturf.slowdown = ourmine.oldslow + ourmine.update_appearance(UPDATE_ICON_STATE) + else if(ourmine.anchored) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s yellow arming light flickers.")) else - holder.visible_message(span_notice("[icon2html(B, viewers(holder))] \The [B]'s securing bolt shifts. Nothing happens.")) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s securing bolt shifts. Nothing happens.")) diff --git a/code/game/objects/items/devices/mines.dm b/code/game/objects/items/devices/mines.dm index b9c2fe591448..5ee84e531e7e 100644 --- a/code/game/objects/items/devices/mines.dm +++ b/code/game/objects/items/devices/mines.dm @@ -22,7 +22,7 @@ /// Sets a delay for mines going live after being planted var/arm_delay = 5 SECONDS /// Use to set a delay after activation to trigger the explosion. - var/blast_delay = 8 DECISECONDS + var/blast_delay = 5 DECISECONDS /// When true, mines explode instantly on being stepped upon var/hair_trigger = FALSE @@ -60,18 +60,18 @@ /obj/item/mine/examine(mob/user) . = ..() if(!armed) - . += "It appears to be inactive..." + . += span_info("It appears to be inactive...") else - . += "It looks ready to explode." + . += span_info("It looks ready to explode.") if(manufacturer) - . += "It has [manufacturer] engraved on it." + . += span_notice("It has [manufacturer] engraved on it.") var/atom/movable/unlucky_sod = foot_on_mine?.resolve() if(user == unlucky_sod) - . += "The pressure plate is depressed. Any movement you make will set it off now." + . += span_bolddanger("The pressure plate is depressed. Any movement you make will set it off now.") else if(!isnull(unlucky_sod)) - . += "The pressure plate is depressed by [unlucky_sod]. Any move they make'll set it off now." + . += span_danger("The pressure plate is depressed by [unlucky_sod]. Any move they make'll set it off now.") /obj/item/mine/update_icon_state() . = ..() @@ -116,7 +116,7 @@ if(isopenturf(loc)) var/turf/open/locturf = loc oldslow = locturf.slowdown - locturf.slowdown = 4 + locturf.slowdown = 6 alpha = 204 playsound(src, 'sound/machines/click.ogg', 100, TRUE) @@ -141,6 +141,12 @@ blast_delay = blast_delay * 3 triggermine() +/obj/item/mine/Destroy()//just in case + if(isopenturf(loc) || oldslow) + var/turf/open/locturf = loc + locturf.slowdown = oldslow + . = ..() + /// When something sets off a mine /obj/item/mine/proc/triggermine(atom/movable/triggerer) if(triggered) //too busy detonating to detonate again @@ -213,6 +219,7 @@ anchored = FALSE armed = FALSE clicked = FALSE + alpha = 204 if(isopenturf(loc) || oldslow) var/turf/open/locturf = loc locturf.slowdown = oldslow