Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Another way?..
Browse files Browse the repository at this point in the history
Venuska1117 committed Dec 2, 2024
1 parent b212241 commit 698d175
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions code/datums/balloon_alerts/balloon_alerts.dm
Original file line number Diff line number Diff line change
@@ -8,11 +8,12 @@
/// The amount of characters needed before this increase takes into effect
#define BALLOON_TEXT_CHAR_LIFETIME_INCREASE_MIN 10

var/list/last_balloon_alert = list()
// Define the last alert times as an atom-level variable
/atom/var/last_balloon_alert_time = 0 // i dont think its good idea... but checks are killing me...

/proc/can_display_balloon_alert(atom/source, delay)
var/last_time = last_balloon_alert[source]
if (last_time && (world.time - last_time < delay))
// Check if enough time has passed since the last alert
if (source.last_balloon_alert_time && (world.time - source.last_balloon_alert_time < delay))
return FALSE
return TRUE

@@ -22,7 +23,7 @@ var/list/last_balloon_alert = list()
if (delay > 0 && !can_display_balloon_alert(src, delay))
return

last_balloon_alert[src] = world.time
src.last_balloon_alert_time = world.time
INVOKE_ASYNC(src, PROC_REF(balloon_alert_perform), viewer, text, text_color)

/// Create balloon alerts (text that floats up) to everything within range.

0 comments on commit 698d175

Please sign in to comment.