Files
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
2.4 KiB
Plaintext

/datum/technomancer/spell/shield
name = "Shield"
desc = "Emits a protective shield fron your hand in front of you, which will protect you from almost anything able to harm \
you, so long as you can power it. Stronger attacks blocked cost more energy to sustain. \
Note that holding two shields will make blocking more energy efficent."
enhancement_desc = "Blocking is twice as efficient in terms of energy cost per hit."
cost = 100
obj_path = /obj/item/spell/shield
ability_icon_state = "tech_shield"
category = DEFENSIVE_SPELLS
/obj/item/spell/shield
name = "\proper energy shield"
icon_state = "shield"
desc = "A very protective combat shield that'll stop almost anything from hitting you, at least from the front."
aspect = ASPECT_FORCE
toggled = 1
var/damage_to_energy_multiplier = 30.0 //Determines how much energy to charge for blocking, e.g. 20 damage attack = 600 energy cost
/obj/item/spell/shield/Initialize()
. = ..()
set_light_range_power_color(3, 2, "#006AFF")
set_light_on(TRUE)
/obj/item/spell/shield/update_icon()
var/mob/living/carbon/human/H = owner
if(istype(owner) && istype(H.species, /datum/species/golem/technomancer))
item_state = "shield_golem"
return ..()
/obj/item/spell/shield/handle_shield(mob/user, var/on_back, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
if(user.incapacitated())
return BULLET_ACT_HIT
var/damage_to_energy_cost = damage_to_energy_multiplier * damage
if(issmall(user)) // Smaller shields are more efficient.
damage_to_energy_cost *= 0.75
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
if(istype(H.get_other_hand(src), src.type)) // Two shields in both hands.
damage_to_energy_cost *= 0.75
else if(check_for_scepter())
damage_to_energy_cost *= 0.50
if(!pay_energy(damage_to_energy_cost))
to_chat(owner, SPAN_DANGER("Your shield fades due to lack of energy!"))
qdel(src)
return BULLET_ACT_HIT
//block as long as they are not directly behind us
var/bad_arc = REVERSE_DIR(user.dir) //arc of directions from which we cannot block
if(check_shield_arc(user, bad_arc, damage_source, attacker))
user.visible_message(SPAN_DANGER("\The [user]'s [src] blocks [attack_text]!"))
spark(src, 3, GLOB.cardinals)
playsound(src, 'sound/weapons/blade.ogg', 50, 1)
adjust_instability(2)
return BULLET_ACT_BLOCK
return BULLET_ACT_HIT