From 8bdc7846ea8b83704f9093de42b516a97ee22cca Mon Sep 17 00:00:00 2001
From: SabreML <57483089+SabreML@users.noreply.github.com>
Date: Mon, 1 Mar 2021 20:40:09 +0000
Subject: [PATCH] Disaster Counter tweaks (#15610)
* Update disaster_counter.dm
* . = ..()
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
* Anchored
* Spacing
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
---
code/game/objects/structures/disaster_counter.dm | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/code/game/objects/structures/disaster_counter.dm b/code/game/objects/structures/disaster_counter.dm
index 3e860941d90..186771ea968 100644
--- a/code/game/objects/structures/disaster_counter.dm
+++ b/code/game/objects/structures/disaster_counter.dm
@@ -8,6 +8,7 @@
desc = "This device will count how many shifts it has been since a major disaster in this area. A safe workplace is a productive workplace."
icon = 'icons/obj/status_display.dmi'
icon_state = "frame"
+ anchored = TRUE
maptext_y = 10 // Offset by 10 so it renders properly
/// ID of the counter. Must be overriden. Use alphanumerics with no spaces only, as this is used in the filesystem.
var/counter_id
@@ -18,7 +19,7 @@
/obj/structure/disaster_counter/examine(mob/user)
. = ..()
- . += "The display reads 'Currently [current_count] shifts without an accident, with a record of [record_count] shifts!'"
+ . += "The display reads 'Currently [max(current_count, 0)] shifts without an accident, with a record of [record_count] shifts!'"
/obj/structure/disaster_counter/Initialize(mapload)
. = ..()
@@ -30,9 +31,9 @@
SSpersistent_data.register(src)
/obj/structure/disaster_counter/ex_act(severity)
- if(severity < 2)
- current_count = -1
- persistent_save()
+ current_count = -1
+ persistent_save()
+ update_maptext()
. = ..()
/obj/structure/disaster_counter/Destroy()
@@ -40,6 +41,9 @@
SSpersistent_data.registered_atoms -= src // Take us out the list
return ..()
+/obj/structure/disaster_counter/proc/update_maptext()
+ maptext = "[max(current_count, 0)]/[record_count]"
+
/obj/structure/disaster_counter/persistent_load()
// Just incase some bad actor sets the counter ID to "../../../../Windows/System32"
// Yes I am that paranoid
@@ -64,7 +68,7 @@
if(current_count > record_count)
record_count = current_count
log_debug("Persistent data for [src] loaded (current_count: [current_count] | record_count: [record_count])")
- maptext = "[current_count]/[record_count]"
+ update_maptext()
/obj/structure/disaster_counter/persistent_save()
if(counter_id != paranoid_sanitize(counter_id))