public class WeaponUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
aimTowardsPoint(WeaponAPI weapon,
Vector2f point,
float time)
Manually adjusts a weapon's aim towards a point.
|
static List<ShipAPI> |
getAlliesInArc(WeaponAPI weapon)
Finds all allied ships within range of a
WeaponAPI. |
static List<ShipAPI> |
getEnemiesInArc(WeaponAPI weapon)
Finds all enemy ships within range of a
WeaponAPI. |
static List<MissileAPI> |
getEnemyMissilesInArc(WeaponAPI weapon)
Finds all enemy missiles within range of a
WeaponAPI. |
static @Nullable ShipAPI |
getNearestAllyInArc(WeaponAPI weapon)
Find the closest ally in range of a
WeaponAPI. |
static @Nullable ShipAPI |
getNearestEnemyInArc(WeaponAPI weapon)
Find the closest enemy in range of a
WeaponAPI. |
static @Nullable MissileAPI |
getNearestEnemyMissileInArc(WeaponAPI weapon)
Find the closest enemy missile in range of a
WeaponAPI. |
static float |
getTimeToAim(WeaponAPI weapon,
Vector2f aimAt)
Calculate how long it would take to turn a
WeaponAPI to aim at
a location. |
static boolean |
isWithinArc(CombatEntityAPI entity,
WeaponAPI weapon)
Checks if a
CombatEntityAPI is within the arc and range of a
WeaponAPI. |
public static boolean isWithinArc(CombatEntityAPI entity,
WeaponAPI weapon)
CombatEntityAPI is within the arc and range of a
WeaponAPI.entity - The CombatEntityAPI to check if weapon is
aimed at.weapon - The WeaponAPI to test against.true if in arc and in range, false otherwise.public static float getTimeToAim(WeaponAPI weapon,
Vector2f aimAt)
WeaponAPI to aim at
a location. Does NOT factor in current ship turn speed.weapon - The WeaponAPI to turn.aimAt - The Vector2f to aim at.weapon.@Nullable public static @Nullable ShipAPI getNearestAllyInArc(WeaponAPI weapon)
WeaponAPI.weapon - The WeaponAPI to search around.ShipAPI closest to weapon, or
null if none are in range.public static List<ShipAPI> getAlliesInArc(WeaponAPI weapon)
WeaponAPI.weapon - The weapon to detect allies in range of.List containing all allied ships within range.@Nullable public static @Nullable ShipAPI getNearestEnemyInArc(WeaponAPI weapon)
WeaponAPI.weapon - The WeaponAPI to search around.ShipAPI closest to weapon, or
null if none are in range.public static List<ShipAPI> getEnemiesInArc(WeaponAPI weapon)
WeaponAPI.weapon - The weapon to detect enemies in range of.List containing all enemy ships within range.@Nullable public static @Nullable MissileAPI getNearestEnemyMissileInArc(WeaponAPI weapon)
WeaponAPI.weapon - The WeaponAPI to search around.MissileAPI closest to weapon, or
null if none are in range.public static List<MissileAPI> getEnemyMissilesInArc(WeaponAPI weapon)
WeaponAPI.weapon - The weapon to detect enemies in range of.List containing all enemy missiles within range.public static void aimTowardsPoint(WeaponAPI weapon,
Vector2f point,
float time)
weapon - The weapon to aim.point - The point this weapon should try to aim at.time - How long since the last frame (for turn rate calculations).