mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +01:00
Adds a check for border objects to projectile impacts (#66789)
When a projectile bumps into something, it decides what it actually hits by calling /obj/projectile/proc/select_target on that atom's turf. This lets the projectile prioritize either its original target or any mobs on the tile over whatever other crap is there, but does not account for border objects in the way of the projectile's path, which should always be the first thing the bullet hits. This PR makes select_target() prioritize the bumped atom if it's a border object, so that things like directional windows and firelocks properly block incoming fire. /turf/Entered already prioritizes border objects in the relevant direction when picking what to pass to Bump(), so we don't need to recheck the direction.
This commit is contained in:
@@ -454,34 +454,38 @@
|
||||
* 0. Anything that is already in impacted is ignored no matter what. Furthermore, in any bracket, if the target atom parameter is in it, that's hit first.
|
||||
* Furthermore, can_hit_target is always checked. This (entire proc) is PERFORMANCE OVERHEAD!! But, it shouldn't be ""too"" bad and I frankly don't have a better *generic non snowflakey* way that I can think of right now at 3 AM.
|
||||
* FURTHERMORE, mobs/objs have a density check from can_hit_target - to hit non dense objects over a turf, you must click on them, same for mobs that usually wouldn't get hit.
|
||||
* 1. The thing originally aimed at/clicked on
|
||||
* 2. Mobs - picks lowest buckled mob to prevent scarp piggybacking memes
|
||||
* 3. Objs
|
||||
* 4. Turf
|
||||
* 5. Nothing
|
||||
* 1. Special check on what we bumped to see if it's a border object that intercepts hitting anything behind it
|
||||
* 2. The thing originally aimed at/clicked on
|
||||
* 3. Mobs - picks lowest buckled mob to prevent scarp piggybacking memes
|
||||
* 4. Objs
|
||||
* 5. Turf
|
||||
* 6. Nothing
|
||||
*/
|
||||
/obj/projectile/proc/select_target(turf/our_turf, atom/target, atom/bumped)
|
||||
// 1. original
|
||||
// 1. special bumped border object check
|
||||
if(bumped?.flags_1 & ON_BORDER_1)
|
||||
return bumped
|
||||
// 2. original
|
||||
if(can_hit_target(original, TRUE, FALSE, original == bumped))
|
||||
return original
|
||||
var/list/atom/considering = list() // let's define this ONCE
|
||||
// 2. mobs
|
||||
// 3. mobs
|
||||
for(var/mob/living/iter_possible_target in our_turf)
|
||||
if(can_hit_target(iter_possible_target, iter_possible_target == original, TRUE, iter_possible_target == bumped))
|
||||
considering += iter_possible_target
|
||||
if(considering.len)
|
||||
var/mob/living/hit_living = pick(considering)
|
||||
return hit_living.lowest_buckled_mob()
|
||||
// 3. objs and other dense things
|
||||
// 4. objs and other dense things
|
||||
for(var/i in our_turf)
|
||||
if(can_hit_target(i, i == original, TRUE, i == bumped))
|
||||
considering += i
|
||||
if(considering.len)
|
||||
return pick(considering)
|
||||
// 4. turf
|
||||
// 5. turf
|
||||
if(can_hit_target(our_turf, our_turf == original, TRUE, our_turf == bumped))
|
||||
return our_turf
|
||||
// 5. nothing
|
||||
// 6. nothing
|
||||
// (returns null)
|
||||
|
||||
//Returns true if the target atom is on our current turf and above the right layer
|
||||
|
||||
Reference in New Issue
Block a user