# Avorion Script API Documentation

Home Functions Search
Search:

CargoBay CargoBay
Properties
alwaysStoreAtLeastOne
cargoHold
cargoVolume
empty
entity
a
fixedSize
freeSpace
numCargos
pickUpDangerous
pickUpDefaults
pickUpIllegal
pickUpOres
pickUpScrap
pickUpStolen
Member Functions
add
addCargo
clear
destroyCargo
findCargos
getCargo
getCargos
getNumCargos
getSummary
removeCargo

# CargoBay

This represents an interface to an entity in the scene. Creating an object of this type will not create a new entity in the scene, but will rather enable access to an existing entity. Use the Sector class to create new entities.
Avorion uses an entity component system (See entity component system on Wikipedia). Thus, some properties and functions are only available if the entity has the corresponding component. The list of components can be found here: Enum ComponentType
Note: The id property of an Entity can be changed, but won't change the actual id of the underlying entity. Instead, the entity interface will be pointing to another entity with the new id. Use this for performance tuning to avoid creating lots of entity interfaces.
Note 2: This class is considered to have too many members and functions. Over time these will be phased out into their respective component classes. Only a few frequently used properties and functions will remain for coding comfort.

function CargoBay(string name, string plural, string description, string icon, float price, float size)

Parameters

id The id of the entity this component belongs to, or the entity itself, must be an id of an existing entity or nil for the entity in the current script context

Returns

A new instance of CargoBay

property bool alwaysStoreAtLeastOne |

property float cargoHold |

property float cargoVolume | [read-only]

property bool empty | [read-only]

property Entity entity | [read-only]

property uuid entityId | [read-only]

property bool fixedSize |

property float freeSpace | [read-only]

property int numCargos | [read-only]

property bool pickUpDangerous |

property bool pickUpDefaults |

property bool pickUpIllegal |

property bool pickUpOres |

property bool pickUpScrap |

property bool pickUpStolen |

property float accuracy | [read-only]

property bool ancient |

property bool armed | [read-only]

property int averageTech | [read-only]

property float baseEnergyPerSecond |

property float bestEfficiency | [read-only]

property bool blackMarketDLCOnly | [read-only]

property WeaponCategory category | [read-only]

property bool civil | [read-only]

property bool coaxial |

property bool continuousBeam | [read-only]

property float coolingRate |

property float coolingTime | [read-only]

property int coolingType |

property Crew crew |

property float damage | [read-only]

property int damageType | [read-only]

property bool deathExplosion | [read-only]

property float dps | [read-only]

property float energyIncreasePerSecond |

property bool favorite |

property float fireRate | [read-only]

property bool firing |

property float firingsPerSecond | [read-only]

property var flavorText |

property float heat | [read-only]

property float heatPerShot |

property float holdingForce | [read-only]

property float hullDamageMultiplicator | [read-only]

property float hullDamageMultiplier | [read-only]

property float hullRepairRate | [read-only]

property bool intoTheRiftDLCOnly | [read-only]

property int itemType | [read-only]

property Material material | [read-only]

property float maxHeat |

property int maxTech | [read-only]

property float metalBestEfficiency | [read-only]

property float metalRawEfficiency | [read-only]

property float metalRefinedEfficiency | [read-only]

property bool missionRelevant |

property var name | [read-only]

property int numVisibleWeapons | [read-only]

property int numWeapons | [read-only]

property float otherForce | [read-only]

property bool overheated | [read-only]

property Rarity rarity | [read-only]

property float reach | [read-only]

property bool recent |

property double requiredShootingEnergy | [read-only]

property bool seeker | [read-only]

property float selfForce | [read-only]

property float shieldDamageMultiplicator | [read-only]

property float shieldDamageMultiplier | [read-only]

property float shieldPenetration | [read-only]

property float shieldRepairRate | [read-only]

property float shootingTime | [read-only]

property float shotSpeed | [read-only]

property int shotsPerFiring | [read-only]

property float shotsPerSecond | [read-only]

property int shotsUntilOverheated | [read-only]

property bool simultaneousShooting |

property float size |

property int slots |

property TurretSlotType slotType |

property bool stackable | [read-only]

property float stoneBestEfficiency | [read-only]

property float stoneDamageMultiplicator | [read-only]

property float stoneDamageMultiplier | [read-only]

property float stoneRawEfficiency | [read-only]

property float stoneRefinedEfficiency | [read-only]

property var title |

property bool trash |

property float turningSpeed |

property string weaponIcon | [read-only]

property string weaponName | [read-only]

property string weaponPrefix | [read-only]

property bool includeCrew |

property bool includeEnergy |

property bool includeUpgrades |

property bool aiOwned | [read-only]

property bool allianceOwned | [read-only]

property bool canPassRifts | [read-only]

property int controlActions |

property Crew crew |

property var crewSize | [read-only]

property float damageMultiplier |

property float desiredVelocity |

property bool dockable |

property Uuid dockingParent | [read-only]

property double durability |

property int excludedPlayer |

property int exclusionTime |

property int factionIndex |

property bool fighterCargoPickup | [read-only]

property double firePower | [read-only]

property var freeCargoSpace | [read-only]

property bool hasPilot | [read-only]

property float hyperspaceCooldown |

property float hyperspaceJumpReach |

property Uuid id | [read-only]

property Crew idealCrew | [read-only]

property Uuid index | [read-only]

property bool invincible |

property bool isAnomaly | [read-only]

property var isArmedTurret | [read-only]

property bool isAsteroid | [read-only]

property bool isContainer | [read-only]

property bool isDrone | [read-only]

property bool isFighter | [read-only]

property bool isFlyable | [read-only]

property bool isLoot | [read-only]

property bool isObviouslyMineable |

property bool isOther | [read-only]

property var isShieldActive | [read-only]

property bool isShip | [read-only]

property bool isStation | [read-only]

property var isTurning | [read-only]

property bool isTurret | [read-only]

property var isUnarmedTurret | [read-only]

property bool isUnknown | [read-only]

property bool isWormHole | [read-only]

property bool isWreckage | [read-only]

property vec3 look | [read-only]

property var mass | [read-only]

property var maxCargoSpace | [read-only]

property var maxCrewSize | [read-only]

property var maxDurability | [read-only]

property Crew minCrew | [read-only]

property Entity mothership |

property string name |

property int numCargos | [read-only]

property int numDefenseWeapons | [read-only]

property int numDefenseWeaponsCurrentAttack | [read-only]

property var numDockingPositions | [read-only]

property var numTurrets | [read-only]

property var occupiedCargoSpace | [read-only]

property Matrix orientation |

property bool playerOrAllianceOwned | [read-only]

property bool playerOwned | [read-only]

property Matrix position |

property var radius | [read-only]

property float reservationTime |

property int reservedPlayer |

property vec3 right | [read-only]

property var selectedObject |

property double shieldDurability |

property double shieldMaxDurability |

property float shieldMeshIntensity | [read-only]

property vec3 size | [read-only]

property var timeAlive | [read-only]

property string title |

property var translatedTitle | [read-only]

property dvec3 translation |

property vec3 translationf | [read-only]

property double transporterRange | [read-only]

property int type |

property string typename | [read-only]

property vec3 up | [read-only]

property var volume | [read-only]

property bool aiOwned | [read-only]

property bool allianceOwned | [read-only]

property bool canPassRifts | [read-only]

property int controlActions |

property Crew crew |

property var crewSize | [read-only]

property float damageMultiplier |

property float desiredVelocity |

property bool dockable |

property Uuid dockingParent | [read-only]

property double durability |

property int excludedPlayer |

property int exclusionTime |

property int factionIndex |

property bool fighterCargoPickup | [read-only]

property double firePower | [read-only]

property var freeCargoSpace | [read-only]

property bool hasPilot | [read-only]

property float hyperspaceCooldown |

property float hyperspaceJumpReach |

property Uuid id | [read-only]

property Crew idealCrew | [read-only]

property Uuid index | [read-only]

property bool invincible |

property bool isAnomaly | [read-only]

property var isArmedTurret | [read-only]

property bool isAsteroid | [read-only]

property bool isContainer | [read-only]

property bool isDrone | [read-only]

property bool isFighter | [read-only]

property bool isFlyable | [read-only]

property bool isLoot | [read-only]

property bool isObviouslyMineable |

property bool isOther | [read-only]

property var isShieldActive | [read-only]

property bool isShip | [read-only]

property bool isStation | [read-only]

property var isTurning | [read-only]

property bool isTurret | [read-only]

property var isUnarmedTurret | [read-only]

property bool isUnknown | [read-only]

property bool isWormHole | [read-only]

property bool isWreckage | [read-only]

property vec3 look | [read-only]

property var mass | [read-only]

property var maxCargoSpace | [read-only]

property var maxCrewSize | [read-only]

property var maxDurability | [read-only]

property Crew minCrew | [read-only]

property Entity mothership |

property string name |

property int numCargos | [read-only]

property int numDefenseWeapons | [read-only]

property int numDefenseWeaponsCurrentAttack | [read-only]

property var numDockingPositions | [read-only]

property var numTurrets | [read-only]

property var occupiedCargoSpace | [read-only]

property Matrix orientation |

property bool playerOrAllianceOwned | [read-only]

property bool playerOwned | [read-only]

property Matrix position |

property var radius | [read-only]

property float reservationTime |

property int reservedPlayer |

property vec3 right | [read-only]

property var selectedObject |

property double shieldDurability |

property double shieldMaxDurability |

property float shieldMeshIntensity | [read-only]

property vec3 size | [read-only]

property var timeAlive | [read-only]

property string title |

property var translatedTitle | [read-only]

property dvec3 translation |

property vec3 translationf | [read-only]

property double transporterRange | [read-only]

property int type |

property string typename | [read-only]

