Replaces our lighting system with CM's. (#21465)

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>
This commit is contained in:
Matt Atlas
2025-11-04 21:27:42 +00:00
committed by GitHub
co-authored by Matt Atlas JohnWildkins
parent 8ebd7c9ad5
commit 94d92803b4
395 changed files with 3906 additions and 3299 deletions
+16 -4
View File
@@ -59,6 +59,7 @@
origin_tech = list(TECH_COMBAT = 1)
attack_verb = list("struck", "hit", "bashed")
zoomdevicename = "scope"
light_system = DIRECTIONAL_LIGHT
/*
* Suppression vars
@@ -461,9 +462,11 @@
handle_post_fire() // should be safe to not include arguments here, as there are failsafes in effect (?)
var/prev_light = light_range
if (muzzle_flash)
set_light(muzzle_flash)
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, set_light), 0), 2, TIMER_UNIQUE | TIMER_OVERRIDE)
set_light_range(muzzle_flash)
set_light_on(TRUE)
addtimer(CALLBACK(src, PROC_REF(reset_light_range), prev_light), 0.5 SECONDS)
update_icon()
if(i < burst)
@@ -477,6 +480,12 @@
accuracy = initial(accuracy) //Reset the gun's accuracy
/// called by a timer to remove the light range from muzzle flash
/obj/item/gun/proc/reset_light_range(lightrange)
set_light_range(lightrange)
if(lightrange <= 0)
set_light_on(FALSE)
//obtains the next projectile to fire
/obj/item/gun/proc/consume_next_projectile()
return null
@@ -513,8 +522,11 @@
)
if(muzzle_flash)
set_light(muzzle_flash)
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, set_light), 0), 2)
var/prev_light = light_range
if (muzzle_flash)
set_light_range(muzzle_flash)
set_light_on(TRUE)
addtimer(CALLBACK(src, PROC_REF(reset_light_range), prev_light), 0.5 SECONDS)
if(recoil)
shake_camera(user, recoil + 1, recoil)
+20 -2
View File
@@ -720,6 +720,8 @@
process_hitscan()
if(QDELETED(src))
return
else
generate_muzzle_flash()
if(!(datum_flags & DF_ISPROCESSING))
START_PROCESSING(SSprojectiles, src)
pixel_move(pixel_speed_multiplier, FALSE) //move it now!
@@ -1009,6 +1011,19 @@
beam_segments[beam_index] = point_cache
generate_hitscan_tracers(null, null, impacting)
/obj/projectile/proc/generate_muzzle_flash(duration = 3)
if(duration <= 0)
return
if(!muzzle_type || suppressed)
return
var/datum/point/p = trajectory
var/atom/movable/thing = new muzzle_type
p.move_atom_to_src(thing)
var/matrix/M = new
M.Turn(original_angle)
thing.transform = M
QDEL_IN(thing, duration)
/obj/projectile/proc/generate_hitscan_tracers(cleanup = TRUE, duration = 3, impacting = TRUE)
if(!length(beam_segments))
return
@@ -1024,7 +1039,8 @@
matrix.Turn(original_angle)
thing.transform = matrix
thing.color = color
thing.set_light(muzzle_flash_range, muzzle_flash_intensity, muzzle_flash_color_override? muzzle_flash_color_override : color)
thing.set_light_range_power_color(muzzle_flash_range, muzzle_flash_intensity, muzzle_flash_color_override ? muzzle_flash_color_override : color)
thing.set_light_on(TRUE)
QDEL_IN(thing, duration)
if(impacting && impact_type && duration > 0)
var/datum/point/p = beam_segments[beam_segments[beam_segments.len]]
@@ -1034,7 +1050,8 @@
matrix.Turn(Angle)
thing.transform = matrix
thing.color = color
thing.set_light(impact_light_range, impact_light_intensity, impact_light_color_override? impact_light_color_override : color)
thing.set_light_range_power_color(impact_light_range, impact_light_intensity, impact_light_color_override? impact_light_color_override : color)
thing.set_light_on(TRUE)
QDEL_IN(thing, duration)
if(cleanup)
cleanup_beam_segments()
@@ -1075,6 +1092,7 @@
bullet.original = target
bullet.preparePixelProjectile(target, src)
bullet.fire()
return bullet
@@ -13,6 +13,7 @@
var/frequency = 1
hitscan = 1
invisibility = 101 //beam projectiles are invisible as they are rendered by the effect engine
color = COLOR_RED
muzzle_type = /obj/effect/projectile/muzzle/laser
tracer_type = /obj/effect/projectile/tracer/laser