Fixes some rando failures off the ignore list of projectiles (#82855)

This commit is contained in:
LemonInTheDark
2024-04-24 12:05:06 -06:00
committed by GitHub
parent 0cb9aa842a
commit 59a20eb8e7
6 changed files with 11 additions and 12 deletions
+5 -6
View File
@@ -457,7 +457,7 @@
if(!trajectory)
qdel(src)
return FALSE
if(impacted[A]) // NEVER doublehit
if(impacted[A.weak_reference]) // NEVER doublehit
return FALSE
var/datum/point/point_cache = trajectory.copy_to()
var/turf/T = get_turf(A)
@@ -510,7 +510,7 @@
if(QDELETED(src) || !T || !target)
return
// 2.
impacted[target] = TRUE //hash lookup > in for performance in hit-checking
impacted[WEAKREF(target)] = TRUE //hash lookup > in for performance in hit-checking
// 3.
var/mode = prehit_pierce(target)
if(mode == PROJECTILE_DELETE_WITHOUT_HITTING)
@@ -587,7 +587,7 @@
//Returns true if the target atom is on our current turf and above the right layer
//If direct target is true it's the originally clicked target.
/obj/projectile/proc/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE)
if(QDELETED(target) || impacted[target])
if(QDELETED(target) || impacted[target.weak_reference])
return FALSE
if(!ignore_loc && (loc != target.loc) && !(can_hit_turfs && direct_target && loc == target))
return FALSE
@@ -675,7 +675,7 @@
* Used to not even attempt to Bump() or fail to Cross() anything we already hit.
*/
/obj/projectile/CanPassThrough(atom/blocker, movement_dir, blocker_opinion)
return impacted[blocker] ? TRUE : ..()
return ..() || impacted[blocker.weak_reference]
/**
* Projectile moved:
@@ -1188,8 +1188,7 @@
bullet.starting = startloc
var/list/ignore = list()
for (var/atom/thing as anything in ignore_targets)
ignore[thing] = TRUE
bullet.impacted += ignore
bullet.impacted[WEAKREF(thing)] = TRUE
bullet.firer = firer || src
bullet.fired_from = src
bullet.yo = target.y - startloc.y