Skip to content

five-on-it / packages/sim/src/weapons / aimTargets

Function: aimTargets() ​

aimTargets(sim, shooter, yaw, range): number[]

Defined in: packages/sim/src/weapons.ts:373

The targets on a shooter's line of fire within range, nearest first: people on foot who can be hit and cars that are not wrecked (never the shooter or the car it sits in), whose centre lies within their width of the vertical plane through the aim, whatever their height, and in sight from the muzzle (a wall, or someone else, in the way hides them). The dogs on the line come after everything else, nearest first: one between the shooter and a person never takes the shot meant for the person (it passes over the dog). The input's target indexes this list.

Parameters ​

sim ​

SimWorld

shooter ​

number

yaw ​

number

range ​

number

Returns ​

number[]