property vec3 up | [read-only]

property var volume | [read-only]

property bool blocked | [read-only]

True if the hyperspace engine is being blocked.

property bool clearSpace | [read-only]

Sets the hyperspace engine to "clear space", which speeds up the cooldown to avoid annoying wait times in empty sectors. This value is overridden if the engine is or gets blocked or distorted.

property string consumerIcon | [read-only]

Energy consumer icon of the engine as shown in the energy tab.

property string consumerName | [read-only]

Energy consumer name of the engine as shown in the energy tab.

property float cooldown | [read-only]

Cooldown in seconds of the engine. Current cooldown is set to this on exhaustion of the hyperspace engine. When this value is changed, it will be overridden once the player builds, reloads or installs upgrades.

property float cooldownSpeed | [read-only]

Cooldown speed factor. Default is 1, can be 0.25 (distorted), 0 (blocked) or up to 3 (clear space). If hyperspace energy efficiency is below 1, this value is adjusted accordingly.

property float currentCooldown | [read-only]

Current cooldown in seconds of the engine. this is the number that ticks down over time.

property int defaultPriority | [read-only]

Energy consumer default priority of the engine as shown in the energy tab.

property bool displayedCooldown | [read-only]

Cooldown in seconds as it would be displayed to the player. This result varies, depending on distorts, clear space or blockage.

property bool distorted | [read-only]

True if the hyperspace engine is being distorted. This is the case when a ship is under attack or when distort() was called.

property Entity entity | [read-only]

property uuid entityId | [read-only]

property bool isSceneEmpty | [read-only]

Checks if the scene is considered "empty enough" to set "clear space" to true, and thus recharge the engine quicker. This is the case when there are only group, own faction or alliance member ships present

property bool passBlocked | [read-only]

Whether or not the hyperspace engine is capable of jumping over rifts. When this value is changed, it will be overridden once the player builds or installs upgrades.

property float range | [read-only]

Range in sectors of the engine. When this value is changed, it will be overridden once the player builds or installs upgrades.

property double requiredEnergy | [read-only]

Currently required energy of the engine as shown in the energy tab.

property float requiredEnergyForJump | [read-only]

Amount of energy in W required to do a hyperspace jump (or rather: recharge the engine)

property bool blocked | [read-only]

True if the hyperspace engine is being blocked.

property bool clearSpace |

Sets the hyperspace engine to "clear space", which speeds up the cooldown to avoid annoying wait times in empty sectors. This value is overridden if the engine is or gets blocked or distorted.

property string consumerIcon | [read-only]

Energy consumer icon of the engine as shown in the energy tab.

property string consumerName | [read-only]

Energy consumer name of the engine as shown in the energy tab.

property float cooldown |

Cooldown in seconds of the engine. Current cooldown is set to this on exhaustion of the hyperspace engine. When this value is changed, it will be overridden once the player builds, reloads or installs upgrades.

property float cooldownSpeed | [read-only]

Cooldown speed factor. Default is 1, can be 0.25 (distorted), 0 (blocked) or up to 3 (clear space). If hyperspace energy efficiency is below 1, this value is adjusted accordingly.

property float currentCooldown |

Current cooldown in seconds of the engine. this is the number that ticks down over time.

property int defaultPriority | [read-only]

Energy consumer default priority of the engine as shown in the energy tab.

property bool displayedCooldown | [read-only]

Cooldown in seconds as it would be displayed to the player. This result varies, depending on distorts, clear space or blockage.

property bool distorted | [read-only]

True if the hyperspace engine is being distorted. This is the case when a ship is under attack or when distort() was called.

property Entity entity | [read-only]

property uuid entityId | [read-only]

property bool isSceneEmpty | [read-only]

Checks if the scene is considered "empty enough" to set "clear space" to true, and thus recharge the engine quicker. This is the case when there are only group, own faction or alliance member ships present

property bool passBlocked |

Whether or not the hyperspace engine is capable of jumping over rifts. When this value is changed, it will be overridden once the player builds or installs upgrades.

property float range |

Range in sectors of the engine. When this value is changed, it will be overridden once the player builds or installs upgrades.

property double requiredEnergy | [read-only]

Currently required energy of the engine as shown in the energy tab.

property float requiredEnergyForJump | [read-only]

Amount of energy in W required to do a hyperspace jump (or rather: recharge the engine)

property bool alwaysStoreAtLeastOne | [read-only]

property float cargoHold | [read-only]

property float cargoVolume | [read-only]

property bool empty | [read-only]

property Entity entity | [read-only]

property uuid entityId | [read-only]

property bool fixedSize | [read-only]

property float freeSpace | [read-only]

property int numCargos | [read-only]

property bool pickUpDangerous | [read-only]

property bool pickUpDefaults | [read-only]

property bool pickUpIllegal | [read-only]

property bool pickUpOres | [read-only]

property bool pickUpScrap | [read-only]

property bool pickUpStolen | [read-only]

property bool autoPilotEnabled | [read-only]

property float desiredVelocity | [read-only]

The current velocity the ship is trying to fly from 0 to 1, where 0 means standstill and 1 means the maximum speed the ship can fly without boosting.

property Entity entity | [read-only]

property uuid a | [read-only]

property bool hasPilot | [read-only]

property bool isBoosting | [read-only]

property bool isDrifting | [read-only]

property bool isStrafing | [read-only]

property bool isTurning | [read-only]

property int numFreeSeats | [read-only]

property int numOccupiedSeats | [read-only]

property vec3 turningSpeedFactor | [read-only]

A vec3 containing the turning speed multipliers for axis x, y, z. The turning speed factor is a multiplier for the turning speed of a ship, and is set in flyToLocation(), to smoothen turning once the ship looks towards its target (to avoid jittering).

property bool alwaysStoreAtLeastOne |

property float cargoHold |

property float cargoVolume | [read-only]

property bool empty | [read-only]

property Entity entity | [read-only]

property uuid a | [read-only]

property bool fixedSize |

property float freeSpace | [read-only]

property int numCargos | [read-only]

property bool pickUpDangerous |

property bool pickUpDefaults |

property bool pickUpIllegal |

property bool pickUpOres |

property bool pickUpScrap |

property bool pickUpStolen |

property bool autoPilotEnabled |

property float desiredVelocity | [read-only]

The current velocity the ship is trying to fly from 0 to 1, where 0 means standstill and 1 means the maximum speed the ship can fly without boosting.

property Entity entity | [read-only]

property uuid a | [read-only]

property bool hasPilot | [read-only]

property bool isBoosting | [read-only]

property bool isDrifting | [read-only]

property bool isStrafing | [read-only]

property bool isTurning | [read-only]

property int numFreeSeats | [read-only]

property int numOccupiedSeats | [read-only]

property vec3 turningSpeedFactor | [read-only]

A vec3 containing the turning speed multipliers for axis x, y, z. The turning speed factor is a multiplier for the turning speed of a ship, and is set in flyToLocation(), to smoothen turning once the ship looks towards its target (to avoid jittering).

property int numDocks | [read-only]

function var add(CargoBay other)

Returns

nothing

function unsigned int addCargo(TradingGood good, int amount)

Adds cargo to the entity. If the amount specified exceeds the maximum capacity of the cargo bay, as much cargo as still fits in will be added.

Parameters

good TradingGood that is to be added.
amount The amount of cargo that should be added.

Returns

How much was actually added (can be less than amount when cargo bay is full)

function var clear()

Returns

nothing

function var destroyCargo(float volume)

Destroys cargo. The destruction distribution is generally equal over all goods.

Parameters

volume The amount of volume that should be destroyed.

Returns

nothing

function table<TradingGood, int> findCargos(string name)

Finds all cargos with the given name.

Parameters

name A string that will be matched with the 'name' property of the cargos.

Returns

A map containing all matching goods, with the good as key and amount as value.

function TradingGood, int... getCargo(unsigned int n)

function table<TradingGood, int> getCargos()

function int getNumCargos(var name)

Counts all goods of the given type. When given a string, it will match the 'name' property of the goods. When given a TradingGood it will match the exact good.

Parameters

name Either a TradingGood or a string containing the name of a trading good.

Returns

The number of goods

function string getSummary(var goods)

function var removeCargo(var good, int amount)

Removes cargo from the entity. When given a TradingGood, an exact check for that good will be performed. When given a string, only a name check will be performed, and which cargo will be removed first is undefined if there are multiple goods with the same name. An example would be Energy Cells vs. Stolen Energy Cells. The 'name' property is the same, but the 'stolen' property is different.

Parameters

good Either a TradingGood or a string with the name of a good.
amount The amount of cargo that should be removed. If this is more than there is on the ship, all specified cargo will be removed.

Returns

nothing

function bool __eq(var other)

function var addDescription(string str, string value)

Returns

nothing

function var addWeapon(var weapon)

Returns

nothing

function var clearDescriptions()

Returns

nothing

function var clearWeapons()

Returns

nothing

function Crew getCrew()

function table<string, string> getDescriptions()

function Weapon... getWeapons()

Returns all weapons of the object

function var setBlackMarketDLCOnly()

Returns

nothing

function var setIntoTheRiftDLCOnly()

Returns

nothing

function var setRange(float range)

Returns

nothing

function TurretTemplate template()

function var updateStaticStats()

Returns

nothing

function float getEfficiency(CraftStatsOverview::Stat stat)

function string getUnit(CraftStatsOverview::Stat stat)

function var getValue(CraftStatsOverview::Stat key)

function bool isBadValue(CraftStatsOverview::Stat stat)

function bool isDangerousValue(CraftStatsOverview::Stat stat)

function bool isRelevant(CraftStatsOverview::Stat stat)

function var setIncludeImpact(bool crew, bool energy, bool upgrades)

Returns

nothing

