mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 12:04:48 +01:00
more optimisation!
This commit is contained in:
@@ -108,18 +108,23 @@
|
||||
|
||||
return adjacencies
|
||||
|
||||
//do not use, use queue_smooth(atom)
|
||||
/proc/smooth_icon(atom/A)
|
||||
if(!A || !A.smooth || !A.z)
|
||||
return
|
||||
if(QDELETED(A))
|
||||
return
|
||||
if(!A || !A.smooth)
|
||||
return
|
||||
spawn(0)
|
||||
if((A.smooth & SMOOTH_TRUE) || (A.smooth & SMOOTH_MORE))
|
||||
var/adjacencies = calculate_adjacencies(A)
|
||||
if(A.smooth & SMOOTH_DIAGONAL)
|
||||
A.diagonal_smooth(adjacencies)
|
||||
else
|
||||
cardinal_smooth(A, adjacencies)
|
||||
if((A.smooth & SMOOTH_TRUE) || (A.smooth & SMOOTH_MORE))
|
||||
var/adjacencies = calculate_adjacencies(A)
|
||||
|
||||
if(A.smooth & SMOOTH_DIAGONAL)
|
||||
A.diagonal_smooth(adjacencies)
|
||||
else
|
||||
cardinal_smooth(A, adjacencies)
|
||||
if(A.smooth & SMOOTH_DIAGONAL)
|
||||
A.diagonal_smooth(adjacencies)
|
||||
else
|
||||
cardinal_smooth(A, adjacencies)
|
||||
|
||||
/atom/proc/diagonal_smooth(adjacencies)
|
||||
switch(adjacencies)
|
||||
@@ -152,12 +157,12 @@
|
||||
/turf/simulated/wall/diagonal_smooth(adjacencies)
|
||||
adjacencies = reverse_ndir(..())
|
||||
if(adjacencies)
|
||||
underlays.Cut()
|
||||
var/list/U = list()
|
||||
if(fixed_underlay)
|
||||
if(fixed_underlay["space"])
|
||||
underlays += image('icons/turf/space.dmi', SPACE_ICON_STATE, layer=TURF_LAYER)
|
||||
U += image('icons/turf/space.dmi', SPACE_ICON_STATE, layer=TURF_LAYER)
|
||||
else
|
||||
underlays += image(fixed_underlay["icon"], fixed_underlay["icon_state"], layer=TURF_LAYER)
|
||||
U += image(fixed_underlay["icon"], fixed_underlay["icon_state"], layer=TURF_LAYER)
|
||||
else
|
||||
var/turf/T = get_step(src, turn(adjacencies, 180))
|
||||
if(T && (T.density || T.smooth))
|
||||
@@ -166,13 +171,14 @@
|
||||
T = get_step(src, turn(adjacencies, 225))
|
||||
|
||||
if(istype(T, /turf/space) && !istype(T, /turf/space/transit))
|
||||
underlays += image('icons/turf/space.dmi', SPACE_ICON_STATE, layer=TURF_LAYER)
|
||||
U += image('icons/turf/space.dmi', SPACE_ICON_STATE, layer=TURF_LAYER)
|
||||
else if(T && !T.density && !T.smooth)
|
||||
underlays += T
|
||||
U += T
|
||||
else if(baseturf && !initial(baseturf.density) && !initial(baseturf.smooth))
|
||||
underlays += image(initial(baseturf.icon), initial(baseturf.icon_state), layer=TURF_LAYER)
|
||||
U += image(initial(baseturf.icon), initial(baseturf.icon_state), layer=TURF_LAYER)
|
||||
else
|
||||
underlays += DEFAULT_UNDERLAY_IMAGE
|
||||
U += DEFAULT_UNDERLAY_IMAGE
|
||||
underlays = U
|
||||
|
||||
/proc/cardinal_smooth(atom/A, adjacencies)
|
||||
//NW CORNER
|
||||
@@ -227,25 +233,30 @@
|
||||
else if(adjacencies & N_EAST)
|
||||
se = "4-e"
|
||||
|
||||
var/list/New = list()
|
||||
|
||||
if(A.top_left_corner != nw)
|
||||
A.overlays -= A.top_left_corner
|
||||
A.top_left_corner = nw
|
||||
A.overlays += nw
|
||||
New += nw
|
||||
|
||||
if(A.top_right_corner != ne)
|
||||
A.overlays -= A.top_right_corner
|
||||
A.top_right_corner = ne
|
||||
A.overlays += ne
|
||||
New += ne
|
||||
|
||||
if(A.bottom_right_corner != sw)
|
||||
A.overlays -= A.bottom_right_corner
|
||||
A.bottom_right_corner = sw
|
||||
A.overlays += sw
|
||||
New += sw
|
||||
|
||||
if(A.bottom_left_corner != se)
|
||||
A.overlays -= A.bottom_left_corner
|
||||
A.bottom_left_corner = se
|
||||
A.overlays += se
|
||||
New += se
|
||||
|
||||
if(New.len)
|
||||
A.overlays.Add(New)
|
||||
|
||||
/proc/find_type_in_direction(atom/source, direction)
|
||||
var/turf/target_turf = get_step(source, direction)
|
||||
@@ -307,14 +318,16 @@
|
||||
|
||||
/atom/proc/replace_smooth_overlays(nw, ne, sw, se)
|
||||
clear_smooth_overlays()
|
||||
var/list/O = list()
|
||||
top_left_corner = nw
|
||||
overlays += nw
|
||||
O += nw
|
||||
top_right_corner = ne
|
||||
overlays += ne
|
||||
O += ne
|
||||
bottom_left_corner = sw
|
||||
overlays += sw
|
||||
O += sw
|
||||
bottom_right_corner = se
|
||||
overlays += se
|
||||
O += se
|
||||
overlays.Add(O)
|
||||
|
||||
/proc/reverse_ndir(ndir)
|
||||
switch(ndir)
|
||||
@@ -354,27 +367,17 @@
|
||||
return 0
|
||||
|
||||
//SSicon_smooth
|
||||
/proc/ss_smooth_icon(atom/A)
|
||||
if(QDELETED(A))
|
||||
return
|
||||
if(!istype(A) || (A && !A.smooth))
|
||||
return
|
||||
if((A.smooth & SMOOTH_TRUE) || (A.smooth & SMOOTH_MORE))
|
||||
var/adjacencies = calculate_adjacencies(A)
|
||||
if(A.smooth & SMOOTH_DIAGONAL)
|
||||
A.diagonal_smooth(adjacencies)
|
||||
else
|
||||
cardinal_smooth(A, adjacencies)
|
||||
//SSicon_smooth
|
||||
/proc/queue_smooth_neighbors(atom/A)
|
||||
for(var/V in orange(1,A))
|
||||
var/atom/T = V
|
||||
if(T.smooth)
|
||||
queue_smooth(T)
|
||||
//SSicon_smooth
|
||||
|
||||
//SSicon_smooth
|
||||
/proc/queue_smooth(atom/A)
|
||||
if(SSicon_smooth)
|
||||
SSicon_smooth.smooth_queue |= A
|
||||
SSicon_smooth.smooth_queue[A] = A
|
||||
SSicon_smooth.can_fire = 1
|
||||
else
|
||||
smooth_icon(A)
|
||||
|
||||
|
||||
@@ -2,25 +2,34 @@ var/datum/controller/subsystem/icon_smooth/SSicon_smooth
|
||||
|
||||
/datum/controller/subsystem/icon_smooth
|
||||
name = "Icon Smoothing"
|
||||
priority = -5
|
||||
wait = 5
|
||||
init_order = -5
|
||||
wait = 1
|
||||
priority = 35
|
||||
flags = SS_TICKER
|
||||
|
||||
var/list/smooth_queue = list()
|
||||
|
||||
/datum/controller/subsystem/icon_smooth/New()
|
||||
NEW_SS_GLOBAL(SSicon_smooth)
|
||||
|
||||
/datum/controller/subsystem/icon_smooth/fire()
|
||||
for(var/atom in smooth_queue)
|
||||
ss_smooth_icon(atom)
|
||||
smooth_queue -= atom
|
||||
while(smooth_queue.len)
|
||||
var/atom/A = smooth_queue[smooth_queue.len]
|
||||
smooth_queue.len--
|
||||
smooth_icon(A)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
if (!smooth_queue.len)
|
||||
can_fire = 0
|
||||
|
||||
/datum/controller/subsystem/icon_smooth/Initialize()
|
||||
smooth_zlevel(1,TRUE)
|
||||
smooth_zlevel(2,TRUE)
|
||||
for(var/V in smooth_queue)
|
||||
var/queue = smooth_queue
|
||||
smooth_queue = list()
|
||||
for(var/V in queue)
|
||||
var/atom/A = V
|
||||
if(A.z == 1 || A.z == 2)
|
||||
smooth_queue -= A
|
||||
if(!A || A.z <= 2)
|
||||
continue
|
||||
smooth_icon(A)
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user