[MIRROR] Fixes some rando failures off the ignore list of projectiles (#27456)

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

* Fixes some rando failures off the ignore list of projectiles

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-04-27 02:41:33 +02:00
committed by GitHub
parent 42672c3169
commit 9603a2a889
6 changed files with 11 additions and 12 deletions

View File

@@ -475,7 +475,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)
@@ -528,7 +528,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)
@@ -605,7 +605,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
@@ -693,7 +693,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:
@@ -1206,8 +1206,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