function var update(Entity entity)

Returns

nothing

function var addComponent(Type type)

Returns

nothing

function var addComponents()

Returns

nothing

function UserObject getComponent(Type type)

function var removeComponent(Type type)

Returns

nothing

function var addAbsoluteBias(int type, float value)

Adds a flat bias for stat of type type. This bias will be added to stat after multipliers are considered. Inherited from Entity

Parameters

type Type of Bonus, e.g. acceleration, higher level crew
value Bias added to base stats.

Returns

key that can be used to access the multiplier

function var addBaseMultiplier(int type, float factor)

Adds a multiplyer for stat of type type. This is to increase a stat, so a factor of 0.3 will become 1.3. Inherited from Entity

Parameters

type Type of Bonus, e.g. acceleration, higher level crew
factor Factor that is used as Multiplier

Returns

key that can be used to access the multiplier

function unsigned int addCargo(TradingGood good, int amount)

Adds cargo to the entity. If the amount specified exceeds the maximum capacity of the cargo bay, as much cargo as still fits in will be added. Inherited from Entity

Parameters

good TradingGood that is to be added.
amount The amount of cargo that should be added.

Returns

How much was actually added (can be less than amount when cargo bay is full)

function var addCrew(int number, CrewMan crewman)

Inherited from Entity

Returns

nothing

function var addKeyedAbsoluteBias(int type, int key, float value)

Exchanges flat bias at key with new value Inherited from Entity

Parameters

type Bonus type
key Location of the bonus that will be changed
value New value

Returns

key that can be used to access the multiplier

function var addKeyedBaseMultiplier(int type, int key, float value)

Exchanges multiplier at key with new value Inherited from Entity

Parameters

type Bonus type
key Location of the bonus that will be changed
value New value

Returns

key that can be used to access the multiplier

function var addKeyedMultiplier(int type, int key, float value)

Exchanges multiplier at key with new value Inherited from Entity

Parameters

type Bonus type
key Location of the bonus that will be changed
value New value

Returns

key that can be used to access the multiplier

function var addKeyedMultiplyableBias(int type, int key, float value)

Exchanges bias at key with new value Inherited from Entity

Parameters

type Bonus type
key Location of the bonus that will be changed
value New value

Returns

key that can be used to access the multiplier

function var addMultiplier(int type, float factor)

Adds a multiplyer for stat of type type. The factor will be used unchanged. Inherited from Entity

Parameters

type Type of Bonus, e.g. acceleration, higher level crew
factor Factor that is used as Multiplier

Returns

key that can be used to access the multiplier

function var addMultiplyableBias(int type, float value)

Adds a bias for stat of type type. This bias will be added to stat before multipliers are considered. Inherited from Entity

Parameters

type Type of Bonus, e.g. acceleration, higher level crew
value Bias added to base stats.

Returns

key that can be used to access the multiplier

function var addScript(string scriptPath, var... arguments)

Adds a new script to an entity Inherited from Entity

Parameters

scriptPath The path of the script that should be added
arguments An arbitrary number of arguments that will be given to the 'initialize' function of the added script

Returns

0 on success, 1 if the entity could not be found

function var addScriptOnce()

Inherited from Entity

function Uuid addTurret(TurretTemplate turret, Matrix position, int part)

Inherited from Entity

function var blockHyperspace(float time)

Inherited from Entity

Returns

nothing

function int callbacksRegistered(string callbackName, var functionName)

Check how many functions are registered to a callback from the current script VM. Inherited from Entity

Parameters

callbackName The name of the callback
functionName The name of the function for which to check. If nil, will count all functions that are registered to this callback.

Returns

The amount of functions registered to the callback

function var, var, table<int, string> canAddCrew(int number, int profession, bool change)

Inherited from Entity

function var changeCrew(int number, int profession)

Inherited from Entity

Returns

nothing

function var changeShield(double delta)

Adds delta to shield durability Inherited from Entity

Parameters

delta

Returns

nothing

function var clearCargoBay()

Inherited from Entity

Returns

nothing

function var clearValues()

Removes all custom values of the object Inherited from Entity

Returns

nothing

function var damageShield(double amount, vec3 location, Uuid inflictorId, var damageSource, var damageType)

Damages shield by delta amount, location and inflictorId are not necessary, but can be added if it is needed, e.g. you want to do effects on hitpoint. Inherited from Entity

Parameters

delta
location
inflictorId

Returns

nothing

function var destroy(Uuid inflictorId, var damageSource, var damageType)

Destroy entity by inflicting more damage than durability of entity Inherited from Entity

Parameters

inflictorId Index of the entity that destroys the block
damageSource Source of damage. Can be Weaponry, Collision, Decay, Torpedo or Arbitrary. *
damageType Type of damage received. Damage can be of type Physical, Energy, Electric, Plasma, AntiMatter or Fragments.

Returns

nothing

function var destroyBlock(int index, Uuid inflictorId, var damageSource)

Destroy one block Inherited from Entity

Parameters

index Index of the block that is destroyed
inflictorId Index of the entity that destroys the block
damageSource Source of damage. Can be Weaponry, Collision, Decay, Torpedo or Arbitrary.

Returns

nothing

function var destroyCargo(float volume)

Destroys cargo. The destruction distribution is generally equal over all goods. Inherited from Entity

Parameters

volume The amount of volume that should be destroyed.

Returns

nothing

function var disableFlightAssistFor(float time)

Inherited from Entity

Returns

nothing

function var distortHyperspace(float time)

Inherited from Entity

Returns

nothing

function table<TradingGood, int> findCargos(string name)

Finds all cargos with the given name. Inherited from Entity

Parameters

name A string that will be matched with the 'name' property of the cargos.

Returns

A map containing all matching goods, with the good as key and amount as value.

function vec3 getAimedPositionBySeat(int seat)

Inherited from Entity

function vec3... getAimedPositions()

Inherited from Entity

function var getAllowedArbitraryTurrets()

Inherited from Entity

function var getAllowedArmedTurrets()

Inherited from Entity

function var getAllowedUnarmedTurrets()

Inherited from Entity

function var getAttachedBlockIndex()

Returns the Index of the block that the turret is build on Inherited from Entity

function var getBoostedValue(int type, float value)

Returns value with included bonus, in case a bonus exists. Returns Nil if no bonuses at all, returns value if no bonuses for this stat exist. Inherited from Entity

Parameters

type type of bonus stat, e.g. acceleration, higher level crew
value the value, that might be changed by bonuses

function Box getBoundingBox()

Returns Bounding Box for entity, use this if you need exact Bounding Box, e.g. for collision detection when entities are close to each other. Inherited from Entity

function Sphere getBoundingSphere()

Returns Bounding Sphere for entity. Much faster than Bounding Box, but not as accurate. Use this if you need to check often. Inherited from Entity

function Captain getCaptain()

Inherited from Entity

function TradingGood, int... getCargo(unsigned int n)

Inherited from Entity

function int getCargoAmount(var name)

Counts all goods of the given type. When given a string, it will match the 'name' property of the goods. When given a TradingGood it will match the exact good. Inherited from Entity

Parameters

name Either a TradingGood or a string containing the name of a trading good.

Returns

The number of goods

function table<TradingGood, int> getCargos()

Inherited from Entity

function var getCrewMembers(int profession)

Inherited from Entity

function int... getDamageContributorPlayerFactions()

Lists all players and alliances that contributed damage to the entity Inherited from Entity

Returns

Indices of all players and alliances that contributed damage to the entity

function int... getDamageContributorPlayers()

Lists all players that contributed damage to the entity Inherited from Entity

Returns

Indices of all players that contributed damage to the entity

function int... getDamageContributors()

Lists all factions that contributed damage to the entity Inherited from Entity

Returns

Indices of all factions that contributed damage to the entity

function Box getDockedGroupBoundingBox()

Returns Bounding Box for entity, but enlarged to also fit around all docked objects. Use this if you need exact Bounding Box, e.g. for collision detection when entities are close to each other. Inherited from Entity

function Sphere getDockedGroupBoundingSphere()

Returns Bounding Box for entity, but enlarged to also fit around all docked objects. Use this if you need exact Bounding Box, e.g. for collision detection when entities are close to each other. Inherited from Entity

function var getDockingPositions()

Lists all docking positions that the entity has Inherited from Entity

Returns

A table that contains a key-value pair (id, table) for each dock: <id, {position, direction, id}>

function var getFreeArbitraryTurrets()

Inherited from Entity

function var getFreeArmedTurrets()

Inherited from Entity

function var getFreeUnarmedTurrets()

Inherited from Entity

function BlockPlan getFullPlanCopy()

Returns the plan of the entity. This copies the entire plan, keep that in mind when using plans with large block counts. Inherited from Entity

Returns

A copy of the plan of the entity

function Material getLowestMineableMaterial()

Inherited from Entity

function var, var getMalusFactor()

Inherited from Entity

function Material getMineableMaterial()

Inherited from Entity

function int... getMineableResources()

Inherited from Entity

function int getMoneyLootAmount()

Inherited from Entity

function BlockPlan getMovePlan()

Returns the plan of the entity. This function will move the plan out of the entity, and replace the entity's plan with a single block. This operation is independent of the size of the plan, use it when you have to get large plans with lots of blocks. Inherited from Entity

Returns

The plan of the entity

function var getNearestDistance(Entity other)

Inherited from Entity

function var getNumArmedTurrets()

Inherited from Entity

function var getNumMiningTurrets()

Inherited from Entity

function var getNumSalvagingTurrets()

Inherited from Entity

function var getNumUnarmedTurrets()

Inherited from Entity

function int... getPilotIndices()

Returns Indices of piloting players Inherited from Entity

Returns

multiple return values: indices of players

function var getPlanMoneyValue()

Inherited from Entity

