Skip to content

Commit

Permalink
Adds explosion handling to experimental sensor tower (#4984)
Browse files Browse the repository at this point in the history
# About the pull request

Fixes #4958 

Adds explosion handling to sensor tower.

# Explain why it's good for the game
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
add: Explosion handling logic to experimental sensor tower.
fix: Explosions no longer delete experimental sensor tower.
/:cl:
  • Loading branch information
Birdtalon authored Nov 22, 2023
1 parent b98d603 commit 81f55a3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions code/modules/desert_dam/motion_sensor/sensortower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,25 @@
..()
update_icon()

/* Decreases the buildstate of the sensor tower and switches it off if affected by any explosion.
Higher severity explosion will damage the sensor tower more
*/
/obj/structure/machinery/sensortower/ex_act(severity)
if(buildstate == SENSORTOWER_BUILDSTATE_WRENCH)
return
switch(severity)
if(0 to EXPLOSION_THRESHOLD_LOW)
buildstate += 1
if(EXPLOSION_THRESHOLD_LOW to EXPLOSION_THRESHOLD_MEDIUM)
buildstate = clamp(buildstate + 2, SENSORTOWER_BUILDSTATE_WORKING, SENSORTOWER_BUILDSTATE_WRENCH)
if(EXPLOSION_THRESHOLD_HIGH to INFINITY)
buildstate = 3
if(is_on)
is_on = FALSE
cur_tick = 0
stop_processing()
update_icon()

#undef SENSORTOWER_BUILDSTATE_WORKING
#undef SENSORTOWER_BUILDSTATE_BLOWTORCH
#undef SENSORTOWER_BUILDSTATE_WIRECUTTERS
Expand Down

0 comments on commit 81f55a3

Please sign in to comment.