Package org.lazywizard.lazylib.combat
Class WeaponUtils
Object
WeaponUtils
Contains methods that deal with weapons and weapon arcs.
- Since:
- 1.0
- Author:
- LazyWizard
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaimTowardsPoint(WeaponAPI weapon, Vector2f point, float time) Manually adjusts a weapon's aim towards a point.getAlliesInArc(WeaponAPI weapon) Finds all allied ships within range of aWeaponAPI.getEnemiesInArc(WeaponAPI weapon) Finds all enemy ships within range of aWeaponAPI.static List<MissileAPI>getEnemyMissilesInArc(WeaponAPI weapon) Finds all enemy missiles within range of aWeaponAPI.static ShipAPIgetNearestAllyInArc(WeaponAPI weapon) Find the closest ally in range of aWeaponAPI.static ShipAPIgetNearestEnemyInArc(WeaponAPI weapon) Find the closest enemy in range of aWeaponAPI.static MissileAPIgetNearestEnemyMissileInArc(WeaponAPI weapon) Find the closest enemy missile in range of aWeaponAPI.static floatgetTimeToAim(WeaponAPI weapon, Vector2f aimAt) Calculate how long it would take to turn aWeaponAPIto aim at a location.static booleanisWithinArc(CombatEntityAPI entity, WeaponAPI weapon) Checks if aCombatEntityAPIis within the arc and range of aWeaponAPI.
-
Method Details
-
isWithinArc
Checks if aCombatEntityAPIis within the arc and range of aWeaponAPI.- Parameters:
entity- TheCombatEntityAPIto check ifweaponis aimed at.weapon- TheWeaponAPIto test against.- Returns:
trueif in arc and in range,falseotherwise.- Since:
- 1.0
-
getTimeToAim
Calculate how long it would take to turn aWeaponAPIto aim at a location. Does NOT factor in current ship turn speed. -
getNearestAllyInArc
Find the closest ally in range of aWeaponAPI. -
getAlliesInArc
Finds all allied ships within range of aWeaponAPI.- Parameters:
weapon- The weapon to detect allies in range of.- Returns:
- A
Listcontaining all allied ships within range. - Since:
- 1.7
-
getNearestEnemyInArc
Find the closest enemy in range of aWeaponAPI. -
getEnemiesInArc
Finds all enemy ships within range of aWeaponAPI.- Parameters:
weapon- The weapon to detect enemies in range of.- Returns:
- A
Listcontaining all enemy ships within range. - Since:
- 1.4
-
getNearestEnemyMissileInArc
Find the closest enemy missile in range of aWeaponAPI.- Parameters:
weapon- TheWeaponAPIto search around.- Returns:
- The enemy
MissileAPIclosest toweapon, ornullif none are in range. - Since:
- 1.4
-
getEnemyMissilesInArc
Finds all enemy missiles within range of aWeaponAPI.- Parameters:
weapon- The weapon to detect enemies in range of.- Returns:
- A
Listcontaining all enemy missiles within range. - Since:
- 1.4
-
aimTowardsPoint
Manually adjusts a weapon's aim towards a point.- Parameters:
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).- Since:
- 1.4
-