function double... getPlanResourceValue()

Inherited from Entity

function int getResourceLootAmount()

Inherited from Entity

function table<int, string> getScripts()

Inherited from Entity

function table<string, string> getTitleArguments()

Retrieves the arguments to a title Inherited from Entity

function NamedFormat getTitleFormat()

Retrieves the title as NamedFormat Inherited from Entity

function Entity getTurret(int index)

Inherited from Entity

function Matrix, int... getTurretPositions(TurretTemplate turret, int number)

Inherited from Entity

function Matrix, int... getTurretPositionsLineOfSight(TurretTemplate turret, int number)

Inherited from Entity

function Entity... getTurrets()

Inherited from Entity

function var getTurretSize()

Inherited from Entity

function var getTurretTemplateSize()

Inherited from Entity

function var getTurretTurningSpeed()

Inherited from Entity

function var getUndamagedPlanMoneyValue()

Inherited from Entity

function double... getUndamagedPlanResourceValue()

Inherited from Entity

function var getValue(string key)

Retrieves a custom value saved in the entity with the given key Inherited from Entity

Parameters

key A string that serves as the name of the value

Returns

The value if the key exists, otherwise nil

function table<string, var> getValues()

Retrieves all key-value pairs of custom values of the entity Inherited from Entity

Returns

A table containing all custom key-value pairs

function bool hasComponent(int type)

Inherited from Entity

function var hasScript(string name)

Inherited from Entity

function var heal(float damage, int index, vec3 location, Uuid inflictorID)

Increases durability of the plan of the Entity Inherited from Entity

Parameters

damage The amount of durability that will be restored
index Index of the block that will be restored
location vector containing the hit point, if unknown/unnecessary use empty vector
inflictorID Index of the entity that heals

Returns

nothing

function var healShield(double delta)

Increases shield durability by delta Inherited from Entity

Parameters

delta

Returns

nothing

function var hyperspaceBlocked()

Inherited from Entity

function var inflictDamage(float damage, var damageSource, var damageType, int index, vec3 location, Uuid inflictorId)

Inflicts damage to the plan of the Entity Inherited from Entity

Parameters

damage The amount of damage that will be dealt
damageSource The source of the damage. Can be Weaponry, Collision, Decay, Torpedo or Arbitrary.
damageType Type of damage received. Damage can be of type Physical, Energy, Electric, Plasma, AntiMatter or Fragments
index Index of the block that will receive the damage
location vector containing the hit point, if unknown / unnecessary use empty vector
inflictorId Index of the entity that caused the damage

Returns

nothing

function var... invokeFunction(var scriptName, string functionName, var... arguments)

Invokes a function in a script of the entity. Use this function to invoke functions from one script in another script. The first return value of the function is an integer indicating whether or not the call was successful. When it was, this integer is followed by the return values of the invoked function. Inherited from Entity

Parameters

scriptName The name or index of the script containing the function
functionName The name of the function that will be executed
arguments An arbitrary list of arguments that will be given to the invoked function

Returns

Returns at least 1 value indicating if the call succeeded:
0 The call was successful. In this case, the return values of the script are returned in addition to the call result, following the call result
1 The call failed because the entity with the specified index does not exist or has no Scripts component
2 The call failed because it came from another sector than the entity is in
3 The call failed because the given script was not found in the entity
4 The call failed because the given function was not found in the script
5 The call failed because the script's state has errors and is invalid

function var isCollectable(Entity entity)

Inherited from Entity

function bool isInDockingArea(Entity other)

Inherited from Entity

function var isInsideShield(vec3 point)

Inherited from Entity

function bool, var isJumpRouteValid(int fromX, int fromY, int toX, int toY)

Inherited from Entity

function var isManned()

Inherited from Entity

function var isTurretAllowed(TurretTemplate ScriptTurretTemplate)

Tests if the maximum number of turrets of this kind is not reached Inherited from Entity

Parameters

ScriptTurretTemplate the template of the turret to be placed

function int jumpPossible(int x, int y)

Tests if the entity can jump to the specified coordinates Inherited from Entity

Parameters

x The x-coordinates of the target sector
y The y-coordinates of the target sector

Returns

Returns an error code:
-1 The entity doesn't have a hyperspace drive.
0 The entity can jump.
1 The hyperspace drive needs to recharge.
2 The target sector is too far away.
3 The entity is facing the wrong direction.
4 The hyperspace drive is being jammed.

function var moveBy(vec3 delta)

Teleports entity by vector Inherited from Entity

Returns

nothing

function int registerCallback(string callbackName, string functionName)

Register a callback in the entity. The callback receiver has to be inside the same sector for the registration to succeed. The callback will be removed if either the entity or the receiver leaves the sector or gets destroyed. Double registration of callbacks doesn't work. When the same callback to the same callback of the same script instance is registered twice, it will still only be called once. Inherited from Entity

Parameters

callbackName The name of the callback
functionName The name of the function that will be executed in the script when the callback happens

Returns

0 on success, 1 if the registration failed

function var registerDamage(Uuid shooterId, double damage, DamageSource DamageSource)

Registers artificial damage as if the entity was damaged by the shooter Inherited from Entity

Parameters

shooterId The id of the entity that inflicted the damage
damage The amount of damage inflicted
DamageSource The kind of source for the damage

Returns

nothing

function var removeBonus(int key)

Deletes bonus Inherited from Entity

Parameters

key Location of the bonus

Returns

nothing

function var removeCargo(var good, int amount)

Removes cargo from the entity. When given a TradingGood, an exact check for that good will be performed. When given a string, only a name check will be performed, and which cargo will be removed first is undefined if there are multiple goods with the same name. An example would be Energy Cells vs. Stolen Energy Cells. The 'name' property is the same, but the 'stolen' property is different. Inherited from Entity

Parameters

good Either a TradingGood or a string with the name of a good.
amount The amount of cargo that should be removed. If this is more than there is on the ship, all specified cargo will be removed.

Returns

nothing

function var removeCrew(int number, CrewMan crewman)

Inherited from Entity

function var removeScript(var script)

Inherited from Entity

Returns

nothing

function var removeScriptBonuses()

Deletes all bonuses added by the current script Inherited from Entity

Returns

nothing

function var resolveScriptPath(string path)

Inherited from Entity

function bool sendCallback()

Inherited from Entity

function var setAccumulatingBlockHealth(bool bool)

If AccumulatingBlockHealth is true, a block needs to take as much damage as would be necessary to destroy all its children before it itself is destroyed. If it is set to false, the entity's blocks will have only their own durability. Set it to false if you want your entity to easily break apart, e.g. for wreckages. Inherited from Entity

Parameters

bool

Returns

nothing

function var setAimedPosition(int seat, vec3 in)

Inherited from Entity

Returns

nothing

function var setAttachedBlockIndex(int in)

Inherited from Entity

Returns

nothing

function var setCaptain(Captain [or nil] captain)

Inherited from Entity

Returns

nothing

function var setDamageTypeMultiplier(DamageType type, float factor)

Inherited from Entity

Returns

nothing

function var setDropsAttachedTurrets(bool bool)

Sets the entities' ability to drop its attached turrets. If set to true (default) the ship has a chance to drop a turret that's attached to it when it's destroyed. This is only enabled for NPC entities. Inherited from Entity

Parameters

bool value if the dropping is enabled

Returns

nothing

function var setDropsLoot(bool bool)

Sets the entities' ability to drop normal loot. Affects dropping of money, resources, cargo, turrets and upgrades. 'Loot' component is not affected by this. Inherited from Entity

Parameters

bool value if the entity should drop loot or not

Returns

nothing

function var setMalusFactor(float in, int reason)

Inherited from Entity

Returns

nothing

function var setManned(bool in)

Inherited from Entity

Returns

nothing

function var setMovePlan(BlockPlan plan)

Set the new plan of the entity. The entity will get deleted if the plan is empty. This moves all the data out of the plan that is used as the first argument. The content of the plan given as argument is then undefined, but still valid. It might be empty, it might contain the previous plan. This operation is independent of the size of the plan, use it when you have to set large plans with lots of blocks. Inherited from Entity

Parameters

plan The new BlockPlan of the entity

Returns

nothing

function var setPlan(BlockPlan plan)

Set the new plan of the entity. The entity will get deleted if the plan is empty. This copies the entire plan that is given as argument, keep that in mind when setting plans with large block counts. Inherited from Entity

Parameters

plan The new BlockPlan of the entity

Returns

nothing

function var setTitle(string title, string_pair... arguments)

Sets the title that can be used as title in menus Inherited from Entity

Parameters

title a string that will be used as title, can be a format string for easier translation.
arguments Set the string arguments (if format string is used) as vector of string_pair.

Returns

nothing

function var setTitleArguments(string_pair... arguments)

Sets the arguments to a title Inherited from Entity

Parameters

arguments Set the string arguments as vector of string_pair.

Returns

nothing

function var setTurretSize(float in)

Inherited from Entity

Returns

nothing

function var setTurretTurningSpeed(float in)

Inherited from Entity

Returns

nothing

function var setValue(string key, var value)

Sets a custom value Inherited from Entity

Parameters

key A string that serves as the name of the value
value The value to save. Must be bool, number, string or nil. If nil is given, the value will be deleted.

function var singleFlyToLocationTick(vec3 location)

Tells the ship to fly to given location, directly and without pathfinding. Inherited from Entity

Parameters

location the location to fly to (in global coordinates) Paired with setting desiredVelocity to 0, this can be used to rotate the ship to a given direction.

Returns

nothing

function int unregisterCallback(string callbackName, string functionName)

Inherited from Entity

function var updateProductionCatchingUp(float float)

Simulates production catching up. This is used when ships return from the background simulation. Updates fighter production, academy and cloning. Inherited from Entity

