From 4fab84df538de230ed8dc190addba01b2dfddbb6 Mon Sep 17 00:00:00 2001 From: Sun-Soaked <45698967+MemedHams@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:23:33 -0500 Subject: [PATCH] fixensmoken -adds new wire defines that have more accurate names -fixes mines failing to recover from dud when their trigger wire is mended -fixes dud mines not flagging being stepped on -refactors mine slowdown(into being functional, as opposed to not) --- code/__DEFINES/wires.dm | 4 +- code/datums/wires/mines.dm | 56 +++++++++++------------ code/game/objects/items/devices/mines.dm | 45 +++++++++--------- code/modules/movespeed/modifiers/items.dm | 5 ++ 4 files changed, 58 insertions(+), 52 deletions(-) diff --git a/code/__DEFINES/wires.dm b/code/__DEFINES/wires.dm index 5623b5f52b4a..58fbb0aa6d27 100644 --- a/code/__DEFINES/wires.dm +++ b/code/__DEFINES/wires.dm @@ -51,4 +51,6 @@ #define WIRE_PRIZEVEND "Emergency Prize Vend" #define WIRE_RESETOWNER "Reset Owner" #define WIRE_AGELIMIT "Age Limit" - +#define WIRE_PIN "Trigger Pin" +#define WIRE_FUSE "Fuse" +#define WIRE_RESET "Factory Reset" diff --git a/code/datums/wires/mines.dm b/code/datums/wires/mines.dm index fb32f38b6fc9..f8aa2f05799c 100644 --- a/code/datums/wires/mines.dm +++ b/code/datums/wires/mines.dm @@ -4,7 +4,7 @@ /datum/wires/mine/New(atom/holder) wires = list( - WIRE_BOOM, WIRE_BOOM, WIRE_TIMING, WIRE_DISABLE, WIRE_DISARM + WIRE_BOOM, WIRE_BOOM, WIRE_FUSE, WIRE_PIN, WIRE_RESET ) ..() @@ -21,34 +21,32 @@ 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) + if(WIRE_FUSE) 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(WIRE_PIN) 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 + var/mob/living/defuser = ourmine.foot_on_mine.resolve() + defuser.remove_movespeed_modifier(/datum/movespeed_modifier/stepped_on_mine) + ourmine.foot_on_mine = null else 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(WIRE_RESET)//Disarms the mine, allowing it to be picked up. Major success. 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. ")) + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s arming lights fade, and the securing bolts loosen. ")) 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.alpha = 255 + var/mob/living/defuser = ourmine.foot_on_mine.resolve() + defuser.remove_movespeed_modifier(/datum/movespeed_modifier/stepped_on_mine) + ourmine.foot_on_mine = null 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.")) @@ -63,7 +61,7 @@ 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) + if(WIRE_FUSE) var/olddelay //define the olddelay here so it exists if(!mend) holder.visible_message(span_danger("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s timer goes dark.")) @@ -74,21 +72,23 @@ 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(WIRE_PIN) if(!mend) - ourmine.clickblock = TRUE + ourmine.dud = 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 - if(isopenturf(ourmine.loc) || ourmine.oldslow) - var/turf/open/locturf = ourmine.loc - locturf.slowdown = ourmine.oldslow - holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s detonation pad becomes loose.")) + var/mob/living/defuser = ourmine.foot_on_mine.resolve() + defuser.remove_movespeed_modifier(/datum/movespeed_modifier/stepped_on_mine) + else + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] \The [ourmine]'s detonation pad goes loose.")) + ourmine.foot_on_mine = null else - ourmine.clickblock = FALSE - if(WIRE_DISARM) + ourmine.dud = FALSE + ourmine.clicked = FALSE + holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] You hear something inside \the [ourmine] shift back into place.")) + if(WIRE_RESET) if(!mend) 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. ")) @@ -96,10 +96,10 @@ 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.alpha = 255 + var/mob/living/defuser = ourmine.foot_on_mine.resolve() + defuser.remove_movespeed_modifier(/datum/movespeed_modifier/stepped_on_mine) + ourmine.foot_on_mine = null 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.")) diff --git a/code/game/objects/items/devices/mines.dm b/code/game/objects/items/devices/mines.dm index 5ee84e531e7e..161b2d0be326 100644 --- a/code/game/objects/items/devices/mines.dm +++ b/code/game/objects/items/devices/mines.dm @@ -24,18 +24,18 @@ /// Use to set a delay after activation to trigger the explosion. var/blast_delay = 5 DECISECONDS - /// When true, mines explode instantly on being stepped upon + /// When true, mines trigger instantly on being stepped upon var/hair_trigger = FALSE /// Prevents a mine from being screwdrivable (e.g. cannot be disarmed) var/sealed = FALSE /// Disables the mine without disarming it. perfect for practical jokes - var/clickblock = FALSE + var/dud = FALSE /// Are the wires exposed? var/open_panel = FALSE /// Armed mines will become transparent by a set %. 0 is invisible, default value is fully visible - var/stealthpwr = 204 + var/stealthpwr = 255 var/manufacturer = MANUFACTURER_NONE @@ -98,39 +98,35 @@ if(foot_on_mine?.resolve()) return - foot_on_mine = WEAKREF(arrived) + if(dud == FALSE)//we don't actually need this if the mine's been disabled + foot_on_mine = WEAKREF(arrived) if(ismob(arrived)) var/mob/living/fool = arrived fool.do_alert_animation(fool) + if(dud == FALSE) + fool.add_movespeed_modifier(/datum/movespeed_modifier/stepped_on_mine) if(!hair_trigger) fool.Immobilize(15 DECISECONDS, TRUE) to_chat(fool, span_userdanger("You step on \the [src] and freeze.")) - visible_message(span_danger("[icon2html(src, viewers(src))] *click*")) - if(clickblock == FALSE)//see wirecutting + if(dud == FALSE)//see wirecutting clicked = TRUE - if(hair_trigger && clicked) - triggermine(arrived) - else - if(isopenturf(loc)) - var/turf/open/locturf = loc - oldslow = locturf.slowdown - locturf.slowdown = 6 - alpha = 204 + if(hair_trigger) + triggermine(arrived) + alpha = 255 playsound(src, 'sound/machines/click.ogg', 100, TRUE) //step 2: the consequences /obj/item/mine/proc/on_exited(datum/source, atom/movable/gone) SIGNAL_HANDLER - if(!clicked) + if(!clicked ) return if(!can_trigger(gone)) return // Check that the guy who's on it is stepping off if(foot_on_mine && !IS_WEAKREF_OF(gone, foot_on_mine)) return - INVOKE_ASYNC(src, PROC_REF(triggermine), gone) foot_on_mine = null @@ -142,9 +138,9 @@ triggermine() /obj/item/mine/Destroy()//just in case - if(isopenturf(loc) || oldslow) - var/turf/open/locturf = loc - locturf.slowdown = oldslow + if(foot_on_mine?.resolve()) + var/mob/living/slowedguy = foot_on_mine.resolve() + slowedguy.remove_movespeed_modifier(/datum/movespeed_modifier/stepped_on_mine) . = ..() /// When something sets off a mine @@ -177,6 +173,9 @@ mineEffect() visible_message(span_danger("[icon2html(src, viewers(src))] \the [src] detonates!")) SEND_SIGNAL(src, COMSIG_MINE_TRIGGERED, triggerer) + if(ismob(triggerer)) + var/mob/living/slowpoke = triggerer + slowpoke.remove_movespeed_modifier(/datum/movespeed_modifier/stepped_on_mine) qdel(src) //using an unarmed mine inhand deploys it. @@ -219,10 +218,10 @@ anchored = FALSE armed = FALSE clicked = FALSE - alpha = 204 - if(isopenturf(loc) || oldslow) - var/turf/open/locturf = loc - locturf.slowdown = oldslow + alpha = 255 + var/mob/living/defuser = foot_on_mine.resolve() + defuser.remove_movespeed_modifier(/datum/movespeed_modifier/stepped_on_mine) + foot_on_mine = null update_appearance(UPDATE_ICON_STATE) else user.visible_message(span_danger("[user] attempts to pick up \the [src] only to hear a beep as it activates in their hand!"), span_danger("You attempt to pick up \the [src] only to hear a beep as it activates in your hands!")) diff --git a/code/modules/movespeed/modifiers/items.dm b/code/modules/movespeed/modifiers/items.dm index b10e25c84e7a..5e0c7988f1b4 100644 --- a/code/modules/movespeed/modifiers/items.dm +++ b/code/modules/movespeed/modifiers/items.dm @@ -17,3 +17,8 @@ /datum/movespeed_modifier/berserk multiplicative_slowdown = -0.2 + +/datum/movespeed_modifier/stepped_on_mine + multiplicative_slowdown = 6 + movetypes = ALL + flags = IGNORE_NOSLOW