Files
Wildkins e1770df81e Lag War Day 4: Under Pressure, High Voltage (#21878)
Replace /datum/gas_mixture/proc/return_pressure with XGM_PRESSURE(xgm)
macro. Having such a relatively simple statement contributing proc
overhead to procs called millions of times is ridiculous

Rename /datum/gas_mixture/proc/zburn to react, deleting the old react
which was just an alias for it. Free proc overhead

Turn check_combustibility into a macro CHECK_COMBUSTIBLE(is_cmb, xgm).
also rewrite it slightly so that it only needs to do one pass. Its a bit
nasty so I apologize for that, but speeeeed.

Delete most powernet and obj/machinery/power procs for handling power,
replacing them with macros. The fact that we were unironically calling a
draw_power() on APCs to call draw_power() on their terminals to call
draw_power() on their powernet every single process tick was insane.

Turn `between` into a macro alias for clamp() since the param order is
different

turn `Percent` into a macro AS_PCT

Rewrite significant chunks of update_canmove so its not quite as
horrifying of a proc and hopefully doesn't eat the entire mob subsystem
every movement now
2026-02-27 00:35:41 +00:00

48 lines
1.4 KiB
Plaintext

//Projectiles
/obj/projectile/kinetic
name = "kinetic force"
icon_state = null
damage = 0 //Base damage handled elsewhere.
damage_type = DAMAGE_BRUTE
check_armor = BOMB
range = 5
var/pressure_decrease = 0.25
var/base_damage = 0
var/aoe_shot = FALSE
ignore_source_check = TRUE
/obj/projectile/kinetic/mech
damage = 40
aoe = 5
/obj/projectile/kinetic/mech/burst
damage = 25
/obj/projectile/kinetic/on_hit(atom/target, blocked, def_zone)
. = ..()
var/turf/target_turf = get_turf(target)
if(!target_turf)
target_turf = get_turf(src)
if(istype(target_turf))
strike_thing(target_turf)
/obj/projectile/kinetic/proc/do_damage(var/turf/T, var/living_damage = 1, var/mineral_damage = 1)
if(!istype(T)) return
var/datum/gas_mixture/environment = T.return_air()
living_damage *= max(1 - (XGM_PRESSURE(environment) / 100) * 0.75, 0)
new /obj/effect/overlay/temp/kinetic_blast(T)
for(var/mob/living/L in T)
L.take_overall_damage(min(living_damage, 50))
L.visible_message(SPAN_DANGER("\The [L] is hit by \the [src]!"), SPAN_DANGER("You are hit by \the [src]!"))
if(istype(T, /turf/simulated/mineral))
var/turf/simulated/mineral/M = T
M.kinetic_hit(mineral_damage)
/obj/projectile/kinetic/proc/strike_thing(var/turf/target_turf)
for(var/new_target in RANGE_TURFS(aoe, target_turf))
var/turf/aoe_turf = new_target
do_damage(aoe_turf, max(base_damage - base_damage * get_dist(aoe_turf, target_turf) * 0.25, 0), damage)
if(!QDELETED(src))
qdel(src)