mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-25 01:22:13 +00:00
Ambient Occlusion (#3419)
Adds an implementation of Europa's wall ambient occlusion, extended to operate on openturfs as well.
This commit is contained in:
47
code/controllers/subsystems/ao.dm
Normal file
47
code/controllers/subsystems/ao.dm
Normal file
@@ -0,0 +1,47 @@
|
||||
/var/datum/controller/subsystem/ao/SSocclusion
|
||||
|
||||
/datum/controller/subsystem/ao
|
||||
name = "Ambient Occlusion"
|
||||
flags = SS_FIRE_IN_LOBBY
|
||||
init_order = SS_INIT_AO
|
||||
wait = 1
|
||||
priority = SS_PRIORITY_LIGHTING
|
||||
|
||||
var/list/queue = list()
|
||||
|
||||
/datum/controller/subsystem/ao/New()
|
||||
NEW_SS_GLOBAL(SSocclusion)
|
||||
|
||||
/datum/controller/subsystem/ao/stat_entry()
|
||||
..("P:[queue.len]")
|
||||
|
||||
/datum/controller/subsystem/ao/Initialize()
|
||||
fire(FALSE, TRUE)
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/ao/fire(resumed = 0, no_mc_tick = FALSE)
|
||||
var/list/curr = queue
|
||||
while (curr.len)
|
||||
var/turf/target = curr[curr.len]
|
||||
curr.len--
|
||||
|
||||
if (!QDELETED(target))
|
||||
if (target.ao_queued == AO_UPDATE_REBUILD)
|
||||
var/old = target.ao_neighbors
|
||||
target.calculate_ao_neighbors()
|
||||
if (old != target.ao_neighbors)
|
||||
target.update_ao()
|
||||
else
|
||||
target.update_ao()
|
||||
target.ao_queued = AO_UPDATE_NONE
|
||||
|
||||
if (no_mc_tick)
|
||||
CHECK_TICK
|
||||
else if (MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/ao/ExplosionStart()
|
||||
suspend()
|
||||
|
||||
/datum/controller/subsystem/ao/ExplosionEnd()
|
||||
wake()
|
||||
@@ -61,6 +61,8 @@
|
||||
// This is for the kitty ears item.
|
||||
var/list/kitty_ear_cache = list()
|
||||
|
||||
var/list/ao_cache = list()
|
||||
|
||||
/datum/controller/subsystem/icon_cache/New()
|
||||
NEW_SS_GLOBAL(SSicon_cache)
|
||||
|
||||
|
||||
@@ -28,10 +28,14 @@
|
||||
|
||||
while (curr.len)
|
||||
var/atom/A = curr[curr.len]
|
||||
var/list/argv = curr[A]
|
||||
curr.len--
|
||||
|
||||
A.icon_update_queued = FALSE
|
||||
A.update_icon()
|
||||
if (islist(argv))
|
||||
A.update_icon(arglist(argv))
|
||||
else
|
||||
A.update_icon()
|
||||
A.update_above()
|
||||
A.last_icon_update = world.time
|
||||
|
||||
@@ -47,9 +51,9 @@
|
||||
|
||||
/atom/proc/update_icon()
|
||||
|
||||
/atom/proc/queue_icon_update()
|
||||
/atom/proc/queue_icon_update(...)
|
||||
if (!icon_update_queued && (!icon_update_delay || (last_icon_update + icon_update_delay < world.time)))
|
||||
icon_update_queued = TRUE
|
||||
SSicon_update.queue += src
|
||||
SSicon_update.queue[src] = args.len ? args : TRUE
|
||||
if (SSicon_update.suspended)
|
||||
SSicon_update.wake()
|
||||
|
||||
@@ -5,6 +5,7 @@ var/datum/controller/subsystem/lighting/SSlighting
|
||||
/datum/controller/subsystem/lighting
|
||||
name = "Lighting"
|
||||
wait = LIGHTING_INTERVAL
|
||||
flags = SS_FIRE_IN_LOBBY
|
||||
|
||||
priority = SS_PRIORITY_LIGHTING
|
||||
init_order = SS_INIT_LIGHTING
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
wait = 1
|
||||
init_order = SS_INIT_OPENTURF
|
||||
priority = SS_PRIORITY_OPENTURF
|
||||
flags = SS_FIRE_IN_LOBBY
|
||||
|
||||
var/list/queued_turfs = list()
|
||||
var/list/qt_idex = 1
|
||||
@@ -127,6 +128,7 @@
|
||||
T.name = initial(T.name)
|
||||
T.desc = "Below seems to be \a [T.below]."
|
||||
T.opacity = FALSE
|
||||
T.queue_ao() // No need to recalculate ajacencies, shouldn't have changed.
|
||||
|
||||
// Handle space parallax & starlight.
|
||||
if (T.is_above_space())
|
||||
@@ -147,7 +149,6 @@
|
||||
|
||||
if (istype(object, /atom/movable/lighting_overlay)) // Special case.
|
||||
var/atom/movable/openspace/multiplier/shadower = T.shadower
|
||||
// This is duplicated in lighting_overlay.dm for performance reasons.
|
||||
shadower.appearance = object
|
||||
shadower.plane = OPENTURF_CAP_PLANE
|
||||
shadower.layer = SHADOWER_LAYER
|
||||
@@ -175,6 +176,9 @@
|
||||
0, 0, SHADOWER_DARKENING_FACTOR
|
||||
)
|
||||
|
||||
if (shadower.our_overlays || shadower.priority_overlays)
|
||||
shadower.compile_overlays()
|
||||
|
||||
if (shadower.bound_overlay)
|
||||
shadower.update_above()
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user