Files
Paradise/code/controllers/subsystem/SSicon_smooth.dm
DGamerL bad8b31afa Changes all .len to length() where applicable (#25174)
* Globals work

* Double access works

* All other things

* Revert "All other things"

This reverts commit 6574442eb6.

* More changes that compile and work

* IT WORKS AAAAAA

* Changes even more .len to length()

* Apply suggestions from code review

* Update code/datums/mind.dm

* Update code/__HELPERS/sorts/InsertSort.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

* Update code/__HELPERS/sanitize_values.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

---------

Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
2024-04-19 17:32:09 +00:00

56 lines
1.4 KiB
Plaintext

SUBSYSTEM_DEF(icon_smooth)
name = "Icon Smoothing"
init_order = INIT_ORDER_ICON_SMOOTHING
wait = 1
priority = FIRE_PRIORITY_SMOOTHING
flags = SS_TICKER
offline_implications = "Objects will no longer smooth together properly. No immediate action is needed."
cpu_display = SS_CPUDISPLAY_LOW
var/list/smooth_queue = list()
/datum/controller/subsystem/icon_smooth/fire()
while(length(smooth_queue))
var/atom/A = smooth_queue[length(smooth_queue)]
smooth_queue.len--
A.smooth_icon()
if(MC_TICK_CHECK)
return
if(!length(smooth_queue))
can_fire = 0
/datum/controller/subsystem/icon_smooth/Initialize()
log_startup_progress("Smoothing atoms...")
// Smooth EVERYTHING in the world
for(var/turf/T in world)
if(T.smoothing_flags)
T.smooth_icon()
for(var/A in T)
var/atom/AA = A
if(AA.smoothing_flags)
AA.smooth_icon()
CHECK_TICK
// Incase any new atoms were added to the smoothing queue for whatever reason
var/queue = smooth_queue
smooth_queue = list()
for(var/V in queue)
var/atom/A = V
if(!A || A.z <= 2)
continue
A.smooth_icon()
CHECK_TICK
/datum/controller/subsystem/icon_smooth/proc/add_to_queue(atom/thing)
if(thing.smoothing_flags & SMOOTH_QUEUED)
return
thing.smoothing_flags |= SMOOTH_QUEUED
smooth_queue += thing
if(!can_fire)
can_fire = TRUE
/datum/controller/subsystem/icon_smooth/proc/remove_from_queues(atom/thing)
thing.smoothing_flags &= ~SMOOTH_QUEUED
smooth_queue -= thing