Interface CombatEngineAPI


public interface CombatEngineAPI
Author:
Alex Mosolov Copyright 2012 Fractal Softworks, LLC
  • Method Details

    • isInCampaign

      boolean isInCampaign()
      Returns:
      true if this battle is inside the campaign, false otherwise (i.e., mission or simulation, including in-campaign simulations).
    • isInCampaignSim

      boolean isInCampaignSim()
    • getCombatUI

      CombatUIAPI getCombatUI()
    • setHyperspaceMode

      void setHyperspaceMode()
    • getAllObjectives

      @Deprecated List<BattleObjectiveAPI> getAllObjectives()
      Deprecated.
      Use getObjectives() instead.
    • getAllShips

      @Deprecated List<ShipAPI> getAllShips()
      Deprecated.
      Use getShips() instead.
    • getObjectives

      List<BattleObjectiveAPI> getObjectives()
    • getShips

      List<ShipAPI> getShips()
    • getMissiles

      List<MissileAPI> getMissiles()
    • getAsteroids

      List<CombatEntityAPI> getAsteroids()
    • getBeams

      List<BeamAPI> getBeams()
    • getProjectiles

      List<DamagingProjectileAPI> getProjectiles()
      Includes missiles.
    • isEntityInPlay

      boolean isEntityInPlay(CombatEntityAPI entity)
    • getFogOfWar

      FogOfWarAPI getFogOfWar(int owner)
    • removeEntity

      void removeEntity(CombatEntityAPI entity)
    • getFleetManager

      CombatFleetManagerAPI getFleetManager(FleetSide side)
    • getFleetManager

      CombatFleetManagerAPI getFleetManager(int owner)
    • getPlayerShip

      ShipAPI getPlayerShip()
    • isPaused

      boolean isPaused()
    • endCombat

      void endCombat(float delay)
    • setDoNotEndCombat

      void setDoNotEndCombat(boolean doNotEndCombat)
    • endCombat

      void endCombat(float delay, FleetSide winner)
    • getViewport

      ViewportAPI getViewport()
    • applyDamage

      void applyDamage(CombatEntityAPI entity, org.lwjgl.util.vector.Vector2f point, float damageAmount, DamageType damageType, float empAmount, boolean bypassShields, boolean dealsSoftFlux, Object source, boolean playSound)
      Parameters:
      entity -
      point - Location the damage is dealt at, in absolute engine coordinates (i.e. *not* relative to the ship). MUST fall within the sprite of a ship, given its current location and facing, for armor to properly be taken into account.
      damageAmount -
      damageType -
      empAmount -
      bypassShields - Whether shields are ignored completely.
      dealsSoftFlux - Whether damage dealt to shields results in soft flux.
      source - Should be a ShipAPI if the damage ultimately attributed to it. Can also be null.
      playSound - Whether a sound based on the damage dealt should be played.
    • applyDamage

      void applyDamage(CombatEntityAPI entity, org.lwjgl.util.vector.Vector2f point, float damageAmount, DamageType damageType, float empAmount, boolean bypassShields, boolean dealsSoftFlux, Object source)
    • applyDamage

      void applyDamage(Object damageModifierParam, CombatEntityAPI entity, org.lwjgl.util.vector.Vector2f point, float damageAmount, DamageType damageType, float empAmount, boolean bypassShields, boolean dealsSoftFlux, Object source, boolean playSound)
    • addHitParticle

      void addHitParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, float duration, Color color)
      Particle with a somewhat brighter middle.
      Parameters:
      brightness - from 0 to 1
      duration - in seconds
    • addSmoothParticle

      void addSmoothParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, float duration, Color color)
      Standard glowy particle.
      Parameters:
      brightness - from 0 to 1
      duration - in seconds
    • addSmokeParticle

      void addSmokeParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float opacity, float duration, Color color)
      Opaque smoke particle.
      Parameters:
      brightness - from 0 to 1
      duration - in seconds
    • spawnExplosion

      void spawnExplosion(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, Color color, float size, float maxDuration)
      Purely visual.
    • spawnAsteroid

      CombatEntityAPI spawnAsteroid(int size, float x, float y, float dx, float dy)
      Parameters:
      size - 0, 1, 2, or 3, with 3 being the largest.
      x - location x
      y - location y
      dx - velocity x
      dy - velocity y
      Returns:
    • addFloatingText

      void addFloatingText(org.lwjgl.util.vector.Vector2f loc, String text, float size, Color color, CombatEntityAPI attachedTo, float flashFrequency, float flashDuration)
    • addFloatingDamageText

      void addFloatingDamageText(org.lwjgl.util.vector.Vector2f loc, float damage, Color color, CombatEntityAPI attachedTo, CombatEntityAPI damageSource)
    • spawnProjectile

      CombatEntityAPI spawnProjectile(ShipAPI ship, WeaponAPI weapon, String weaponId, org.lwjgl.util.vector.Vector2f point, float angle, org.lwjgl.util.vector.Vector2f shipVelocity)
      Parameters:
      ship - The ship launching this projectile. Can be null.
      weapon - Firing weapon. Can be null. If not, used for figuring out range/damage bonuses, etc.
      weaponId - ID of the weapon whose projectile to use. Required.
      point - Location where the projectile will spawn. Required.
      angle - Initial facing, in degrees (0 = 3 o'clock, 90 = 12 o'clock).
      shipVelocity - Can be null. Otherwise, will be imparted to projectile.
      Returns:
      Projectile that was created, or null.
    • spawnEmpArc

      EmpArcEntityAPI spawnEmpArc(ShipAPI damageSource, org.lwjgl.util.vector.Vector2f point, CombatEntityAPI pointAnchor, CombatEntityAPI empTargetEntity, DamageType damageType, float damAmount, float empDamAmount, float maxRange, String impactSoundId, float thickness, Color fringe, Color core)
      Parameters:
      damageSource - Ship that's ultimately responsible for dealing the damage of this EMP arc. Can be null.
      point - starting point of the EMP arc, in absolute engine coordinates.
      pointAnchor - The entity the starting point should move together with, if any.
      empTargetEntity - Target of the EMP arc. If it's a ship, it will randomly pick an engine nozzle/weapon to arc to. Can also pass in a custom class implementing CombatEntityAPI to visually target the EMP at a specific location (and not do any damage).
      damageType -
      damAmount -
      empDamAmount -
      maxRange - Maximum range the arc can reach (useful for confining EMP arc targets to the area near point)
      impactSoundId - Can be null.
      thickness - Thickness of the arc (visual).
      fringe -
      core -
      Returns:
    • spawnEmpArc

      EmpArcEntityAPI spawnEmpArc(ShipAPI damageSource, org.lwjgl.util.vector.Vector2f point, CombatEntityAPI pointAnchor, CombatEntityAPI empTargetEntity, DamageType damageType, float damAmount, float empDamAmount, float maxRange, String impactSoundId, float thickness, Color fringe, Color core, EmpArcEntityAPI.EmpArcParams params)
    • spawnEmpArcPierceShields

      EmpArcEntityAPI spawnEmpArcPierceShields(ShipAPI damageSource, org.lwjgl.util.vector.Vector2f point, CombatEntityAPI pointAnchor, CombatEntityAPI empTargetEntity, DamageType damageType, float damAmount, float empDamAmount, float maxRange, String impactSoundId, float thickness, Color fringe, Color core)
      Same as spawnEmpArc, but goes through shields if they're blocking the line from the point to the chosen target.
    • spawnEmpArcPierceShields

      EmpArcEntityAPI spawnEmpArcPierceShields(ShipAPI damageSource, org.lwjgl.util.vector.Vector2f point, CombatEntityAPI pointAnchor, CombatEntityAPI empTargetEntity, DamageType damageType, float damAmount, float empDamAmount, float maxRange, String impactSoundId, float thickness, Color fringe, Color core, EmpArcEntityAPI.EmpArcParams params)
    • getMapWidth

      float getMapWidth()
    • getMapHeight

      float getMapHeight()
    • getContext

      BattleCreationContext getContext()
      BattleCreationContext used to initialize this battle.
      Returns:
    • getTotalElapsedTime

      float getTotalElapsedTime(boolean includePaused)
    • getElapsedInLastFrame

      float getElapsedInLastFrame()
      Does *not* return 0 if the game is paused; actually the *current* frame.
      Returns:
    • addPlugin

      void addPlugin(EveryFrameCombatPlugin plugin)
      Plugin has its init method called inside this method.
      Parameters:
      plugin -
    • removePlugin

      void removePlugin(EveryFrameCombatPlugin plugin)
    • isSimulation

      boolean isSimulation()
    • isMission

      boolean isMission()
    • getMissionId

      String getMissionId()
    • setPlayerShipExternal

      void setPlayerShipExternal(ShipAPI ship)
    • isUIShowingDialog

      boolean isUIShowingDialog()
    • isUIShowingHUD

      boolean isUIShowingHUD()
    • isUIAutopilotOn

      boolean isUIAutopilotOn()
    • getElapsedInContactWithEnemy

      float getElapsedInContactWithEnemy()
      Time elapsed while both sides can see at least one enemy ship.
      Returns:
    • isFleetsInContact

      boolean isFleetsInContact()
    • setSideDeploymentOverrideSide

      void setSideDeploymentOverrideSide(FleetSide sideDeploymentOverrideSide)
    • getCustomData

      Map<String,Object> getCustomData()
    • maintainStatusForPlayerShip

      void maintainStatusForPlayerShip(Object key, String spriteName, String title, String data, boolean isDebuff)
      In the status list above the left side of the ship info widget in the bottom left.
      Parameters:
      key -
      spriteName -
      title -
      data -
      isDebuff -
    • setPaused

      void setPaused(boolean paused)
    • playerHasNonAllyReserves

      boolean playerHasNonAllyReserves()
    • playerHasAllyReserves

      boolean playerHasAllyReserves()
    • getDamageData

      CombatDamageData getDamageData()
    • getTimeMult

      MutableStat getTimeMult()
    • setMaxFleetPoints

      void setMaxFleetPoints(FleetSide side, int fleetPoints)
    • getNebula

      CombatNebulaAPI getNebula()
    • isInFastTimeAdvance

      boolean isInFastTimeAdvance()
    • spawnProjectile

      CombatEntityAPI spawnProjectile(ShipAPI ship, WeaponAPI weapon, String weaponId, String projSpecId, org.lwjgl.util.vector.Vector2f point, float angle, org.lwjgl.util.vector.Vector2f shipVelocity)
      Should work now.
    • updateStationModuleLocations

      void updateStationModuleLocations(ShipAPI station)
    • getAllObjectGrid

      CollisionGridAPI getAllObjectGrid()
      All combat entities.
      Returns:
    • getShipGrid

      CollisionGridAPI getShipGrid()
      Ships only.
      Returns:
    • getMissileGrid

      CollisionGridAPI getMissileGrid()
      Missiles only.
      Returns:
    • getAsteroidGrid

      CollisionGridAPI getAsteroidGrid()
      Asteroids only.
      Returns:
    • spawnDamagingExplosion

      DamagingProjectileAPI spawnDamagingExplosion(DamagingExplosionSpec spec, ShipAPI source, org.lwjgl.util.vector.Vector2f location)
    • spawnDamagingExplosion

      DamagingProjectileAPI spawnDamagingExplosion(DamagingExplosionSpec spec, ShipAPI source, org.lwjgl.util.vector.Vector2f location, boolean canDamageSource)
    • getWinningSideId

      int getWinningSideId()
      0 = player, 1 = enemy, 2 = player allies, no player ships left.
      Returns:
    • isCombatOver

      boolean isCombatOver()
    • removeObject

      void removeObject(Object object)
    • addLayeredRenderingPlugin

      CombatEntityAPI addLayeredRenderingPlugin(CombatLayeredRenderingPlugin plugin)
    • isEnemyInFullRetreat

      boolean isEnemyInFullRetreat()
    • isMissileAlive

      boolean isMissileAlive(MissileAPI missile)
    • spawnMuzzleFlashOrSmoke

      void spawnMuzzleFlashOrSmoke(ShipAPI ship, WeaponSlotAPI slot, WeaponSpecAPI spec, int barrel, float targetAngle)
    • getAiGridMissiles

      CollisionGridAPI getAiGridMissiles()
    • getAiGridShips

      CollisionGridAPI getAiGridShips()
    • getAiGridAsteroids

      CollisionGridAPI getAiGridAsteroids()
    • isAwareOf

      boolean isAwareOf(int owner, CombatEntityAPI other)
      Visible (i.e. not under fog) or recently seen.
      Parameters:
      owner -
      other -
      Returns:
    • headInDirectionWithoutTurning

      void headInDirectionWithoutTurning(MissileAPI missile, float desiredHeading, float desiredSpeed)
      Gives strafe left/right and accelerate forward/backward/decelerate commands to accomplish this.
      Parameters:
      missile -
      desiredHeading -
      desiredSpeed -
    • headInDirectionWithoutTurning

      void headInDirectionWithoutTurning(ShipAPI ship, float desiredHeading, float desiredSpeed)
      Gives strafe left/right and accelerate forward/backward/decelerate commands to accomplish this.
      Parameters:
      ship -
      desiredHeading -
      desiredSpeed -
    • getAimPointWithLeadForAutofire

      org.lwjgl.util.vector.Vector2f getAimPointWithLeadForAutofire(CombatEntityAPI from, float accuracyFactor, CombatEntityAPI to, float projSpeed)
      accuracyFactor: 1 = best accuracy, >1 (up to around 2 at most normally) poor accuracy, <1 = leading target too much, not used.
      Parameters:
      from -
      accuracyFactor -
      to -
      projSpeed -
      Returns:
    • getListenerManager

      CombatListenerManagerAPI getListenerManager()
    • applyDamageModifiersToSpawnedProjectileWithNullWeapon

      void applyDamageModifiersToSpawnedProjectileWithNullWeapon(ShipAPI source, WeaponAPI.WeaponType type, boolean isBeam, DamageAPI damage)
    • addHitParticle

      void addHitParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, float durationIn, float totalDuration, Color color)
    • addHitParticle

      void addHitParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, Color color)
      Duration gets auto-computed.
      Parameters:
      loc -
      vel -
      size -
      brightness -
      color -
    • spawnEmpArcVisual

      EmpArcEntityAPI spawnEmpArcVisual(org.lwjgl.util.vector.Vector2f from, CombatEntityAPI fromAnchor, org.lwjgl.util.vector.Vector2f to, CombatEntityAPI toAnchor, float thickness, Color fringe, Color core)
    • spawnEmpArcVisual

      EmpArcEntityAPI spawnEmpArcVisual(org.lwjgl.util.vector.Vector2f from, CombatEntityAPI fromAnchor, org.lwjgl.util.vector.Vector2f to, CombatEntityAPI toAnchor, float thickness, Color fringe, Color core, EmpArcEntityAPI.EmpArcParams params)
    • addSmoothParticle

      void addSmoothParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float brightness, float rampUpFraction, float totalDuration, Color color)
    • addNegativeParticle

      void addNegativeParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float rampUpFraction, float totalDuration, Color color)
    • addNebulaParticle

      void addNebulaParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float endSizeMult, float rampUpFraction, float fullBrightnessFraction, float totalDuration, Color color)
    • addNegativeNebulaParticle

      void addNegativeNebulaParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float endSizeMult, float rampUpFraction, float fullBrightnessFraction, float totalDuration, Color color)
    • addNebulaSmokeParticle

      void addNebulaSmokeParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float endSizeMult, float rampUpFraction, float fullBrightnessFraction, float totalDuration, Color color)
    • hasAttachedFloaty

      boolean hasAttachedFloaty(CombatEntityAPI entity)
    • addNebulaParticle

      void addNebulaParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float endSizeMult, float rampUpFraction, float fullBrightnessFraction, float totalDuration, Color color, boolean expandAsSqrt)
    • addSwirlyNebulaParticle

      void addSwirlyNebulaParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float endSizeMult, float rampUpFraction, float fullBrightnessFraction, float totalDuration, Color color, boolean expandAsSqrt)
    • addNegativeSwirlyNebulaParticle

      void addNegativeSwirlyNebulaParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float endSizeMult, float rampUpFraction, float fullBrightnessFraction, float totalDuration, Color color)
    • isInPlay

      boolean isInPlay(Object object)
    • setCombatNotOverForAtLeast

      void setCombatNotOverForAtLeast(float seconds)
    • setCombatNotOverFor

      void setCombatNotOverFor(float seconds)
    • getCombatNotOverFor

      float getCombatNotOverFor()
    • setCustomExit

      void setCustomExit(String buttonTitle, String confirmString)
    • getCustomExitButtonTitle

      String getCustomExitButtonTitle()
    • getCustomExitButtonConfirmString

      String getCustomExitButtonConfirmString()
    • addFloatingTextAlways

      void addFloatingTextAlways(org.lwjgl.util.vector.Vector2f loc, String text, float size, Color color, CombatEntityAPI attachedTo, float flashFrequency, float flashDuration, float durInPlace, float durFloatingUp, float durFadingOut, float baseAlpha)
    • createFakeWeapon

      WeaponAPI createFakeWeapon(ShipAPI ship, String weaponId)
    • getShipPlayerIsTransferringCommandFrom

      ShipAPI getShipPlayerIsTransferringCommandFrom()
    • getShipPlayerIsTransferringCommandTo

      ShipAPI getShipPlayerIsTransferringCommandTo()
    • getShipPlayerLastTransferredCommandTo

      ShipAPI getShipPlayerLastTransferredCommandTo()
    • createFXDrone

      ShipAPI createFXDrone(ShipVariantAPI variant)
    • addEntity

      void addEntity(CombatEntityAPI entity)
    • addNebulaSmoothParticle

      void addNebulaSmoothParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float endSizeMult, float rampUpFraction, float fullBrightnessFraction, float totalDuration, Color color)
    • addNebulaSmoothParticle

      void addNebulaSmoothParticle(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, float size, float endSizeMult, float rampUpFraction, float fullBrightnessFraction, float totalDuration, Color color, boolean expandAsSqrt)
    • getBackgroundColor

      Color getBackgroundColor()
    • setBackgroundColor

      void setBackgroundColor(Color backgroundColor)
    • isBackgroundGlowColorNonAdditive

      boolean isBackgroundGlowColorNonAdditive()
    • setBackgroundGlowColorNonAdditive

      void setBackgroundGlowColorNonAdditive(boolean backgroundGlowColorNonAdditive)
    • setBackgroundGlowColor

      void setBackgroundGlowColor(Color backgroundGlowColor)
    • getBackgroundGlowColor

      Color getBackgroundGlowColor()
    • isRenderStarfield

      boolean isRenderStarfield()
    • setRenderStarfield

      void setRenderStarfield(boolean renderStarfield)
    • setShipPlayerLastTransferredCommandTo

      void setShipPlayerLastTransferredCommandTo(ShipAPI ship)
    • spawnMuzzleFlashOrSmoke

      void spawnMuzzleFlashOrSmoke(ShipAPI ship, org.lwjgl.util.vector.Vector2f point, WeaponSpecAPI spec, float targetAngle)
    • isInMissionSim

      boolean isInMissionSim()
    • isShipAlive

      boolean isShipAlive(ShipAPI ship)
    • spawnDebrisSmall

      void spawnDebrisSmall(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, int num, float facing, float spread, float minVel, float velRange, float maxRotation)
    • spawnDebrisMedium

      void spawnDebrisMedium(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, int num, float facing, float spread, float minVel, float velRange, float maxRotation)
    • spawnDebrisLarge

      void spawnDebrisLarge(org.lwjgl.util.vector.Vector2f loc, org.lwjgl.util.vector.Vector2f vel, int num, float facing, float spread, float minVel, float velRange, float maxRotation)
    • addFloatingDamageText

      void addFloatingDamageText(org.lwjgl.util.vector.Vector2f loc, float damage, float spread, Color color, CombatEntityAPI to, CombatEntityAPI source)
    • createProximityFuseAI

      MissileAIPlugin createProximityFuseAI(MissileAPI missile)
    • getBackgroundSpriteName

      String getBackgroundSpriteName()
    • isInEngine

      boolean isInEngine(ShipAPI ship)
    • hasPluginOfClass

      boolean hasPluginOfClass(Class c)
    • applyImpact

      void applyImpact(org.lwjgl.util.vector.Vector2f vel, float impact, CombatEntityAPI target, org.lwjgl.util.vector.Vector2f point)
    • playShipExplosionSound

      void playShipExplosionSound(ShipAPI ship)
    • spawnAsteroid

      CombatEntityAPI spawnAsteroid(String spriteName, float x, float y, float dx, float dy, boolean fromRing)