Skip to content

Commit

Permalink
Guncode Agony DopplerShift13#2: Fixes harddels caused by certain proj…
Browse files Browse the repository at this point in the history
…ectiles (collosus bolts in CI) (tgstation#87534)

## About The Pull Request

Closes tgstation#87349
This may seem concerning but projectiles always assume that their firer
and original can be null at any step, so this is completely safe.

## Changelog
:cl:
fix: Fixed harddels caused by certain projectiles
/:cl:
  • Loading branch information
SmArtKar authored Oct 29, 2024
1 parent 7f5d9d7 commit 7a951a3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,10 @@
if(fired_from)
SEND_SIGNAL(fired_from, COMSIG_PROJECTILE_BEFORE_FIRE, src, original)
if(firer)
RegisterSignal(firer, COMSIG_QDELETING, PROC_REF(firer_deleted))
SEND_SIGNAL(firer, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE, src, fired_from, original)
if (original)
RegisterSignal(original, COMSIG_QDELETING, PROC_REF(original_deleted))
if(!log_override && firer && original && !do_not_log)
log_combat(firer, original, "fired at", src, "from [get_area_name(src, TRUE)]")
//note: mecha projectile logging is handled in /obj/item/mecha_parts/mecha_equipment/weapon/action(). try to keep these messages roughly the sameish just for consistency's sake.
Expand Down Expand Up @@ -814,6 +817,14 @@
store_hitscan_collision(point_cache)
return TRUE

/obj/projectile/proc/firer_deleted(datum/source)
SIGNAL_HANDLER
firer = null

/obj/projectile/proc/original_deleted(datum/source)
SIGNAL_HANDLER
original = null

/// Same as set_angle, but the reflection continues from the center of the object that reflects it instead of the side
/obj/projectile/proc/set_angle_centered(new_angle)
if(!nondirectional_sprite)
Expand Down Expand Up @@ -1064,6 +1075,8 @@
finalize_hitscan_and_generate_tracers()
STOP_PROCESSING(SSprojectiles, src)
cleanup_beam_segments()
firer = null
original = null
if(trajectory)
QDEL_NULL(trajectory)
return ..()
Expand Down

0 comments on commit 7a951a3

Please sign in to comment.