Avorion Script API Documentation
ReadOnlyEntity
function ReadOnlyEntity(var id)
Parameters
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 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 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 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 string name | [read-only] |
| property var numCargos | [read-only] |
| property int numDefenseWeapons | [read-only] |
| property int numDefenseWeaponsCurrentAttack | [read-only] |
| property var numTurrets | [read-only] |
| property var occupiedCargoSpace | [read-only] |
| property Matrix orientation | [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 vec3 right | [read-only] |
| property var selectedObject | [read-only] |
| property double shieldDurability | [read-only] |
| property double shieldMaxDurability | [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
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
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 TradingGood, int... getCargo(unsigned int n)
function var 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
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 vec3... getDockingPositions()
Lists all docking positions that the entity has
Returns
A list of vec3s where every 2 values represent a dock. The first value is the local position, the second value is the local direction of the 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 var getNearestDistance(Entity other)
function var getNumArmedTurrets()
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 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
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 isDocked(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
function int jumpPossible(int x, int y)
Tests if the entity can jump to the specified coordinates
Parameters
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)
Callbacks Alliance [Client] Callbacks Alliance [Server] Callbacks Alliance [Server] Callbacks Entity Callbacks Galaxy Callbacks Player Callbacks Player [Client] Callbacks Sector Callbacks Server Callbacks
Command Entity FactionDatabase PlanGenerator Player Sector Server UsableInventoryItem
Boarding BspTree CargoBay ControlUnit DeletionTimer DirectFlightPhysics DockingPositions Durability EnergySystem Engine FighterAI Hangar InteractionText Owner Physics Plan ReadOnlyBoarding ReadOnlyBspTree ReadOnlyCargoBay ReadOnlyControlUnit ReadOnlyDeletionTimer ReadOnlyEnergySystem ReadOnlyEngine ReadOnlyFighterAI ReadOnlyHangar ReadOnlyInteractionText ReadOnlyOwner ReadOnlyPhysics ReadOnlyPlan ReadOnlyShipAI ReadOnlyShipSystem ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoLauncher ReadOnlyTurretBases ReadOnlyVelocity ReadOnlyWeapons ReadOnlyWormHole Shield ShipAI ShipSystem SystemUpgradeLoot Thrusters Torpedo TorpedoAI TorpedoLauncher Turret TurretAI TurretBases Velocity Weapons WormHole
AllianceMember AllianceRank BlockPlan BlockPlanBlock BlockStatistics Box Color ControlUnitSeat CraftDesign Crew CrewMan CrewProfession DebugInfo dvec2 dvec3 dvec4 Entity EntityDescriptor FighterTemplate Format GameSettings 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 SectorView Seed Sphere SystemUpgradeTemplate Timer Tooltip TooltipLine TorpedoTemplate TradingGood TurretDesign TurretDesignPart TurretTemplate UsableInventoryItem Uuid VanillaInventoryItem vec2 vec3 vec4 Version Weapon
EntityIcon EntityTooltip PlanMesh ReadOnlyIcon ReadOnlyPlanMesh ReadOnlyScriptUI ReadOnlyTooltip ScriptUI
Achievements Alliance [Client] ClientSettings CraftDesignSelectionItem Faction [Client] Galaxy [Client] GalaxyMap GameInput InputWindow InventoryReferenceSelectionItem InventorySelectionItem Keyboard LaserFX Mouse Music Planet Player [Client] PlayerWindow Sector [Client] SelectionItem SoundSource TooltipRenderer TurretDesignSelectionItem
AllianceTab ArrowLine Button [Client] [Client] Button [Client] [Client] CheckBox ComboBox CraftPortrait Frame Hud InventorySelection Label Line ListBox ListBoxEx MapArrowLine MultiLineTextBox NumbersBar Picture PlanDisplayer ProgressBar SavedDesignsSelection ScrollFrame Selection ShipWindow Slider StatisticsBar Tab TabbedWindow TextBox TextField Tree UIArbitraryHorizontalSplitter UIArbitraryVerticalSplitter UIContainer UIElement UIGridSplitter UIHorizontalLister UIHorizontalMultiSplitter UIHorizontalSplitter UIOrganizer UIRect UIRenderer UIVerticalLister UIVerticalMultiSplitter UIVerticalSplitter ValueComboBox Window
EntityTransferrer FighterController Loot ReadOnlyEntityTransferrer ReadOnlyFighterController ReadOnlyLoot ReadOnlyTurretController ReadOnlyWreckageCreator TurretController WreckageCreator
Alliance [Server] Faction [Server] Galaxy [Server] Player [Server] ReadOnlySector Sector [Server] Server
AIState AlliancePrivilege BeamShape BlockShading BlockType BoxType ChatChannel ChatMessageType ComponentType ControlAction ControlActionBit CoolingType CrewProfessionType DamageSource DamageType DeletionType Difficulty EntityArrivalType EntityType FighterOrders FighterStartError FighterType FontType ImpactParticles InventoryItemType KeyboardKey ListBoxEntryType MalusReason MaterialType MoonType MouseButton PlanetType PlayerStateType ProjectileShape RarityType RelationStatus SavedDesignType SectorChangeType SoundType StatsBonuses TransformationFeature TurretAutoFireMode 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: 1.0 r22021 59065310fc1a