Skip to content

Commit

Permalink
[MIRROR] Atoms that are on the border of a tile will now only trigger…
Browse files Browse the repository at this point in the history
… landmines if they actually pass over said landmine (#2509)

* Atoms that are on the border of a tile will now only trigger landmines if they actually pass over said landmine (#83156)

Fixes #83112



https://github.com/tgstation/tgstation/assets/6209658/13531391-6233-471a-8653-a68fc6ea7543



Muh immersion.


:cl: ShizCalev
fix: Atoms on the border of a tile will now only trigger landmines if
they ACTUALLY pass over said mine.
/:cl:

* Atoms that are on the border of a tile will now only trigger landmines if they actually pass over said landmine

---------

Co-authored-by: Afevis <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed May 16, 2024
1 parent a0aa7b3 commit 8c70103
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions code/game/objects/effects/mines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

return TRUE

/obj/effect/mine/proc/on_entered(datum/source, atom/movable/arrived)
/obj/effect/mine/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc)
SIGNAL_HANDLER

if(!can_trigger(arrived))
Expand All @@ -85,15 +85,35 @@
if(foot_on_mine?.resolve())
return

foot_on_mine = WEAKREF(arrived)
var/gonna_blow
if(arrived.flags_1 & ON_BORDER_1)
if(arrived.dir == get_dir(old_loc, src)) //see if a partial tile atom has passed the mine
gonna_blow = TRUE
else
return //it didn't actually touch the mine, don't blow

visible_message(span_danger("[icon2html(src, viewers(src))] *click*"))
playsound(src, 'sound/machines/click.ogg', 60, TRUE)
if(gonna_blow)
RegisterSignal(arrived, COMSIG_MOVABLE_MOVED, PROC_REF(triggermine)) //wait for it to finish the movement before blowing so it takes proper damage
return

foot_on_mine = WEAKREF(arrived)

/obj/effect/mine/proc/on_exited(datum/source, atom/movable/gone)

/obj/effect/mine/proc/on_exited(datum/source, atom/movable/gone, direction)
SIGNAL_HANDLER

if(!can_trigger(gone))
return

if(!foot_on_mine && gone.flags_1 & ON_BORDER_1)
if(gone.dir == REVERSE_DIR(direction)) //see if a north facing border atom (ie window) travels south (and other directions as needed)
visible_message(span_danger("[icon2html(src, viewers(src))] *click*"))
playsound(src, 'sound/machines/click.ogg', 60, TRUE)
triggermine() //it "passed" over the mine briefly, triggering it in the process
return //either it blew up the mine, or it didn't and we don't have to worry about anything else.

// Check that the guy who's on it is stepping off
if(foot_on_mine && !IS_WEAKREF_OF(gone, foot_on_mine))
return
Expand All @@ -107,6 +127,7 @@

/// When something sets off a mine
/obj/effect/mine/proc/triggermine(atom/movable/triggerer)
SIGNAL_HANDLER
if(triggered) //too busy detonating to detonate again
return
if(triggerer)
Expand Down

0 comments on commit 8c70103

Please sign in to comment.