mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-14 17:36:52 +01:00
94d92803b4
Depends on #21458. Ports https://github.com/cmss13-devs/cmss13/pull/4229, with the original authors as: - https://github.com/tgstation/TerraGov-Marine-Corps/pull/1964 for the lighting controller (A-lexa) - https://github.com/tgstation/TerraGov-Marine-Corps/pull/4747 and https://github.com/tgstation/TerraGov-Marine-Corps/pull/7263 for the lighting (TiviPlus) - https://github.com/tgstation/tgstation/pull/54520 for the dir lighting component - https://github.com/tgstation/tgstation/pull/75018 for the out of bounds fix in lighting - https://github.com/tgstation/TerraGov-Marine-Corps/pull/6678 for the emissives (TiviPlus) The main driving reason behind this is that current lighting consumes way too much processing power, especially for things like odysseys/away sites where a billion light sources are processing/moving at once and the game slows down to a crawl. Hopefully this improves the situation by a good margin, but we will need some testmerging to confirm that. <img width="1349" height="1349" alt="image" src="https://github.com/user-attachments/assets/1059ba2b-c0c5-495a-9c76-2d75d0c42bf2" /> <img width="1349" height="1349" alt="image" src="https://github.com/user-attachments/assets/9704b0f6-4cf6-4dfd-a6cb-5702ad07d677" /> - [x] Resolve todos - [x] Look into open space fuckery (border objects) --------- Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: JohnWildkins <john.wildkins@gmail.com>
65 lines
2.1 KiB
Plaintext
65 lines
2.1 KiB
Plaintext
/turf
|
|
var/tmp/lighting_corners_initialised = FALSE
|
|
var/tmp/datum/static_lighting_object/static_lighting_object
|
|
|
|
///Lighting Corner datums.
|
|
var/tmp/datum/static_lighting_corner/lighting_corner_NE
|
|
var/tmp/datum/static_lighting_corner/lighting_corner_SE
|
|
var/tmp/datum/static_lighting_corner/lighting_corner_SW
|
|
var/tmp/datum/static_lighting_corner/lighting_corner_NW
|
|
|
|
/turf/proc/static_lighting_clear_overlay()
|
|
if (static_lighting_object)
|
|
qdel(static_lighting_object, TRUE)
|
|
|
|
/// Builds a lighting object for us, but only if our area is dynamic.
|
|
/turf/proc/static_lighting_build_overlay(area/our_area = loc)
|
|
if(static_lighting_object)
|
|
qdel(static_lighting_object, force=TRUE) //Shitty fix for lighting objects persisting after death
|
|
|
|
new/datum/static_lighting_object(src)
|
|
|
|
|
|
|
|
// Returns a boolean whether the turf is on soft lighting.
|
|
// Soft lighting being the threshold at which point the overlay considers
|
|
// itself as too dark to allow sight and see_in_dark becomes useful.
|
|
// So basically if this returns true the tile is unlit black.
|
|
/turf/proc/static_is_softly_lit()
|
|
if (!static_lighting_object)
|
|
return FALSE
|
|
|
|
return !(luminosity || dynamic_lumcount)
|
|
|
|
///Transfer the lighting of one area to another
|
|
/turf/proc/transfer_area_lighting(area/old_area, area/new_area)
|
|
if(SSlighting.initialized)
|
|
if (new_area.static_lighting != old_area.static_lighting)
|
|
if (new_area.static_lighting)
|
|
static_lighting_build_overlay(new_area)
|
|
else
|
|
static_lighting_clear_overlay()
|
|
//Inherit overlay of new area
|
|
if(old_area.lighting_effect)
|
|
overlays -= old_area.lighting_effect
|
|
if(new_area.lighting_effect)
|
|
overlays += new_area.lighting_effect
|
|
|
|
|
|
|
|
/turf/proc/static_generate_missing_corners()
|
|
if (!lighting_corner_NE)
|
|
lighting_corner_NE = new/datum/static_lighting_corner(src, NORTH|EAST)
|
|
|
|
if (!lighting_corner_SE)
|
|
lighting_corner_SE = new/datum/static_lighting_corner(src, SOUTH|EAST)
|
|
|
|
if (!lighting_corner_SW)
|
|
lighting_corner_SW = new/datum/static_lighting_corner(src, SOUTH|WEST)
|
|
|
|
if (!lighting_corner_NW)
|
|
lighting_corner_NW = new/datum/static_lighting_corner(src, NORTH|WEST)
|
|
|
|
lighting_corners_initialised = TRUE
|
|
|