Skip to content

Commit

Permalink
bugfixathon
Browse files Browse the repository at this point in the history
opacity fixed
click fixed
disarming fixed
det time tweak
  • Loading branch information
Sun-Soaked committed Feb 26, 2024
1 parent a9f9f96 commit ca70c0f
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 60 deletions.
116 changes: 63 additions & 53 deletions code/datums/wires/mines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))] <b> \The [B]'s arming lights fade, and the securing bolts loosen. Disarmed. </b>"))
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))] <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.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))] <b> \The [B]'s arming lights fade, and the securing bolts loosen. Disarmed. </b>"))
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))] <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.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."))
21 changes: 14 additions & 7 deletions code/game/objects/items/devices/mines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -60,18 +60,18 @@
/obj/item/mine/examine(mob/user)
. = ..()
if(!armed)
. += "<span class='information'>It appears to be inactive...</span>"
. += span_info("It appears to be inactive...")
else
. += "<span class='information'>It looks ready to explode.</span>"
. += span_info("It looks ready to explode.")

if(manufacturer)
. += "<span class='notice'>It has <b>[manufacturer]</b> engraved on it.</span>"
. += span_notice("It has <b>[manufacturer]</b> engraved on it.")

var/atom/movable/unlucky_sod = foot_on_mine?.resolve()
if(user == unlucky_sod)
. += "<span class='span_bolddanger'>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))
. += "<span class='span_danger'>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()
. = ..()
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -213,6 +219,7 @@
anchored = FALSE
armed = FALSE
clicked = FALSE
alpha = 204
if(isopenturf(loc) || oldslow)
var/turf/open/locturf = loc
locturf.slowdown = oldslow
Expand Down

0 comments on commit ca70c0f

Please sign in to comment.