Files
SmArtKarandRoxy d7ed479374 Improves hitscan projectile chunking (#89616)
## About The Pull Request

Hitscan projectiles that run out of dedicated tick time before they hit
anything abort their movement, ensuring that firing an emitter beam into
space won't cause horrible lag. However, most hitscans also have icons
and have visible (albeit unanimated) movement in such a case, making it
look like projectile code is exploding as tracers appear only after a
rather visible and tangible projectile hits its target.

This PR resolves the issue by making hitscans "chunk" their trails in
such cases, ensuring that they always look like actual hitscans. Video
below has an artificial speed cap on hitscans, to showcase how it'd look
during extreme lag.


https://github.com/user-attachments/assets/eeac034d-d08e-45b0-b7d2-8589376f1c7d

Also some minor hitscan code improvements because I can.

## Changelog
🆑
fix: Hitscan projectiles like emitter beams should look less weird
during extreme lag spikes
/🆑
2025-03-12 16:46:40 -04:00

33 lines
915 B
Plaintext

/obj/projectile/beam/wormhole
name = "bluespace beam"
icon_state = null
hitsound = SFX_SPARKS
damage = 0
pass_flags = PASSGLASS | PASSTABLE | PASSGRILLE | PASSMOB
//Weakref to the thing that shot us
var/datum/weakref/gun
color = COLOR_BLUE_LIGHT
tracer_type = /obj/effect/projectile/tracer/wormhole
impact_type = /obj/effect/projectile/impact/wormhole
muzzle_type = /obj/effect/projectile/muzzle/wormhole
hitscan = TRUE
/obj/projectile/beam/wormhole/orange
name = "orange bluespace beam"
color = "#FF6600"
/obj/projectile/beam/wormhole/Initialize(mapload, obj/item/ammo_casing/energy/wormhole/casing)
. = ..()
if(casing)
gun = casing.gun
/obj/projectile/beam/wormhole/on_hit(atom/target, blocked = 0, pierce_hit)
var/obj/item/gun/energy/wormhole_projector/projector = gun.resolve()
if(!projector)
qdel(src)
return BULLET_ACT_BLOCK
. = ..()
projector.create_portal(src, get_turf(src))