Icon smoothing and icon update refactor (#17569)

* Atomization

* asdfsadf

* sdfas

---------

Co-authored-by: FluffyGhost <FluffyGhost>
This commit is contained in:
Fluffy
2023-10-12 21:23:28 +00:00
committed by GitHub
co-authored by FluffyGhost <FluffyGhost>
parent bb4d89a498
commit 8bb0ecfcd3
7 changed files with 223 additions and 48 deletions
+18 -4
View File
@@ -24,12 +24,17 @@ SUBSYSTEM_DEF(icon_smooth)
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
var/list/smooth_queue = list()
///Like `smooth_queue`, but contains atoms that didn't initialize yet, to be reran
var/list/deferred = list()
var/list/typecachecache = list()
var/explosion_in_progress = FALSE
/datum/controller/subsystem/icon_smooth/Recover()
smooth_queue = SSicon_smooth.smooth_queue
deferred = SSicon_smooth.deferred
/datum/controller/subsystem/icon_smooth/stat_entry(msg)
msg = "Q:[smooth_queue.len]"
@@ -50,13 +55,20 @@ SUBSYSTEM_DEF(icon_smooth)
if(QDELETED(smoothing_atom) || !(smoothing_atom.smoothing_flags & SMOOTH_QUEUED))
continue
smooth_icon(smoothing_atom)
if(smoothing_atom.initialized && !(smoothing_atom.icon_update_queued))
smooth_icon(smoothing_atom)
else
deferred += smoothing_atom
if (MC_TICK_CHECK)
return
if (!length(smooth_queue_cache))
can_fire = FALSE
if(deferred.len)
smooth_queue = deferred
deferred = smooth_queue_cache
else
can_fire = FALSE
/datum/controller/subsystem/icon_smooth/ExplosionStart()
explosion_in_progress = TRUE
@@ -91,8 +103,9 @@ SUBSYSTEM_DEF(icon_smooth)
/datum/controller/subsystem/icon_smooth/proc/add_to_queue(atom/thing)
SHOULD_NOT_SLEEP(TRUE)
if(thing.smoothing_flags & SMOOTH_QUEUED)
if(QDELETED(thing) || thing.smoothing_flags & SMOOTH_QUEUED)
return
thing.smoothing_flags |= SMOOTH_QUEUED
smooth_queue += thing
@@ -103,7 +116,7 @@ SUBSYSTEM_DEF(icon_smooth)
SHOULD_NOT_SLEEP(TRUE)
for(var/atom/neighbor as anything in orange(1,thing))
if(neighbor.smoothing_flags)
if(!QDELETED(neighbor) && neighbor.smoothing_flags)
SSICONSMOOTH_ADD_TO_QUEUE(neighbor)
/datum/controller/subsystem/icon_smooth/proc/remove_from_queues(atom/thing)
@@ -111,5 +124,6 @@ SUBSYSTEM_DEF(icon_smooth)
thing.smoothing_flags &= ~SMOOTH_QUEUED
smooth_queue -= thing
deferred -= thing
#undef SSICONSMOOTH_ADD_TO_QUEUE