Skip to content

Commit

Permalink
Fix debug log spam
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhEugene committed Nov 3, 2023
1 parent 24c1fb3 commit 4cdeb2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions code/datums/chat_message.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ GLOBAL_LIST_EMPTY(runechat_image_cache)
message = null
return ..()

/datum/chatmessage/proc/unregister_and_qdel_self()
GLOB.destroyed_event.unregister(owned_by, src, .proc/unregister_and_qdel_self)
qdel_self()


/**
* Generates a chat message image representation
*
Expand All @@ -126,7 +131,6 @@ GLOBAL_LIST_EMPTY(runechat_image_cache)
/datum/chatmessage/proc/generate_image(text, atom/target, mob/owner, list/extra_classes, lifespan)
// Register client who owns this message
owned_by = owner.client
GLOB.destroyed_event.register(owned_by, src, .proc/qdel_self)

// Remove spans in the message from things like the recorder
var/static/regex/span_check = new(@"<\/?span[^>]*>", "gi")
Expand Down Expand Up @@ -155,6 +159,9 @@ GLOBAL_LIST_EMPTY(runechat_image_cache)
qdel(src)
return

// If haven't been deleted, watch for the owner
GLOB.destroyed_event.register(owned_by, src, .proc/unregister_and_qdel_self)

// Non mobs speakers can be small
if (!ismob(target))
extra_classes |= "small"
Expand Down Expand Up @@ -252,7 +259,7 @@ GLOBAL_LIST_EMPTY(runechat_image_cache)
animate(alpha = 0, time = CHAT_MESSAGE_EOL_FADE)

// Desctruct yourself
addtimer(new Callback(src, .proc/qdel_self), lifespan + CHAT_MESSAGE_GRACE_PERIOD, TIMER_UNIQUE|TIMER_OVERRIDE)
addtimer(new Callback(src, .proc/unregister_and_qdel_self), lifespan + CHAT_MESSAGE_GRACE_PERIOD, TIMER_UNIQUE|TIMER_OVERRIDE)

/datum/chatmessage/proc/get_current_alpha(time_spent)
if(time_spent < CHAT_MESSAGE_SPAWN_TIME)
Expand Down

0 comments on commit 4cdeb2a

Please sign in to comment.