mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-06 23:41:57 +00:00
changes: Tables now use queue_icon_update() to trigger icon updates. SSicon_update has been promoted to SS_TICKER to reduce delay in icon updates. SSicon_update now only has one queue. This should prevent excessive table icon updates & mitigate table-lag from nar'sie.
55 lines
1.1 KiB
Plaintext
55 lines
1.1 KiB
Plaintext
/var/datum/controller/subsystem/icon/SSicon_update
|
|
|
|
/datum/controller/subsystem/icon
|
|
name = "Icon Updates"
|
|
wait = 1 // ticks
|
|
flags = SS_TICKER
|
|
priority = SS_PRIORITY_ICON_UPDATE
|
|
init_order = SS_INIT_ICON_UPDATE
|
|
|
|
var/list/queue = list()
|
|
|
|
/datum/controller/subsystem/icon/New()
|
|
NEW_SS_GLOBAL(SSicon_update)
|
|
|
|
/datum/controller/subsystem/icon/stat_entry()
|
|
..("QU:[queue.len]")
|
|
|
|
/datum/controller/subsystem/icon/Initialize()
|
|
fire(FALSE, TRUE)
|
|
..()
|
|
|
|
/datum/controller/subsystem/icon/fire(resumed = FALSE, no_mc_tick = FALSE)
|
|
var/list/curr = queue
|
|
|
|
if (!curr.len)
|
|
suspend()
|
|
return
|
|
|
|
while (curr.len)
|
|
var/atom/A = curr[curr.len]
|
|
curr.len--
|
|
|
|
A.icon_update_queued = FALSE
|
|
A.update_icon()
|
|
A.last_icon_update = world.time
|
|
|
|
if (no_mc_tick)
|
|
CHECK_TICK
|
|
else if (MC_TICK_CHECK)
|
|
return
|
|
|
|
/atom
|
|
var/last_icon_update
|
|
var/icon_update_queued
|
|
var/icon_update_delay
|
|
|
|
/atom/proc/update_icon()
|
|
|
|
/atom/proc/queue_icon_update()
|
|
if (!icon_update_queued && (!icon_update_delay || (last_icon_update + icon_update_delay < world.time)))
|
|
icon_update_queued = TRUE
|
|
SSicon_update.queue += src
|
|
if (SSicon_update.suspended)
|
|
SSicon_update.wake()
|