Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/bigape.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/area/ruin/powered)
"g" = (
/obj/item/flashlight/lamp/bananalamp{
brightness_on = 10
light_range = 10
},
/obj/structure/table/wood,
/obj/structure/fans/tiny/invisible,
Expand Down
8 changes: 6 additions & 2 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@
#define RAD_TEXT_LAYER 15.1


#define ABOVE_LIGHTING_PLANE 16
#define ABOVE_LIGHTING_LAYER 16
#define O_LIGHTING_VISUAL_PLANE 16
#define O_LIGHTING_VISUAL_LAYER 16
#define O_LIGHTING_VISUAL_RENDER_TARGET "O_LIGHT_VISUAL_PLANE"

#define ABOVE_LIGHTING_PLANE 17
#define ABOVE_LIGHTING_LAYER 17
#define ABOVE_LIGHTING_RENDER_TARGET "ABOVE_LIGHTING_PLANE"

#define FLOOR_OPENSPACE_PLANE 17
Expand Down
13 changes: 13 additions & 0 deletions code/__DEFINES/lighting.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
///Object doesn't use any of the light systems. Should be changed to add a light source to the object.
#define NO_LIGHT_SUPPORT 0
///Light made with the lighting datums, applying a matrix.
#define STATIC_LIGHT 1
///Light made by masking the lighting darkness plane.
#define MOVABLE_LIGHT 2

///Is a movable light source attached to another movable (its loc), meaning that the lighting component should go one level deeper.
#define LIGHT_ATTACHED (1<<0)

///This light doesn't affect turf's lumcount calculations. Set to 1<<15 to ignore conflicts
#define LIGHT_NO_LUMCOUNT (1<<15)

//Bay lighting engine shit, not in /code/modules/lighting because BYOND is being shit about it
/// frequency, in 1/10ths of a second, of the lighting process
#define LIGHTING_INTERVAL 5
Expand Down
25 changes: 17 additions & 8 deletions code/__DEFINES/machines.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
// channel numbers for power
#define EQUIP 1
#define LIGHT 2
#define ENVIRON 3
#define TOTAL 4 //for total power used only
#define STATIC_EQUIP 5
#define STATIC_LIGHT 6
#define STATIC_ENVIRON 7
// These are indexes in a list, and indexes for "dynamic" and static channels should be kept contiguous
#define AREA_USAGE_EQUIP 1
#define AREA_USAGE_LIGHT 2
#define AREA_USAGE_ENVIRON 3
#define AREA_USAGE_TOTAL 4
#define AREA_USAGE_STATIC_EQUIP 5
#define AREA_USAGE_STATIC_LIGHT 6
#define AREA_USAGE_STATIC_ENVIRON 7
#define AREA_USAGE_LEN AREA_USAGE_STATIC_ENVIRON // largest idx
/// Index of the first dynamic usage channel
#define AREA_USAGE_DYNAMIC_START AREA_USAGE_EQUIP
/// Index of the last dynamic usage channel
#define AREA_USAGE_DYNAMIC_END AREA_USAGE_ENVIRON
/// Index of the first static usage channel
#define AREA_USAGE_STATIC_START AREA_USAGE_STATIC_EQUIP
/// Index of the last static usage channel
#define AREA_USAGE_STATIC_END AREA_USAGE_STATIC_ENVIRON

//Power use
#define NO_POWER_USE 0
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,6 @@

///Define for spawning megafauna instead of a mob for cave gen
#define SPAWN_MEGAFAUNA "bluh bluh huge boss"

///Swarmer flags
#define SWARMER_LIGHT_ON (1<<0)
13 changes: 11 additions & 2 deletions code/_onclick/hud/plane_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@

/atom/movable/screen/plane_master/lighting/Initialize()
. = ..()
filters += filter(type="alpha", render_source=EMISSIVE_RENDER_TARGET, flags=MASK_INVERSE)
filters += filter(type="alpha", render_source=EMISSIVE_UNBLOCKABLE_RENDER_TARGET, flags=MASK_INVERSE)
filters += filter(type="alpha", render_source = EMISSIVE_RENDER_TARGET, flags = MASK_INVERSE)
filters += filter(type="alpha", render_source = EMISSIVE_UNBLOCKABLE_RENDER_TARGET, flags = MASK_INVERSE)
filters += filter(type="alpha", render_source = O_LIGHTING_VISUAL_RENDER_TARGET, flags = MASK_INVERSE)

/**
* Things placed on this mask the lighting plane. Doesn't render directly.
Expand Down Expand Up @@ -155,3 +156,11 @@
filters = list()
if(istype(mymob) && mymob.client?.prefs?.ambientocclusion)
filters += AMBIENT_OCCLUSION

/atom/movable/screen/plane_master/o_light_visual
name = "overlight light visual plane master"
layer = O_LIGHTING_VISUAL_LAYER
plane = O_LIGHTING_VISUAL_PLANE
render_target = O_LIGHTING_VISUAL_RENDER_TARGET
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
blend_mode = BLEND_MULTIPLY
33 changes: 18 additions & 15 deletions code/controllers/subsystem/lighting.dm
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
GLOBAL_LIST_EMPTY(lighting_update_lights) // List of lighting sources queued for update.
GLOBAL_LIST_EMPTY(lighting_update_corners) // List of lighting corners queued for update.
GLOBAL_LIST_EMPTY(lighting_update_objects) // List of lighting objects queued for update.

SUBSYSTEM_DEF(lighting)
name = "Lighting"
wait = 2
init_order = INIT_ORDER_LIGHTING
flags = SS_TICKER
var/static/list/sources_queue = list() // List of lighting sources queued for update.
var/static/list/corners_queue = list() // List of lighting corners queued for update.
var/static/list/objects_queue = list() // List of lighting objects queued for update.

loading_points = 6 SECONDS // Yogs -- loading times

/datum/controller/subsystem/lighting/stat_entry(msg)
msg = "L:[GLOB.lighting_update_lights.len]|C:[GLOB.lighting_update_corners.len]|O:[GLOB.lighting_update_objects.len]"
msg = "L:[length(sources_queue)]|C:[length(corners_queue)]|O:[length(objects_queue)]"
return ..()


Expand All @@ -34,9 +33,10 @@ SUBSYSTEM_DEF(lighting)
MC_SPLIT_TICK_INIT(3)
if(!init_tick_checks)
MC_SPLIT_TICK
var/list/queue = sources_queue
var/i = 0
for (i in 1 to GLOB.lighting_update_lights.len)
var/datum/light_source/L = GLOB.lighting_update_lights[i]
for (i in 1 to length(queue))
var/datum/light_source/L = queue[i]

L.update_corners()

Expand All @@ -47,31 +47,34 @@ SUBSYSTEM_DEF(lighting)
else if (MC_TICK_CHECK)
break
if (i)
GLOB.lighting_update_lights.Cut(1, i+1)
queue.Cut(1, i+1)
i = 0

if(!init_tick_checks)
MC_SPLIT_TICK

for (i in 1 to GLOB.lighting_update_corners.len)
var/datum/lighting_corner/C = GLOB.lighting_update_corners[i]
queue = corners_queue
for (i in 1 to length(queue))
var/datum/lighting_corner/C = queue[i]

C.needs_update = FALSE //update_objects() can call qdel if the corner is storing no data
C.update_objects()
C.needs_update = FALSE

if(init_tick_checks)
CHECK_TICK
else if (MC_TICK_CHECK)
break
if (i)
GLOB.lighting_update_corners.Cut(1, i+1)
queue.Cut(1, i+1)
i = 0


if(!init_tick_checks)
MC_SPLIT_TICK

for (i in 1 to GLOB.lighting_update_objects.len)
var/datum/lighting_object/O = GLOB.lighting_update_objects[i]
queue = objects_queue
for (i in 1 to length(queue))
var/datum/lighting_object/O = queue[i]

if (QDELETED(O))
continue
Expand All @@ -83,7 +86,7 @@ SUBSYSTEM_DEF(lighting)
else if (MC_TICK_CHECK)
break
if (i)
GLOB.lighting_update_objects.Cut(1, i+1)
queue.Cut(1, i+1)


/datum/controller/subsystem/lighting/Recover()
Expand Down
Loading