This commit is contained in:
L
2020-06-27 05:10:30 -03:00
parent 8f66088b0f
commit 52bf8a66f9
6 changed files with 110 additions and 82 deletions

View File

@@ -12,13 +12,15 @@ SUBSYSTEM_DEF(icon_smooth)
/datum/controller/subsystem/icon_smooth/fire()
var/list/cached = smooth_queue
while(cached.len)
var/atom/A = cached[cached.len]
while(length(cached))
var/atom/smoothing_atom = cached[length(cached)]
cached.len--
if (A.flags_1 & INITIALIZED_1)
smooth_icon(A)
if(QDELETED(smoothing_atom) || !(smoothing_atom.smooth & SMOOTH_QUEUED))
continue
if(smoothing_atom.flags_1 & INITIALIZED_1)
smooth_icon(smoothing_atom)
else
deferred += A
deferred += smoothing_atom
if (MC_TICK_CHECK)
return
@@ -27,27 +29,46 @@ SUBSYSTEM_DEF(icon_smooth)
smooth_queue = deferred
deferred = cached
else
can_fire = 0
can_fire = FALSE
/datum/controller/subsystem/icon_smooth/Initialize()
smooth_zlevel(1,TRUE)
smooth_zlevel(2,TRUE)
var/queue = smooth_queue
var/list/queue = smooth_queue
smooth_queue = list()
for(var/V in queue)
var/atom/A = V
if(!A || A.z <= 2)
while(length(queue))
var/atom/smoothing_atom = queue[length(queue)]
queue.len--
if(QDELETED(smoothing_atom) || !(smoothing_atom.smooth & SMOOTH_QUEUED) || smoothing_atom.z <= 2)
continue
smooth_icon(A)
smooth_icon(smoothing_atom)
CHECK_TICK
queue = blueprint_queue
blueprint_queue = list()
var/atom/movable/AM
var/turf/T
for(var/item in queue)
AM = item
T = AM.loc
if(T && AM)
T.add_blueprints(AM)
var/atom/movable/movable_item = item
if(!isturf(movable_item.loc))
continue
var/turf/item_loc = movable_item.loc
item_loc.add_blueprints(movable_item)
return ..()
/datum/controller/subsystem/icon_smooth/proc/add_to_queue(atom/thing)
if(thing.smooth & SMOOTH_QUEUED)
return
thing.smooth |= SMOOTH_QUEUED
smooth_queue += thing
if(!can_fire)
can_fire = TRUE
/datum/controller/subsystem/icon_smooth/proc/remove_from_queues(atom/thing)
thing &= ~SMOOTH_QUEUED
smooth_queue -= thing
blueprint_queue -= thing
deferred -= thing