Z-Lights Mk 2 (#4383)

changes:
Bidirectional source Z-lights have been reverted to single-direction in favor of corner z-bleed.
Z-mimic turfs will now average their light level with their mimiced turf to better approximate Z-lighting.
Openspaces have been made significantly less dark.
Corners no longer incorrectly always take the instant update pathway.
MultiZ helpers are now macros.
More things now properly respect area dynamic lighting settings.
This commit is contained in:
Lohikar
2018-04-27 23:10:59 +03:00
committed by Erki
parent ec553e5796
commit 7ef4090f00
17 changed files with 151 additions and 75 deletions
+16 -25
View File
@@ -17,35 +17,25 @@ var/z_levels = 0 // Each bit represents a connection between adjacent levels. S
SSatlas.height_markers -= src
return ..()
// The storage of connections between adjacent levels means some bitwise magic is needed.
// Legacy shims.
/proc/HasAbove(var/z)
if(z >= world.maxz || z > 16 || z < 1)
return 0
return z_levels & (1 << (z - 1))
return HAS_ABOVE(z)
/proc/HasBelow(var/z)
if(z > world.maxz || z > 17 || z < 2)
return 0
return z_levels & (1 << (z - 2))
return HAS_BELOW(z)
// Thankfully, no bitwise magic is needed here.
/proc/GetAbove(var/atom/atom)
var/turf/turf = get_turf(atom)
if(!turf)
return null
return HasAbove(turf.z) ? get_step(turf, UP) : null
/proc/GetAbove(atom/A)
return A ? GET_ABOVE(A) : null
/proc/GetBelow(var/atom/atom)
var/turf/turf = get_turf(atom)
if(!turf)
return null
return HasBelow(turf.z) ? get_step(turf, DOWN) : null
/proc/GetBelow(atom/A)
return A ? GET_BELOW(A) : null
/proc/GetConnectedZlevels(z)
. = list(z)
for(var/level = z, HasBelow(level), level--)
for(var/level = z, HAS_BELOW(level), level--)
. += level-1
for(var/level = z, HasAbove(level), level++)
for(var/level = z, HAS_ABOVE(level), level++)
. += level+1
/proc/AreConnectedZLevels(var/zA, var/zB)
@@ -68,9 +58,10 @@ var/z_levels = 0 // Each bit represents a connection between adjacent levels. S
return new_entry[zB]
/proc/get_zstep(ref, dir)
if(dir == UP)
. = GetAbove(ref)
else if (dir == DOWN)
. = GetBelow(ref)
else
. = get_step(ref, dir)
switch (dir)
if (UP)
. = GET_ABOVE(ref)
if (DOWN)
. = GET_BELOW(ref)
else
. = get_step(ref, dir)