mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 07:32:02 +00:00
Cross-Z Lighting (#2281)
This PR edits the lighting engine's turf selection algorithm to also include turfs below openturf tiles, allowing for cross-Z lighting. changes: Lights now will now shine down Z-levels when they light up an open turf. Commented-out openturf starlight pending making it not pummel SSlighting. Openspace overlays are now only queued if they are not already in the queue. Lighting overlays will now also update their associated openturf overlay on update if they have one. Removed an old unused message from the asteroid generation subsystem.
This commit is contained in:
@@ -1693,7 +1693,6 @@
|
||||
#include "code\modules\multiz\basic.dm"
|
||||
#include "code\modules\multiz\movement.dm"
|
||||
#include "code\modules\multiz\openspace.dm"
|
||||
#include "code\modules\multiz\openspace_overlay.dm"
|
||||
#include "code\modules\multiz\pipes.dm"
|
||||
#include "code\modules\multiz\structures.dm"
|
||||
#include "code\modules\multiz\turf.dm"
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
#define SS_INIT_SMOOTHING 6 // Object icon smoothing. Creates overlays.
|
||||
#define SS_INIT_ICON_UPDATE 5 // Icon update queue flush. Should run before overlays.
|
||||
#define SS_INIT_OVERLAY 4 // Overlay flush.
|
||||
#define SS_INIT_OPENTURF 3 // Openturf flush. Should run after SSoverlay & SSicon_smooth so it copies the smoothed sprites. Causes lighting updates if starlight is enabled.
|
||||
#define SS_INIT_MISC 2 // Subsystems without an explicitly set initialization order start here.
|
||||
#define SS_INIT_LIGHTING 1 // Generation of lighting overlays and pre-bake.
|
||||
#define SS_INIT_MISC 3 // Subsystems without an explicitly set initialization order start here.
|
||||
#define SS_INIT_LIGHTING 2 // Generation of lighting overlays and pre-bake.
|
||||
#define SS_INIT_OPENTURF 1 // Openturf flush. Should run after SSoverlay & SSicon_smooth so it copies the smoothed sprites. Causes lighting updates if starlight is enabled.
|
||||
#define SS_INIT_LOBBY 0 // Lobby timer starts here.
|
||||
|
||||
// Something to remember when setting priorities: SS_TICKER runs before Normal, which runs before SS_BACKGROUND.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/datum/controller/subsystem/asteroid/Initialize(timeofday)
|
||||
if(config.generate_asteroid)
|
||||
// These values determine the specific area that the map is applied to.
|
||||
// If you do not use the official Baycode moonbase map, you will need to change them.
|
||||
|
||||
// Create the chasms.
|
||||
new /datum/random_map/automata/cave_system/chasms(null,0,0,3,255,255)
|
||||
new /datum/random_map/automata/cave_system(null,0,0,3,255,255)
|
||||
@@ -15,12 +15,9 @@
|
||||
new /datum/random_map/automata/cave_system/chasms(null,0,0,5,255,255)
|
||||
new /datum/random_map/automata/cave_system/high_yield(null,0,0,5,255,255)
|
||||
new /datum/random_map/automata/cave_system/chasms/surface(null,0,0,6,255,255)
|
||||
|
||||
// Create the deep mining ore distribution map.
|
||||
new /datum/random_map/noise/ore(null, 0, 0, 5, 64, 64)
|
||||
new /datum/random_map/noise/ore(null, 0, 0, 4, 64, 64)
|
||||
new /datum/random_map/noise/ore(null, 0, 0, 3, 64, 64)
|
||||
var/counting_result = "Total number of chasms: [SSopenturf.openspace_turfs.len]"
|
||||
admin_notice(span("danger", counting_result))
|
||||
game_log("ASGEN", counting_result)
|
||||
|
||||
..()
|
||||
|
||||
@@ -97,18 +97,12 @@
|
||||
// Handle space parallax & starlight.
|
||||
if (T.is_above_space())
|
||||
T.plane = PLANE_SPACE_BACKGROUND
|
||||
if (config.starlight)
|
||||
for (var/thing in RANGE_TURFS(1, T))
|
||||
var/turf/RT = thing
|
||||
if (!RT.dynamic_lighting || istype(RT, /turf/simulated/open))
|
||||
continue
|
||||
|
||||
T.set_light(config.starlight, 0.5)
|
||||
break
|
||||
/*if (config.starlight) // Openturf starlight is broken. SSlighting and SSopenturf will fight if this is un-commented-out. Maybe someone will fix it someday.
|
||||
T.set_light(config.starlight, 0.5)*/
|
||||
else
|
||||
T.plane = OPENTURF_MAX_PLANE - depth
|
||||
if (config.starlight && T.light_range != 0)
|
||||
T.set_light(0)
|
||||
/*if (config.starlight && T.light_range != 0)
|
||||
T.set_light(0)*/
|
||||
|
||||
// Add everything below us to the update queue.
|
||||
for (var/thing in T.below)
|
||||
@@ -167,11 +161,10 @@
|
||||
OO.dir = OO.associated_atom.dir
|
||||
OO.appearance = OO.associated_atom
|
||||
OO.plane = OPENTURF_MAX_PLANE - OO.depth
|
||||
OO.queued = FALSE
|
||||
|
||||
// Something's above us, queue it.
|
||||
var/turf/oo_loc = OO.loc
|
||||
if (istype(oo_loc.above))
|
||||
oo_loc.above.update_icon()
|
||||
if (OO.bound_overlay) // If we have a bound overlay, queue it too.
|
||||
OO.update_oo()
|
||||
|
||||
if (no_mc_tick)
|
||||
CHECK_TICK
|
||||
|
||||
@@ -119,6 +119,9 @@
|
||||
)
|
||||
#endif
|
||||
|
||||
if (bound_overlay)
|
||||
update_oo()
|
||||
|
||||
// Variety of overrides so the overlays don't get affected by weird things.
|
||||
|
||||
/atom/movable/lighting_overlay/ex_act(severity)
|
||||
|
||||
@@ -371,6 +371,7 @@
|
||||
var/Sy = source_turf.y
|
||||
|
||||
FOR_DVIEW(T, Ceiling(light_range), source_turf, 0)
|
||||
check_t:
|
||||
if (light_angle && check_light_cone(T.x, T.y))
|
||||
continue
|
||||
|
||||
@@ -379,6 +380,11 @@
|
||||
corners[C] = 0
|
||||
|
||||
turfs += T
|
||||
|
||||
if (istype(T, /turf/simulated/open) && T:below)
|
||||
T = T:below // Consider the turf below us as well. (Z-lights)
|
||||
goto check_t
|
||||
|
||||
END_FOR_DVIEW
|
||||
|
||||
LAZYINITLIST(affecting_turfs)
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
return
|
||||
|
||||
// check_existence returns TRUE if the overlay is valid.
|
||||
if (bound_overlay.check_existence())
|
||||
if (bound_overlay.check_existence() && !bound_overlay.queued)
|
||||
SSopenturf.queued_overlays += bound_overlay
|
||||
|
||||
/atom/movable/proc/get_above_oo()
|
||||
@@ -105,4 +105,47 @@
|
||||
|
||||
return ..()
|
||||
|
||||
// /atom/movable/openspace/overlay is in openspace_overlay.dm
|
||||
// The visual representation of an atom under an openspace turf.
|
||||
/atom/movable/openspace/overlay
|
||||
plane = OPENTURF_MAX_PLANE
|
||||
var/atom/movable/associated_atom
|
||||
var/depth
|
||||
var/queued = FALSE
|
||||
|
||||
/atom/movable/openspace/overlay/New()
|
||||
SSopenturf.openspace_overlays += src
|
||||
|
||||
/atom/movable/openspace/overlay/Destroy()
|
||||
SSopenturf.openspace_overlays -= src
|
||||
|
||||
if (associated_atom)
|
||||
associated_atom.bound_overlay = null
|
||||
associated_atom = null
|
||||
|
||||
return ..()
|
||||
|
||||
/atom/movable/openspace/overlay/attackby(obj/item/W, mob/user)
|
||||
user << span("notice", "\The [src] is too far away.")
|
||||
|
||||
/atom/movable/openspace/overlay/attack_hand(mob/user as mob)
|
||||
user << span("notice", "You cannot reach \the [src] from here.")
|
||||
|
||||
/atom/movable/openspace/overlay/attack_generic(mob/user as mob)
|
||||
user << span("notice", "You cannot reach \the [src] from here.")
|
||||
|
||||
/atom/movable/openspace/overlay/forceMove(atom/dest)
|
||||
. = ..()
|
||||
check_existence()
|
||||
|
||||
/atom/movable/openspace/overlay/Move()
|
||||
. = ..()
|
||||
check_existence()
|
||||
|
||||
// Checks if we've moved off of an openturf.
|
||||
// Returns TRUE if we're continuing to exist, FALSE if we're deleting ourselves.
|
||||
/atom/movable/openspace/overlay/proc/check_existence()
|
||||
if (!istype(loc, /turf/simulated/open))
|
||||
qdel(src)
|
||||
return FALSE
|
||||
else
|
||||
return TRUE
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// The visual representation of an atom under an openspace turf.
|
||||
/atom/movable/openspace/overlay
|
||||
plane = OPENTURF_MAX_PLANE
|
||||
var/atom/movable/associated_atom
|
||||
var/depth
|
||||
|
||||
/atom/movable/openspace/overlay/New()
|
||||
SSopenturf.openspace_overlays += src
|
||||
|
||||
/atom/movable/openspace/overlay/Destroy()
|
||||
SSopenturf.openspace_overlays -= src
|
||||
|
||||
if (associated_atom)
|
||||
associated_atom.bound_overlay = null
|
||||
associated_atom = null
|
||||
|
||||
return ..()
|
||||
|
||||
/atom/movable/openspace/overlay/attackby(obj/item/W, mob/user)
|
||||
user << span("notice", "\The [src] is too far away.")
|
||||
|
||||
/atom/movable/openspace/overlay/attack_hand(mob/user as mob)
|
||||
user << span("notice", "You cannot reach \the [src] from here.")
|
||||
|
||||
/atom/movable/openspace/overlay/attack_generic(mob/user as mob)
|
||||
user << span("notice", "You cannot reach \the [src] from here.")
|
||||
|
||||
/atom/movable/openspace/overlay/forceMove(atom/dest)
|
||||
. = ..()
|
||||
check_existence()
|
||||
|
||||
/atom/movable/openspace/overlay/Move()
|
||||
. = ..()
|
||||
check_existence()
|
||||
|
||||
// Checks if we've moved off of an openturf.
|
||||
// Returns TRUE if we're continuing to exist, FALSE if we're deleting ourselves.
|
||||
/atom/movable/openspace/overlay/proc/check_existence()
|
||||
if (!istype(loc, /turf/simulated/open))
|
||||
qdel(src)
|
||||
return FALSE
|
||||
else
|
||||
return TRUE
|
||||
4
html/changelogs/lohikar-zlights.yml
Normal file
4
html/changelogs/lohikar-zlights.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
author: Lohikar
|
||||
delete-after: True
|
||||
changes:
|
||||
- tweak: "Lights will now shine through Z-holes (openturfs)."
|
||||
Reference in New Issue
Block a user