Skip to content

Commit

Permalink
hardrefs to weakrefs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaga-404 committed Feb 28, 2024
1 parent 6ebba89 commit cca9bf3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions code/datums/ammo/bullet/sniper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

if(istype(aimed_projectile.shot_from, /obj/item/weapon/gun/rifle/sniper/XM43E1))
var/obj/item/weapon/gun/rifle/sniper/XM43E1/amr = aimed_projectile.shot_from
if(target_mob == amr.focused_fire_target)
if(target_mob == (amr.focused_fire_target?.resolve()))
if(amr.focused_fire_counter < 2)
amr.focused_fire_counter += 1
else
Expand All @@ -123,7 +123,7 @@
amr.focused_fire_counter = 0

amr_counter = amr.focused_fire_counter + 1
amr.focused_fire_target = target_mob
amr.focused_fire_target = WEAKREF(target_mob)

var/mob/living/living_target = target_mob
var/size_damage_mod = 0.8 // 1.8x vs Non-Xenos (225)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/elements/bullet_trait/damage_boost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ GLOBAL_LIST_INIT(damage_boost_vehicles, typecacheof(/obj/vehicle/multitile))
active_damage_mult = damage_mult


if(boosted_projectile.damage_boosted && (boosted_projectile.last_atom_signaled != hit_atom) && (!boosted_projectile.bonus_projectile_check))
if(boosted_projectile.damage_boosted && ((boosted_projectile.last_atom_signaled?.resolve()) != hit_atom) && (!boosted_projectile.bonus_projectile_check))
//If this is after a boosted hit, the last atom that procced this isn't the same as the current target, and this isn't a bonus projectile sharing the same damage_boost
if(!boosted_projectile.last_damage_mult) //Make sure stored mult isn't 0
boosted_projectile.last_damage_mult = 1
Expand All @@ -95,4 +95,4 @@ GLOBAL_LIST_INIT(damage_boost_vehicles, typecacheof(/obj/vehicle/multitile))
boosted_projectile.last_damage_mult = 1

boosted_projectile.damage_boosted++ //Mark that a boosted hit occurred.
boosted_projectile.last_atom_signaled = hit_atom //Save the current triggering atom to the projectile
boosted_projectile.last_atom_signaled = WEAKREF(hit_atom) //Save the current triggering atom to the projectile
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/specialist/sniper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
indestructible = 1
aimed_shot_cooldown_delay = 4 SECONDS
var/focused_fire_counter = 0
var/mob/focused_fire_target = null
var/datum/weakref/focused_fire_target = null

fire_sound = 'sound/weapons/sniper_heavy.ogg'
current_mag = /obj/item/ammo_magazine/sniper/anti_materiel //Renamed from anti-tank to align with new identity/description. Other references have been changed as well. -Kaga
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
var/bonus_projectile_check = 0

/// What atom did this last receive a registered signal from? Used by damage_boost.dm
var/atom/last_atom_signaled = null
var/datum/weakref/last_atom_signaled = null

/// Was this projectile affected by damage_boost.dm? If so, what was the last modifier?
var/damage_boosted = 0
Expand Down

0 comments on commit cca9bf3

Please sign in to comment.