Skip to content

Commit

Permalink
fixensmoken
Browse files Browse the repository at this point in the history
-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)
  • Loading branch information
Sun-Soaked committed Feb 26, 2024
1 parent de53713 commit 4fab84d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 52 deletions.
4 changes: 3 additions & 1 deletion code/__DEFINES/wires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
56 changes: 28 additions & 28 deletions code/datums/wires/mines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
..()

Expand All @@ -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))] <b> \The [ourmine]'s arming lights fade, and the securing bolts loosen. Disarmed. </b>"))
holder.visible_message(span_notice("[icon2html(ourmine, viewers(holder))] <b> \The [ourmine]'s arming lights fade, and the securing bolts loosen. </b>"))
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."))
Expand All @@ -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."))
Expand All @@ -74,32 +72,34 @@
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))] <b> \The [ourmine]'s arming lights fade, and the securing bolts loosen. Disarmed. </b>"))
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."))
Expand Down
45 changes: 22 additions & 23 deletions code/game/objects/items/devices/mines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 )

Check failure on line 123 in code/game/objects/items/devices/mines.dm

View workflow job for this annotation

GitHub Actions / Run Linters

Check Regex

padding inside parentheses added to here, remove or update check_regex.yml
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

Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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!"))
Expand Down
5 changes: 5 additions & 0 deletions code/modules/movespeed/modifiers/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4fab84d

Please sign in to comment.