Files
94d92803b4 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>
2025-11-04 21:27:42 +00:00

67 lines
2.1 KiB
Plaintext

/datum/technomancer/spell/destabilize
name = "Destabilize"
desc = "Creates an unstable disturbance at the targeted tile, which will afflict anyone nearby with instability who remains nearby. This can affect you \
and your allies as well. The disturbance lasts for twenty seconds."
cost = 100
ability_icon_state = "wiz_shield"
obj_path = /obj/item/spell/spawner/destabilize
category = OFFENSIVE_SPELLS
/obj/item/spell/spawner/destabilize
name = "Destabilize"
desc = "Now your enemies can feel what you go through when you have too much fun."
icon_state = "destabilize"
cast_methods = CAST_RANGED
aspect = ASPECT_UNSTABLE
spawner_type = /obj/effect/temporary_effect/destabilize
/obj/item/spell/spawner/destabilize/New()
..()
set_light_range_power_color(3, 2, "#C26DDE")
set_light_on(TRUE)
/obj/item/spell/spawner/destabilize/on_ranged_cast(atom/hit_atom, mob/user)
if(within_range(hit_atom) && pay_energy(2000))
adjust_instability(15)
..()
/obj/effect/temporary_effect/destabilize
name = "destabilizing disturbance"
desc = "This can't be good..."
icon_state = "blueshatter"
time_to_die = null
light_range = 6
light_power = 20
light_color = "#C26DDE"
var/pulses_remaining = 40 // Lasts 20 seconds.
var/instability_power = 5
var/instability_range = 6
var/timer_id = null
/obj/effect/temporary_effect/destabilize/Initialize()
..()
return INITIALIZE_HINT_LATELOAD
/obj/effect/temporary_effect/destabilize/LateInitialize()
. = ..()
timer_id = addtimer(CALLBACK(src, PROC_REF(radiate_loop)), 5 SECONDS, TIMER_UNIQUE|TIMER_STOPPABLE)
/obj/effect/temporary_effect/destabilize/Destroy()
deltimer(timer_id)
. = ..()
/obj/effect/temporary_effect/destabilize/proc/radiate_loop()
if(pulses_remaining && !QDELETED(src))
for(var/mob/living/L in range(src, instability_range) )
var/radius = max(get_dist(L, src), 1)
// Being farther away lessens the amount of instability received.
var/outgoing_instability = instability_power * ( 1 / (radius**2) )
L.receive_radiated_instability(outgoing_instability)
pulses_remaining--
timer_id = addtimer(CALLBACK(src, PROC_REF(radiate_loop)), 5 SECONDS, TIMER_UNIQUE|TIMER_STOPPABLE)
else
qdel(src)