Parameters

float timePassed The amount of time that should be simulated

Returns

nothing

function var waitUntilAsyncWorkFinished(var time)

Inherited from Entity

Returns

nothing

function var addAbsoluteBias(int type, float value)

Adds a flat bias for stat of type type. This bias will be added to stat after multipliers are considered.

Parameters

type Type of Bonus, e.g. acceleration, higher level crew
value Bias added to base stats.

Returns

key that can be used to access the multiplier

function var addBaseMultiplier(int type, float factor)

Adds a multiplyer for stat of type type. This is to increase a stat, so a factor of 0.3 will become 1.3.

Parameters

type Type of Bonus, e.g. acceleration, higher level crew
factor Factor that is used as Multiplier

Returns

key that can be used to access the multiplier

function unsigned int addCargo(TradingGood good, int amount)

Adds cargo to the entity. If the amount specified exceeds the maximum capacity of the cargo bay, as much cargo as still fits in will be added.

Parameters

good TradingGood that is to be added.
amount The amount of cargo that should be added.

Returns

How much was actually added (can be less than amount when cargo bay is full)

function var addCrew(int number, CrewMan crewman)

Returns

nothing

function var addKeyedAbsoluteBias(int type, int key, float value)

Exchanges flat bias at key with new value

Parameters

type Bonus type
key Location of the bonus that will be changed
value New value

Returns

key that can be used to access the multiplier

function var addKeyedBaseMultiplier(int type, int key, float value)

Exchanges multiplier at key with new value

Parameters

type Bonus type
key Location of the bonus that will be changed
value New value

Returns

key that can be used to access the multiplier

function var addKeyedMultiplier(int type, int key, float value)

Exchanges multiplier at key with new value

Parameters

type Bonus type
key Location of the bonus that will be changed
value New value

Returns

key that can be used to access the multiplier

function var addKeyedMultiplyableBias(int type, int key, float value)

Exchanges bias at key with new value

Parameters

type Bonus type
key Location of the bonus that will be changed
value New value

Returns

key that can be used to access the multiplier

function var addMultiplier(int type, float factor)

Adds a multiplyer for stat of type type. The factor will be used unchanged.

Parameters

type Type of Bonus, e.g. acceleration, higher level crew
factor Factor that is used as Multiplier

Returns

key that can be used to access the multiplier

function var addMultiplyableBias(int type, float value)

Adds a bias for stat of type type. This bias will be added to stat before multipliers are considered.

Parameters

type Type of Bonus, e.g. acceleration, higher level crew
value Bias added to base stats.

Returns

key that can be used to access the multiplier

function var addScript(string scriptPath, var... arguments)

Adds a new script to an entity

Parameters

scriptPath The path of the script that should be added
arguments An arbitrary number of arguments that will be given to the 'initialize' function of the added script

Returns

0 on success, 1 if the entity could not be found

function var addScriptOnce()

function Uuid addTurret(TurretTemplate turret, Matrix position, int part)

function var blockHyperspace(float time)

Returns

nothing

function int callbacksRegistered(string callbackName, var functionName)

Check how many functions are registered to a callback from the current script VM.

Parameters

callbackName The name of the callback
functionName The name of the function for which to check. If nil, will count all functions that are registered to this callback.

Returns

The amount of functions registered to the callback

function var, var, table<int, string> canAddCrew(int number, int profession, bool change)

function var changeCrew(int number, int profession)

Returns

nothing

function var changeShield(double delta)

Adds delta to shield durability

Parameters

delta

Returns

nothing

function var clearCargoBay()

Returns

nothing

function var clearValues()

Removes all custom values of the object

Returns

nothing

function var damageShield(double amount, vec3 location, Uuid inflictorId, var damageSource, var damageType)

Damages shield by delta amount, location and inflictorId are not necessary, but can be added if it is needed, e.g. you want to do effects on hitpoint.

Parameters

delta
location
inflictorId

Returns

nothing

function var destroy(Uuid inflictorId, var damageSource, var damageType)

Destroy entity by inflicting more damage than durability of entity

Parameters

inflictorId Index of the entity that destroys the block
damageSource Source of damage. Can be Weaponry, Collision, Decay, Torpedo or Arbitrary. *
damageType Type of damage received. Damage can be of type Physical, Energy, Electric, Plasma, AntiMatter or Fragments.

Returns

nothing

function var destroyBlock(int index, Uuid inflictorId, var damageSource)

Destroy one block

Parameters

index Index of the block that is destroyed
inflictorId Index of the entity that destroys the block
damageSource Source of damage. Can be Weaponry, Collision, Decay, Torpedo or Arbitrary.

Returns

nothing

function var destroyCargo(float volume)

Destroys cargo. The destruction distribution is generally equal over all goods.

Parameters

volume The amount of volume that should be destroyed.

Returns

nothing

function var disableFlightAssistFor(float time)

Returns

nothing

function var distortHyperspace(float time)

Returns

nothing

function table<TradingGood, int> findCargos(string name)

Finds all cargos with the given name.

Parameters

name A string that will be matched with the 'name' property of the cargos.

Returns

A map containing all matching goods, with the good as key and amount as value.

function vec3 getAimedPositionBySeat(int seat)

function vec3... getAimedPositions()

function var getAllowedArbitraryTurrets()

function var getAllowedArmedTurrets()

function var getAllowedUnarmedTurrets()

function var getAttachedBlockIndex()

Returns the Index of the block that the turret is build on

function var getBoostedValue(int type, float value)

Returns value with included bonus, in case a bonus exists. Returns Nil if no bonuses at all, returns value if no bonuses for this stat exist.

Parameters

type type of bonus stat, e.g. acceleration, higher level crew
value the value, that might be changed by bonuses

function Box getBoundingBox()

Returns Bounding Box for entity, use this if you need exact Bounding Box, e.g. for collision detection when entities are close to each other.

function Sphere getBoundingSphere()

Returns Bounding Sphere for entity. Much faster than Bounding Box, but not as accurate. Use this if you need to check often.

function Captain getCaptain()

function TradingGood, int... getCargo(unsigned int n)

function int getCargoAmount(var name)

Counts all goods of the given type. When given a string, it will match the 'name' property of the goods. When given a TradingGood it will match the exact good.

Parameters

name Either a TradingGood or a string containing the name of a trading good.

Returns

The number of goods

function table<TradingGood, int> getCargos()

function var getCrewMembers(int profession)

function int... getDamageContributorPlayerFactions()

Lists all players and alliances that contributed damage to the entity

Returns

Indices of all players and alliances that contributed damage to the entity

function int... getDamageContributorPlayers()

Lists all players that contributed damage to the entity

Returns

Indices of all players that contributed damage to the entity

function int... getDamageContributors()

Lists all factions that contributed damage to the entity

Returns

Indices of all factions that contributed damage to the entity

function Box getDockedGroupBoundingBox()

Returns Bounding Box for entity, but enlarged to also fit around all docked objects. Use this if you need exact Bounding Box, e.g. for collision detection when entities are close to each other.

function Sphere getDockedGroupBoundingSphere()

Returns Bounding Box for entity, but enlarged to also fit around all docked objects. Use this if you need exact Bounding Box, e.g. for collision detection when entities are close to each other.

function var getDockingPositions()

Lists all docking positions that the entity has

Returns

A table that contains a key-value pair (id, table) for each dock: <id, {position, direction, id}>

function var getFreeArbitraryTurrets()

function var getFreeArmedTurrets()

function var getFreeUnarmedTurrets()

function BlockPlan getFullPlanCopy()

Returns the plan of the entity. This copies the entire plan, keep that in mind when using plans with large block counts.

Returns

A copy of the plan of the entity

function Material getLowestMineableMaterial()

function var, var getMalusFactor()

function Material getMineableMaterial()

function int... getMineableResources()

function int getMoneyLootAmount()

function BlockPlan getMovePlan()

Returns the plan of the entity. This function will move the plan out of the entity, and replace the entity's plan with a single block. This operation is independent of the size of the plan, use it when you have to get large plans with lots of blocks.

Returns

The plan of the entity

function var getNearestDistance(Entity other)

function var getNumArmedTurrets()

function var getNumMiningTurrets()

function var getNumSalvagingTurrets()

function var getNumUnarmedTurrets()

function int... getPilotIndices()

Returns Indices of piloting players

Returns

multiple return values: indices of players

function var getPlanMoneyValue()

function double... getPlanResourceValue()

function int getResourceLootAmount()

function table<int, string> getScripts()

function table<string, string> getTitleArguments()

Retrieves the arguments to a title

function NamedFormat getTitleFormat()

Retrieves the title as NamedFormat

function Entity getTurret(int index)

function Matrix, int... getTurretPositions(TurretTemplate turret, int number)

function Matrix, int... getTurretPositionsLineOfSight(TurretTemplate turret, int number)

function Entity... getTurrets()

function var getTurretSize()

function var getTurretTemplateSize()

function var getTurretTurningSpeed()

function var getUndamagedPlanMoneyValue()

function double... getUndamagedPlanResourceValue()

function var getValue(string key)

Retrieves a custom value saved in the entity with the given key

Parameters

key A string that serves as the name of the value

Returns

The value if the key exists, otherwise nil

function table<string, var> getValues()

Retrieves all key-value pairs of custom values of the entity

Returns

A table containing all custom key-value pairs

function bool hasComponent(int type)

function var hasScript(string name)

function var heal(float damage, int index, vec3 location, Uuid inflictorID)

Increases durability of the plan of the Entity

Parameters

damage The amount of durability that will be restored
index Index of the block that will be restored
location vector containing the hit point, if unknown/unnecessary use empty vector
inflictorID Index of the entity that heals

Returns

nothing

function var healShield(double delta)

Increases shield durability by delta

