Files
Aurora.3/code/game/gamemodes/technomancer/spells/insert/insert.dm
T
Matt Atlas 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

62 lines
1.9 KiB
Plaintext

//Template for spells which put something inside someone else, good for buffs/debuffs, damage over times and heals over time.
/obj/item/spell/insert
name = "insert template"
desc = "Tell a coder if you can read this in-game."
icon_state = "purify"
cast_methods = CAST_MELEE
var/spell_color = "#03A728"
var/spell_light_intensity = 2
var/spell_light_range = 3
var/obj/item/inserted_spell/inserting = null
var/allow_stacking = 0
/obj/item/spell/insert/New()
..()
set_light_range_power_color(spell_light_range, spell_light_intensity, light_color)
set_light_on(TRUE)
/obj/item/inserted_spell
var/mob/living/carbon/human/origin = null
var/mob/living/host = null
var/spell_power_at_creation = 1.0 // This is here because the spell object that made this object probably won't exist.
/obj/item/inserted_spell/New(var/newloc, var/user, var/obj/item/spell/insert/inserter)
..(newloc)
host = newloc
origin = user
if(light_color && inserter)
set_light_range_power_color(inserter.spell_light_range, inserter.spell_light_intensity, inserter.spell_color)
on_insert()
/obj/item/inserted_spell/proc/on_insert()
return
/obj/item/inserted_spell/proc/on_expire(var/dispelled = 0)
qdel(src)
return
/obj/item/spell/insert/proc/insert(var/mob/living/L, mob/user)
if(inserting)
if(!allow_stacking)
for(var/obj/item/inserted_spell/IS in L.contents)
if(IS.type == inserting)
to_chat(user, SPAN_WARNING("\The [L] is already affected by \the [src]."))
return
var/obj/item/inserted_spell/inserted = new inserting(L,user,src)
inserted.spell_power_at_creation = calculate_spell_power(1.0)
log_and_message_admins("has casted [src] on [L].")
qdel(src)
/obj/item/spell/insert/on_melee_cast(atom/hit_atom, mob/user)
. = ..()
if(istype(hit_atom, /mob/living))
var/mob/living/L = hit_atom
insert(L,user)
/obj/item/spell/insert/on_ranged_cast(atom/hit_atom, mob/user)
. = ..()
if(istype(hit_atom, /mob/living))
var/mob/living/L = hit_atom
insert(L,user)