public class CombatUtils
extends Object
Modifier and Type | Method and Description |
---|---|
static void |
applyForce(CombatEntityAPI entity,
float direction,
float force)
Apply force to an object.
|
static void |
applyForce(CombatEntityAPI entity,
Vector2f direction,
float force)
Apply force to an object.
|
static List<CombatEntityAPI> |
getAsteroidsWithinRange(Vector2f location,
float range)
Returns all asteroids in range of a given location.
|
static List<CombatEntityAPI> |
getAsteroidsWithinRange(Vector2f location,
float range,
boolean sortByDistance)
Deprecated.
Use the normal version of this method and call
Collections.sort(List, Comparator) using a
CollectionUtils.SortEntitiesByDistance as the Comparator . |
static CombatEngineAPI |
getCombatEngine()
Deprecated.
Use
Global.getCombatEngine() instead. |
static float |
getElapsedCombatTime()
Deprecated.
Use
CombatEngineAPI.getTotalElapsedTime(boolean)
instead. |
static float |
getElapsedCombatTimeIncludingPaused()
Deprecated.
Use
CombatEngineAPI.getTotalElapsedTime(boolean)
instead. |
static List<CombatEntityAPI> |
getEntitiesWithinRange(Vector2f location,
float range)
Returns all entities in range of a given location.
|
static List<CombatEntityAPI> |
getEntitiesWithinRange(Vector2f location,
float range,
boolean sortByDistance)
Deprecated.
Use the normal version of this method and call
Collections.sort(List, Comparator) using a
CollectionUtils.SortEntitiesByDistance as the Comparator . |
static FleetMemberAPI |
getFleetMember(ShipAPI ship)
Find a
ShipAPI 's corresponding FleetMemberAPI . |
static List<MissileAPI> |
getMissilesWithinRange(Vector2f location,
float range)
Returns all missiles in range of a given location.
|
static List<MissileAPI> |
getMissilesWithinRange(Vector2f location,
float range,
boolean sortByDistance)
Deprecated.
Use the normal version of this method and call
Collections.sort(List, Comparator) using a
CollectionUtils.SortEntitiesByDistance as the Comparator . |
static List<BattleObjectiveAPI> |
getObjectivesWithinRange(Vector2f location,
float range)
Returns all objectives in range of a given location.
|
static List<BattleObjectiveAPI> |
getObjectivesWithinRange(Vector2f location,
float range,
boolean sortByDistance)
Deprecated.
Use the normal version of this method and call
Collections.sort(List, Comparator) using a
CollectionUtils.SortEntitiesByDistance as the Comparator . |
static List<DamagingProjectileAPI> |
getProjectilesWithinRange(Vector2f location,
float range)
Returns all projectiles in range of a given location, excluding missiles.
|
static List<DamagingProjectileAPI> |
getProjectilesWithinRange(Vector2f location,
float range,
boolean sortByDistance)
Deprecated.
Use the normal version of this method and call
Collections.sort(List, Comparator) using a
CollectionUtils.SortEntitiesByDistance as the Comparator . |
static List<ShipAPI> |
getShipsWithinRange(Vector2f location,
float range)
Returns all ships in range of a given location.
|
static List<ShipAPI> |
getShipsWithinRange(Vector2f location,
float range,
boolean sortByDistance)
Deprecated.
Use the normal version of this method and call
Collections.sort(List, Comparator) using a
CollectionUtils.SortEntitiesByDistance as the Comparator . |
static float |
getTimeSinceLastFrame()
Deprecated.
Use
CombatEngineAPI.getElapsedInLastFrame() instead. |
static boolean |
isVisibleToSide(CombatEntityAPI entity,
int side)
Checks if a
CombatEntityAPI is visible to a side of battle. |
public static FleetMemberAPI getFleetMember(ShipAPI ship)
ShipAPI
's corresponding FleetMemberAPI
.ship
- The ShipAPI
whose corresponding
FleetMemberAPI
we are trying to find.
FleetMemberAPI
that represents this ShipAPI
in the campaign, or null
if no match is found.
public static boolean isVisibleToSide(CombatEntityAPI entity, int side)
CombatEntityAPI
is visible to a side of battle.
Note1: Allied and neutral entities are always visible.
Note2: All AIUtils
methods already filter by visibility, so use
of this method is not necessary on their results.entity
- The CombatEntityAPI
to check visibility of.side
- The side whose fog of war will be tested.
true
if entity
is visible to side
,
false
otherwise.
public static List<DamagingProjectileAPI> getProjectilesWithinRange(Vector2f location, float range)
location
- The location to search around.range
- How far around location
to search.
List
of DamagingProjectileAPI
s within range of
location
.
public static List<MissileAPI> getMissilesWithinRange(Vector2f location, float range)
location
- The location to search around.range
- How far around location
to search.
List
of MissileAPI
s within range of
location
.
public static List<ShipAPI> getShipsWithinRange(Vector2f location, float range)
location
- The location to search around.range
- How far around location
to search.
List
of ShipAPI
s within range of
location
.
public static List<CombatEntityAPI> getAsteroidsWithinRange(Vector2f location, float range)
location
- The location to search around.range
- How far around location
to search.
List
of asteroids within range of location
.
public static List<BattleObjectiveAPI> getObjectivesWithinRange(Vector2f location, float range)
location
- The location to search around.range
- How far around location
to search.
List
of BattleObjectiveAPI
s within range of
location
.
public static List<CombatEntityAPI> getEntitiesWithinRange(Vector2f location, float range)
location
- The location to search around.range
- How far around location
to search.
List
of CombatEntityAPI
s within range of
location
.
public static void applyForce(CombatEntityAPI entity, Vector2f direction, float force)
entity
- The CombatEntityAPI
to apply the force to.direction
- The directional vector of the force (this will
automatically be normalized).force
- How much force to apply. Unit is how much it takes
to modify a 100 weight object's velocity by 1 su/sec.
public static void applyForce(CombatEntityAPI entity, float direction, float force)
entity
- The CombatEntityAPI
to apply the force to.direction
- The angle the force will be applied towards.force
- How much force to apply. Unit is how much it takes
to modify a 100 weight object's velocity by 1 su/sec.
@Deprecated public static List<DamagingProjectileAPI> getProjectilesWithinRange(Vector2f location, float range, boolean sortByDistance)
Collections.sort(List, Comparator)
using a
CollectionUtils.SortEntitiesByDistance
as the Comparator
.@Deprecated public static List<MissileAPI> getMissilesWithinRange(Vector2f location, float range, boolean sortByDistance)
Collections.sort(List, Comparator)
using a
CollectionUtils.SortEntitiesByDistance
as the Comparator
.@Deprecated public static List<ShipAPI> getShipsWithinRange(Vector2f location, float range, boolean sortByDistance)
Collections.sort(List, Comparator)
using a
CollectionUtils.SortEntitiesByDistance
as the Comparator
.@Deprecated public static List<CombatEntityAPI> getAsteroidsWithinRange(Vector2f location, float range, boolean sortByDistance)
Collections.sort(List, Comparator)
using a
CollectionUtils.SortEntitiesByDistance
as the Comparator
.@Deprecated public static List<BattleObjectiveAPI> getObjectivesWithinRange(Vector2f location, float range, boolean sortByDistance)
Collections.sort(List, Comparator)
using a
CollectionUtils.SortEntitiesByDistance
as the Comparator
.@Deprecated public static List<CombatEntityAPI> getEntitiesWithinRange(Vector2f location, float range, boolean sortByDistance)
Collections.sort(List, Comparator)
using a
CollectionUtils.SortEntitiesByDistance
as the Comparator
.@Deprecated public static CombatEngineAPI getCombatEngine()
Global.getCombatEngine()
instead.@Deprecated public static float getElapsedCombatTimeIncludingPaused()
CombatEngineAPI.getTotalElapsedTime(boolean)
instead.@Deprecated public static float getElapsedCombatTime()
CombatEngineAPI.getTotalElapsedTime(boolean)
instead.@Deprecated public static float getTimeSinceLastFrame()
CombatEngineAPI.getElapsedInLastFrame()
instead.