Parameters

delta

Returns

nothing

function var hyperspaceBlocked()

function var inflictDamage(float damage, var damageSource, var damageType, int index, vec3 location, Uuid inflictorId)

Inflicts damage to the plan of the Entity

Parameters

damage The amount of damage that will be dealt
damageSource The source of the damage. Can be Weaponry, Collision, Decay, Torpedo or Arbitrary.
damageType Type of damage received. Damage can be of type Physical, Energy, Electric, Plasma, AntiMatter or Fragments
index Index of the block that will receive the damage
location vector containing the hit point, if unknown / unnecessary use empty vector
inflictorId Index of the entity that caused the damage

Returns

nothing

function var... invokeFunction(var scriptName, string functionName, var... arguments)

Invokes a function in a script of the entity. Use this function to invoke functions from one script in another script. The first return value of the function is an integer indicating whether or not the call was successful. When it was, this integer is followed by the return values of the invoked function.

Parameters

scriptName The name or index of the script containing the function
functionName The name of the function that will be executed
arguments An arbitrary list of arguments that will be given to the invoked function

Returns

Returns at least 1 value indicating if the call succeeded:
0 The call was successful. In this case, the return values of the script are returned in addition to the call result, following the call result
1 The call failed because the entity with the specified index does not exist or has no Scripts component
2 The call failed because it came from another sector than the entity is in
3 The call failed because the given script was not found in the entity
4 The call failed because the given function was not found in the script
5 The call failed because the script's state has errors and is invalid

function var isCollectable(Entity entity)

function bool isInDockingArea(Entity other)

function var isInsideShield(vec3 point)

function bool, var isJumpRouteValid(int fromX, int fromY, int toX, int toY)

function var isManned()

function var isTurretAllowed(TurretTemplate ScriptTurretTemplate)

Tests if the maximum number of turrets of this kind is not reached

Parameters

ScriptTurretTemplate the template of the turret to be placed

function int jumpPossible(int x, int y)

Tests if the entity can jump to the specified coordinates

Parameters

x The x-coordinates of the target sector
y The y-coordinates of the target sector

Returns

Returns an error code:
-1 The entity doesn't have a hyperspace drive.
0 The entity can jump.
1 The hyperspace drive needs to recharge.
2 The target sector is too far away.
3 The entity is facing the wrong direction.
4 The hyperspace drive is being jammed.

function var moveBy(vec3 delta)

Teleports entity by vector

Returns

nothing

function int registerCallback(string callbackName, string functionName)

Register a callback in the entity. The callback receiver has to be inside the same sector for the registration to succeed. The callback will be removed if either the entity or the receiver leaves the sector or gets destroyed. Double registration of callbacks doesn't work. When the same callback to the same callback of the same script instance is registered twice, it will still only be called once.

Parameters

callbackName The name of the callback
functionName The name of the function that will be executed in the script when the callback happens

Returns

0 on success, 1 if the registration failed

function var registerDamage(Uuid shooterId, double damage, DamageSource DamageSource)

Registers artificial damage as if the entity was damaged by the shooter

Parameters

shooterId The id of the entity that inflicted the damage
damage The amount of damage inflicted
DamageSource The kind of source for the damage

Returns

nothing

function var removeBonus(int key)

Deletes bonus

Parameters

key Location of the bonus

Returns

nothing

function var removeCargo(var good, int amount)

Removes cargo from the entity. When given a TradingGood, an exact check for that good will be performed. When given a string, only a name check will be performed, and which cargo will be removed first is undefined if there are multiple goods with the same name. An example would be Energy Cells vs. Stolen Energy Cells. The 'name' property is the same, but the 'stolen' property is different.

Parameters

good Either a TradingGood or a string with the name of a good.
amount The amount of cargo that should be removed. If this is more than there is on the ship, all specified cargo will be removed.

Returns

nothing

function var removeCrew(int number, CrewMan crewman)

function var removeScript(var script)

Returns

nothing

function var removeScriptBonuses()

Deletes all bonuses added by the current script

Returns

nothing

function var resolveScriptPath(string path)

function bool sendCallback()

function var setAccumulatingBlockHealth(bool bool)

If AccumulatingBlockHealth is true, a block needs to take as much damage as would be necessary to destroy all its children before it itself is destroyed. If it is set to false, the entity's blocks will have only their own durability. Set it to false if you want your entity to easily break apart, e.g. for wreckages.

Parameters

bool

Returns

nothing

function var setAimedPosition(int seat, vec3 in)

Returns

nothing

function var setAttachedBlockIndex(int in)

Returns

nothing

function var setCaptain(Captain [or nil] captain)

Returns

nothing

function var setDamageTypeMultiplier(DamageType type, float factor)

Returns

nothing

function var setDropsAttachedTurrets(bool bool)

Sets the entities' ability to drop its attached turrets. If set to true (default) the ship has a chance to drop a turret that's attached to it when it's destroyed. This is only enabled for NPC entities.

Parameters

bool value if the dropping is enabled

Returns

nothing

function var setDropsLoot(bool bool)

Sets the entities' ability to drop normal loot. Affects dropping of money, resources, cargo, turrets and upgrades. 'Loot' component is not affected by this.

Parameters

bool value if the entity should drop loot or not

Returns

nothing

function var setMalusFactor(float in, int reason)

Returns

nothing

function var setManned(bool in)

Returns

nothing

function var setMovePlan(BlockPlan plan)

Set the new plan of the entity. The entity will get deleted if the plan is empty. This moves all the data out of the plan that is used as the first argument. The content of the plan given as argument is then undefined, but still valid. It might be empty, it might contain the previous plan. This operation is independent of the size of the plan, use it when you have to set large plans with lots of blocks.

Parameters

plan The new BlockPlan of the entity

Returns

nothing

function var setPlan(BlockPlan plan)

Set the new plan of the entity. The entity will get deleted if the plan is empty. This copies the entire plan that is given as argument, keep that in mind when setting plans with large block counts.

Parameters

plan The new BlockPlan of the entity

Returns

nothing

function var setTitle(string title, string_pair... arguments)

Sets the title that can be used as title in menus

Parameters

title a string that will be used as title, can be a format string for easier translation.
arguments Set the string arguments (if format string is used) as vector of string_pair.

Returns

nothing

function var setTitleArguments(string_pair... arguments)

Sets the arguments to a title

Parameters

arguments Set the string arguments as vector of string_pair.

Returns

nothing

function var setTurretSize(float in)

Returns

nothing

function var setTurretTurningSpeed(float in)

Returns

nothing

function var setValue(string key, var value)

Sets a custom value

Parameters

key A string that serves as the name of the value
value The value to save. Must be bool, number, string or nil. If nil is given, the value will be deleted.

function var singleFlyToLocationTick(vec3 location)

Tells the ship to fly to given location, directly and without pathfinding.

Parameters

location the location to fly to (in global coordinates) Paired with setting desiredVelocity to 0, this can be used to rotate the ship to a given direction.

Returns

nothing

function int unregisterCallback(string callbackName, string functionName)

function var updateProductionCatchingUp(float float)

Simulates production catching up. This is used when ships return from the background simulation. Updates fighter production, academy and cloning.

Parameters

float timePassed The amount of time that should be simulated

Returns

nothing

function var waitUntilAsyncWorkFinished(var time)

Returns

nothing

function bool, var isJumpRouteValid(int fromX, int fromY, int toX, int toY)

Checks if a hyperspace route would be valid.

Parameters

fromX X coordinate of the origin
fromY Y coordinate of the origin
toX X coordinate of the destination
toY Y coordinate of the destination

Returns

Returns a bool (true, false), and, if false, a string containing the reason why it's invalid

function var block(float time)

Blocks the hyperspace engine for a certain time. While the hyperspace engine is blocked, it can't jump. For safety reasons, the hyperspace engine can only be blocked for a limited amount of time. You should only block it for a few seconds and then reblock it. Also sets the "clear space" property to false.

Parameters

time The amount of time the engine will be blocked. Doesn't accumulate, overrides previous blocks

Returns

nothing

function var distort(float time)

Distorts the hyperspace engine for a certain time. While the hyperspace engine is distorted, it takes 4x as long to recharge. For safety reasons, the hyperspace engine can only be distorted for a limited amount of time. You should only distort it for a few seconds and then redistort it. Also sets the "clear space" property to false.

Parameters

time The amount of time the engine will be distorted. Doesn't accumulate, overrides previous distorts

Returns

nothing

function var exhaust()

Exhausts the hyperspace engine as if when a jump happens.

Returns

nothing

function int... getJumpErrors(int x, int y)

Checks if a jump to a sector would be possible and returns all errors.

Parameters

x X coordinate of the destination
y Y coordinate of the destination

Returns

a set of JumpError codes containing the reasons why the jump is not possible

function bool, var isJumpRouteValid(int fromX, int fromY, int toX, int toY)

Checks if a hyperspace route would be valid.

Parameters

fromX X coordinate of the origin
fromY Y coordinate of the origin
toX X coordinate of the destination
toY Y coordinate of the destination

Returns

Returns a bool (true, false), and, if false, a string containing the reason why it's invalid

function var jump(int x, int y)

Initiates a hyperspace jump. This is what happens when the player presses space. This will always do the jump, no matter what.

Parameters

x X coordinate of the destination
y Y coordinate of the destination

Returns

nothing

function int jumpPossible(int x, int y)

Checks if a jump to a sector would be possible.

Parameters

x X coordinate of the destination
y Y coordinate of the destination

Returns

a JumpError code containing the reason why the jump is not possible

function int tryJump(int x, int y)

Tries to initiate a hyperspace jump. This is what happens when the player presses space. On failure, this will return a JumpError code with the reason.

Parameters

x X coordinate of the destination
y Y coordinate of the destination

