Avorion Script API Documentation

ReadOnlyEntity ReadOnlyEntity

Properties
aiOwned
allianceOwned
canPassRifts
controlActions
crew
crewSize
damageMultiplier
desiredVelocity
dockable
dockingParent
durability
excludedPlayer
exclusionTime
factionIndex
fighterCargoPickup
firePower
freeCargoSpace
hasPilot
hyperspaceCooldown
hyperspaceJumpReach
id
idealCrew
index
invincible
isAnomaly
isArmedTurret
isAsteroid
isContainer
isDrone
isFighter
isFlyable
isLoot
isObviouslyMineable
isOther
isShieldActive
isShip
isStation
isTurning
isTurret
isUnarmedTurret
isUnknown
isWormHole
isWreckage
look
mass
maxCargoSpace
maxCrewSize
maxDurability
minCrew
mothership
name
numCargos
numDefenseWeapons
numDefenseWeaponsCurrentAttack
numDockingPositions
numTurrets
occupiedCargoSpace
orientation
playerOrAllianceOwned
playerOwned
position
radius
reservationTime
reservedPlayer
right
selectedObject
shieldDurability
shieldMaxDurability
shieldMeshIntensity
size
timeAlive
title
translatedTitle
translation
translationf
transporterRange
type
typename
up
volume

Member Functions
canAddCrew
findCargos
getAimedPositionBySeat
getAimedPositions
getAllowedArbitraryTurrets
getAllowedArmedTurrets
getAllowedUnarmedTurrets
getAttachedBlockIndex
getBoostedValue
getBoundingBox
getBoundingSphere
getCaptain
getCargo
getCargoAmount
getCargos
getCrewMembers
getDamageContributorPlayerFactions
getDamageContributorPlayers
getDamageContributors
getDockedGroupBoundingBox
getDockedGroupBoundingSphere
getDockingPositions
getFreeArbitraryTurrets
getFreeArmedTurrets
getFreeUnarmedTurrets
getFullPlanCopy
getLowestMineableMaterial
getMalusFactor
getMineableMaterial
getMineableResources
getMoneyLootAmount
getNearestDistance
getNumArmedTurrets
getNumMiningTurrets
getNumSalvagingTurrets
getNumUnarmedTurrets
getPilotIndices
getPlanMoneyValue
getPlanResourceValue
getResourceLootAmount
getScripts
getTitleArguments
getTitleFormat
getTurret
getTurrets
getTurretSize
getTurretTemplateSize
getTurretTurningSpeed
getUndamagedPlanMoneyValue
getUndamagedPlanResourceValue
getValue
getValues
hasComponent
hasScript
hyperspaceBlocked
isCollectable
isInDockingArea
isInsideShield
isJumpRouteValid
isManned
isTurretAllowed
jumpPossible
resolveScriptPath

ReadOnlyEntity

function ReadOnlyEntity(var id)

Parameters

id The id of the entity, must be an id of an existing entity

Returns

A new instance of ReadOnlyEntity

property bool aiOwned[read-only]
property bool allianceOwned[read-only]
property bool canPassRifts[read-only]
property int controlActions[read-only]
property Crew crew[read-only]
property var crewSize[read-only]
property float damageMultiplier[read-only]
property float desiredVelocity[read-only]
property bool dockable[read-only]
property Uuid dockingParent[read-only]
property double durability[read-only]
property int excludedPlayer[read-only]
property int exclusionTime[read-only]
property int factionIndex[read-only]
property bool fighterCargoPickup[read-only]
property double firePower[read-only]
property var freeCargoSpace[read-only]
property bool hasPilot[read-only]
property float hyperspaceCooldown[read-only]
property float hyperspaceJumpReach[read-only]
property Uuid id[read-only]
property Crew idealCrew[read-only]
property Uuid index[read-only]
property bool invincible[read-only]
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[read-only]
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[read-only]
property string name[read-only]
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[read-only]
property bool playerOrAllianceOwned[read-only]
property bool playerOwned[read-only]
property Matrix position[read-only]
property var radius[read-only]
property float reservationTime[read-only]
property int reservedPlayer[read-only]
property var selectedObject[read-only]
property double shieldDurability[read-only]
property double shieldMaxDurability[read-only]
property float shieldMeshIntensity[read-only]
property vec3 size[read-only]
property var timeAlive[read-only]
property string title[read-only]
property var translatedTitle[read-only]
property dvec3 translation[read-only]
property vec3 translationf[read-only]
property double transporterRange[read-only]
property int type[read-only]
property string typename[read-only]
property vec3 up[read-only]
property var volume[read-only]

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

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:

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 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 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 hyperspaceBlocked()

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 resolveScriptPath(string path)

Overview
Home Functions Search
Search:

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.7 c8e4beec84f7