Returns

a JumpError code containing the reason why the jump failed

function table<TradingGood, int> findCargos(string name)

Finds all cargos with the given name.

Parameters

name A string that will be matched with the 'name' property of the cargos.

Returns

A map containing all matching goods, with the good as key and amount as value.

function TradingGood, int... getCargo(unsigned int n)

function table<TradingGood, int> getCargos()

function int getNumCargos(var name)

Counts all goods of the given type. When given a string, it will match the 'name' property of the goods. When given a TradingGood it will match the exact good.

Parameters

name Either a TradingGood or a string containing the name of a trading good.

Returns

The number of goods

function string getSummary(var goods)

function bitset<10> getActiveWeapons()

Returns a list of bools representing the currently active weapon groups.

function vec3 getAimedPositionBySeat(int seatIndex)

Returns the aimed position of a given seat.

Parameters

seatIndex The index of the seat

function vec3 getAimedPositionByWeaponGroup(int groupIndex)

Returns the aimed position of the seat that controls the given weapon group.

Parameters

groupIndex The weapon group of the seat

function vec3... getAimedPositions()

Returns a list of aimed positions of all seats

function int... getAllControlActions()

Returns a list of bitsets (represented as ints) of control actions of all seats.

function int getControlActions(int seatIndex)

Returns the bitset of control actions of a given seat.

Parameters

seatIndex The index of the seat

function int getControlActionsByWeaponGroup(int groupIndex)

Returns the bitset of control actions of the seat that controls the given weapon group.

Parameters

groupIndex The weapon group of the seat

function vec3 getFlownToLocation()

Returns the currently flown to location, which is set by calls to flyToLocation. Note: When the AI flies towards a location, it also sets this.

function int getSeatByWeaponGroup(int groupIndex)

Returns the seat that controls a particular weapon group.

Parameters

groupIndex The weapon group of the seat

function ControlUnitSeat... getSeats()

Returns a list of seats of the control unit.

function Entity getSelectedObject(int seatIndex)

Returns the selected object of a given seat.

Parameters

seatIndex The index of the seat

function uuid getSelectedObjectId(int seatIndex)

Returns the id of the selected object of a given seat.

Parameters

seatIndex The index of the seat

function uuid... getSelectedObjectIds()

Returns a list of selected target ids of all seats

function bool isFiring(int seat)

Checks if the given seat is currently pushing "Fire" (see ControlActionBit.Fire1)

function bool isFiringTorpedoes(int seat)

Checks if the given seat is currently pushing "Fire Torpedoes" (see ControlActionBit.Fire2)

function bool isPlayerAPilot(int playerIndex)

Checks if the given player is setting in any seat of the control unit.

Parameters

playerIndex The index of the player

function bool mayControlSquad(int playerIndex, int squadIndex)

Checks if the given player has the right to control the given fighter squad.

Parameters

playerIndex The index of the player
squadIndex The index of the squad

function bool mayControlWeaponGroup(int playerIndex, int groupIndex)

Checks if the given player has the right to control the given weapon group.

Parameters

playerIndex The index of the player
groupIndex The index of the weapon group

function bool maySteer(int playerIndex)

Checks if the given player has the right to pilot (steer) the ship. The player must be sitting in the pilot seat.

Parameters

playerIndex The index of the player

function var add(CargoBay other)

Returns

nothing

function unsigned int addCargo(TradingGood good, int amount)

Adds cargo to the entity. If the amount specified exceeds the maximum capacity of the cargo bay, as much cargo as still fits in will be added.

Parameters

good TradingGood that is to be added.
amount The amount of cargo that should be added.

Returns

How much was actually added (can be less than amount when cargo bay is full)

function var clear()

Returns

nothing

function var destroyCargo(float volume)

Destroys cargo. The destruction distribution is generally equal over all goods.

Parameters

volume The amount of volume that should be destroyed.

Returns

nothing

function table<TradingGood, int> findCargos(string name)

Finds all cargos with the given name.

Parameters

name A string that will be matched with the 'name' property of the cargos.

Returns

A map containing all matching goods, with the good as key and amount as value.

function TradingGood, int... getCargo(unsigned int n)

function table<TradingGood, int> getCargos()

function int getNumCargos(var name)

Counts all goods of the given type. When given a string, it will match the 'name' property of the goods. When given a TradingGood it will match the exact good.

Parameters

name Either a TradingGood or a string containing the name of a trading good.

Returns

The number of goods

function string getSummary(var goods)

function var removeCargo(var good, int amount)

Removes cargo from the entity. When given a TradingGood, an exact check for that good will be performed. When given a string, only a name check will be performed, and which cargo will be removed first is undefined if there are multiple goods with the same name. An example would be Energy Cells vs. Stolen Energy Cells. The 'name' property is the same, but the 'stolen' property is different.

Parameters

good Either a TradingGood or a string with the name of a good.
amount The amount of cargo that should be removed. If this is more than there is on the ship, all specified cargo will be removed.

Returns

nothing

function int... getBlocksByBox(Box box)

function int... getBlocksByOrientedBox(Box box, Matrix boxOrientation)

function int... getBlocksByRay(Ray ray, float t0, float t1)

function int... getBlocksBySphere(Sphere sphere)

function var, vec3 intersectRay(Ray ray, float t0, float t1)

function bool intersectsBox(Box box, var exceptionIndex)

function bool intersectsSphere(Sphere sphere, var exceptionIndex)

function var addSeat()

Adds a new seat.

Returns

nothing

function var addSeatSquad(int seatIndex, int fighterSquadIndex)

Adds a new fighter squad for a given seat.

Parameters

seatIndex The index of the seat (0-9)
fighterSquadIndex The index of the fighter squad (0-9)

Returns

nothing

function var addSeatWeaponGroup(int seatIndex, int weaponGroupIndex)

Adds a new weapon group for a given seat.

Parameters

seatIndex The index of the seat (0-9)
weaponGroupIndex The index of the weapon group (0-9)

Returns

nothing

function var driftToLocation(vec3 location)

Executes the button presses necessary to have the ship drift to the target location. Drifting to a location means using only thrusters and not the main engine. This function must be called every tick in order to work correctly.

Parameters

location The target location to drift towards.

Returns

nothing

function var flyToLocation(vec3 location, float velocityAtTarget)

Executes the button presses necessary to have the ship turn and fly to the target location. This function must be called every tick in order to work correctly.

Parameters

location The target location to fly towards
velocityAtTarget The physical velocity that the ship should have when arriving at its destination. Use real velocity (m/s) here, not desired velocity (0% - 100%)

Returns

nothing

function bitset<10> getActiveWeapons()

Returns a list of bools representing the currently active weapon groups.

function vec3 getAimedPositionBySeat(int seatIndex)

Returns the aimed position of a given seat.

Parameters

seatIndex The index of the seat

function vec3 getAimedPositionByWeaponGroup(int groupIndex)

Returns the aimed position of the seat that controls the given weapon group.

Parameters

groupIndex The weapon group of the seat

function vec3... getAimedPositions()

Returns a list of aimed positions of all seats

function int... getAllControlActions()

Returns a list of bitsets (represented as ints) of control actions of all seats.

function int getControlActions(int seatIndex)

Returns the bitset of control actions of a given seat.

Parameters

seatIndex The index of the seat

function int getControlActionsByWeaponGroup(int groupIndex)

Returns the bitset of control actions of the seat that controls the given weapon group.

Parameters

groupIndex The weapon group of the seat

function vec3 getFlownToLocation()

Returns the currently flown to location, which is set by calls to flyToLocation. Note: When the AI flies towards a location, it also sets this.

function int getSeatByWeaponGroup(int groupIndex)

Returns the seat that controls a particular weapon group.

Parameters

groupIndex The weapon group of the seat

function ControlUnitSeat... getSeats()

Returns a list of seats of the control unit.

function Entity getSelectedObject(int seatIndex)

Returns the selected object of a given seat.

Parameters

seatIndex The index of the seat

function uuid getSelectedObjectId(int seatIndex)

Returns the id of the selected object of a given seat.

Parameters

seatIndex The index of the seat

function uuid... getSelectedObjectIds()

Returns a list of selected target ids of all seats

function bool isFiring(int seat)

Checks if the given seat is currently pushing "Fire" (see ControlActionBit.Fire1)

function bool isFiringTorpedoes(int seat)

Checks if the given seat is currently pushing "Fire Torpedoes" (see ControlActionBit.Fire2)

function bool isPlayerAPilot(int playerIndex)

Checks if the given player is setting in any seat of the control unit.

Parameters

playerIndex The index of the player

function bool mayControlSquad(int playerIndex, int squadIndex)

Checks if the given player has the right to control the given fighter squad.

Parameters

playerIndex The index of the player
squadIndex The index of the squad

function bool mayControlWeaponGroup(int playerIndex, int groupIndex)

Checks if the given player has the right to control the given weapon group.

Parameters

playerIndex The index of the player
groupIndex The index of the weapon group

function bool maySteer(int playerIndex)

Checks if the given player has the right to pilot (steer) the ship. The player must be sitting in the pilot seat.

Parameters

playerIndex The index of the player

function var removeSeat(int seatIndex)

Removes the given seat. Seat 0 can't be removed.

Parameters

seatIndex The seat index between 1 and the amount of seats minus 1

Returns

nothing

function var setAimedPosition(vec3 location, int seatIndex)

Sets the current position that the non-independent turrets of the ship should aim at. This is, for example, what is set when the player aims.

Parameters

location The location that the turrets should aim at
seatIndex The seat that the position should be set for

Returns

nothing

function var setControlActions(int mask, int seatIndex)

Sets the current control actions of the ship. A control action is basically a virtual button that is pressed on the control unit.

Parameters

mask A bitset of buttons that are pressed (see ControlActionBit)
seatIndex The seat that the control actions should be set for

Returns

nothing

function var setDesiredVelocity(float desiredVelocity)

Sets the desired velocity of the ship. Desired velocity is measured from 0 (standstill) to 1 (maximum speed the ship can fly). The engine of the ship will accelerate normally until the desired velocity is reached. This will not influence boosting.

Parameters

desiredVelocity The desired velocity to use (0 to 1)

Returns

nothing

function var setKeyDownMask(int mask, int seatIndex)

Enables control actions of the ship. A control action is basically a virtual button that is pressed on the control unit. This function presses them (as in: pushes them down).

Parameters

mask A bitset of buttons that are pressed (see ControlActionBit)
seatIndex The seat that the control actions should be set for

Returns

nothing

function var setKeyUpMask(int mask, int seatIndex)

Disables control actions of the ship. A control action is basically a virtual button that is pressed on the control unit. This function releases them.

Parameters

mask A bitset of buttons that are released (see ControlActionBit)
seatIndex The seat that the control actions should be set for

Returns

nothing

function var setSelectedObjectId(Uuid location, int seatIndex)

Sets the current position that the non-independent turrets of the ship should aim at. This is, for example, what is set when the player aims.

Parameters

location The location that the turrets should aim at
seatIndex The seat that the position should be set for

Returns

nothing

function var setTurningSpeedFactor(vec3 factor)

Sets the current turning speed factor. The turning speed factor is a multiplier for the turning speed of a ship, used in flyToLocation(), to smoothen turning once the ship looks towards its target (to avoid jittering). It is set during flyToLocation(), so make sure to set it to (1, 1, 1) if you want to control the ship yourself.

Parameters

factor A vec3 containing the turning speed multipliers for axis x, y, z

Returns

nothing

function var stopShip()

Releases all buttons and sets the ship's desired velocity to 0.

Returns

nothing

function var stopSteering()

Releases all buttons but keeps the ship's desired velocity.

Returns

nothing

function bool dock(Entity dockee, var dockIndex)

Docks an Entity (dockee) to this Entity (parent), if the given dock is free. Note: This function doesn't dock the entity immediately, but during the upcoming update tick. If during the same tick another parent wants to dock the same dockee, the result which of the parents will actually dock the dockee is random. The dockee must be in position to be docked, otherwise this won't work.

Parameters

dockee The entity that is to be docked
dockIndex The index of the dock that is to be used. Use nil to use the first free dock.

Returns

true if the given dock is free (or a free dock was found), false otherwise.

function bool forceDock(Entity dockee, var dockIndex, var blockIndex, var look, var up)

Docks an Entity (dockee) to this Entity (parent), if the given dock is free. Note: This function doesn't dock the entity immediately, but during the upcoming update tick. If during the same tick another parent wants to dock the same dockee, the result which of the parents will actually dock the dockee is random.

Parameters

dockee The entity that is to be docked
dockIndex The index of the dock that is to be used. Use nil to use the first free dock.
blockIndex The index of the block on the other ship that is to be docked. If nil, uses the outermost block on the side that will be docked.
look The look direction of the object to dock. If nil, will use the parent's direction. This direction must be in local space of the parent object. You can either use a vec3, an ivec3, or a string indicating the direction, such as "x" or "-y".
up The up direction of the object to dock. If nil, will use the parent's direction. This direction must be in local space of the parent object. You can either use a vec3, an ivec3, or a string indicating the direction, such as "x" or "-y".

Returns

true if the given dock is free (or a free dock was found), false otherwise.

function Uuid... getDockedEntities()

function table_t getDocks()

function bool isDocked(var entity)

Checks if another entity is physically docked.

Parameters

entity The entity to check. Can be a Uuid, (uuid-)string or Entity.

Returns

true if physically docked, false otherwise.

function bool undock(Entity dockee)

Undocks an Entity (dockee) from this Entity (parent), if docked. Note: This function doesn't undock the entity immediately, but during the upcoming update tick.

Parameters

dockee The entity that is to be undocked
Overview
Home Functions Search
Search:
Callbacks
Callbacks Alliance [Client] Callbacks Alliance [Server] Callbacks Alliance [Server] Callbacks Entity Callbacks Galaxy Callbacks Player Callbacks Player [Client] Callbacks Sector Callbacks Server Callbacks
Predefined Functions & Example Scripts
Command Entity FactionDatabase PlanGenerator Player Sector Server UsableInventoryItem
Common Components
Boarding BspTree CargoBay CargoLoot ControlUnit CrewComponent DeletionTimer DirectFlightPhysics DockingClamps DockingParent DockingPositions Durability EnergySystem Engine FighterAI Hangar HyperspaceEngine InteractionText InventoryItemLoot Owner Physics Plan ReadOnlyBoarding ReadOnlyBspTree ReadOnlyCargoBay ReadOnlyControlUnit ReadOnlyCrew ReadOnlyDeletionTimer ReadOnlyEnergySystem ReadOnlyEngine ReadOnlyFighterAI ReadOnlyHangar ReadOnlyHyperspaceEngine ReadOnlyInteractionText ReadOnlyOwner ReadOnlyPhysics ReadOnlyPlan ReadOnlyShipAI ReadOnlyShipSystem ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoLauncher ReadOnlyTurretBases ReadOnlyVelocity ReadOnlyWeapons ReadOnlyWormHole Shield ShipAI ShipSystem StructuralIntegrity SystemUpgradeLoot Thrusters Torpedo TorpedoAI TorpedoLauncher Turret TurretAI TurretBases Velocity Weapons WormHole
Common Objects
AllianceMember AllianceRank BlockPlan BlockPlanBlock BlockStatistics Box Captain Color ControlUnitSeat CraftDesign CraftStatsOverview Crew CrewMan CrewProfession DebugInfo dvec2 dvec3 dvec4 Entity EntityDescriptor FighterTemplate Format GameSettings Group HighResolutionTimer Inventory InventoryTurret ivec2 ivec3 ivec4 Language Mail Material Matrix ModManager NamedFormat PlanBspTree PlanetSpecifics PlanGenerationStage PlanPart PlanStyle PlayerId PluralForm Profiler QuadTree Random Rarity Ray ReadOnlyEntity Rect Relation Scenario SectorView Seed Sphere Squad SystemUpgradeTemplate Timer Tooltip TooltipLine TorpedoShaft TorpedoTemplate TradingGood TurretDesign TurretDesignPart TurretTemplate UsableInventoryItem Uuid VanillaInventoryItem vec2 vec3 vec4 Version Weapon
Client Components
EntityIcon EntityTooltip PlanMesh ReadOnlyIcon ReadOnlyPlanMesh ReadOnlyScriptUI ReadOnlyTooltip ScriptUI
Client Objects
Achievements Alliance [Client] CameraKeyFrame CaptainSelectionItem Client ClientSettings ColorSelectionItem CraftDesignSelectionItem Faction [Client] Galaxy [Client] GalaxyMap GameInput GlowFX IconSelectionItem InputWindow InventoryReferenceSelectionItem InventorySelectionItem Keyboard LaserFX Mouse Music PixelIconSelectionItem Planet Player [Client] PlayerWindow RefractionFX Sector [Client] SelectionItem ShipDatabaseEntry [Client] SoundSource StrategyState TargetIndicator TooltipRenderer TurretDesignSelectionItem
Client UI Objects
AllianceEmblem AllianceTab ArrowLine Button [Client] [Client] Button [Client] [Client] CaptainIcon CaptainProfile CheckBox ComboBox ContextMenu CraftPortrait CrewBar Frame Hud InventorySelection Label Line ListBox ListBoxEx MapArrowLine MapIcon MultiLineTextBox NumbersBar Picture PlanDisplayer ProgressBar SavedDesignsSelection ScrollFrame Selection ShipWindow Slider StatisticsBar Tab TabbedWindow TextBox TextField TooltipDisplayer Tree UIArbitraryHorizontalSplitter UIArbitraryVerticalSplitter UIContainer UIElement UIGridSplitter UIHorizontalLister UIHorizontalMultiSplitter UIHorizontalSplitter UIOrganizer UIRect UIRenderer UIVerticalLister UIVerticalMultiSplitter UIVerticalSplitter ValueComboBox Window
Server Components
EntityTransferrer FighterController Loot ReadOnlyEntityTransferrer ReadOnlyFighterController ReadOnlyLoot ReadOnlyTurretController ReadOnlyWreckageCreator TurretController WreckageCreator
Server Objects
Alliance [Server] Faction [Server] Galaxy [Server] Player [Server] ReadOnlySector Sector [Server] Server ShipDatabaseEntry [Server]
Enums
AIState AlliancePrivilege BeamShape BlockShading BlockStructure BlockType BlockType2 BoxType BuildError CaptainGenderId ChatChannel ChatMessageType ComponentType ControlAction ControlActionBit ControlStyle CoolingType CraftStatsOverviewStat CrewProfessionType CrewRank DamageSource DamageType DeletionType Difficulty EntityArrivalType EntityType FighterOrders FighterStartError FighterType FontType ImpactParticles InventoryItemType JumpError KeyboardKey ListBoxEntryType MalusReason MaterialType MoonType MouseButton PlanetType PlayerStateType ProjectileShape RarityType RelationStatus SavedDesignType ScenarioType SectorChangeType ShipAvailability SoundType StatsBonuses TargetIndicatorVisuals TransformationFeature TurretAutoFireMode TurretSlotType WeaponAppearance WeaponCategory

This is the official documentation for the scripting API of Avorion. This documentation is automatically generated and not necessarily complete. Depending on the context in which functions exist, some documentation such as descriptions, return values or variable names or types may be missing.

Work in Progress. Documentation of Avorion Version: 2.5.2 e97532556063