Avorion Script API Documentation
PlanPart
function PlanPart()
Returns
A new instance of PlanPart
property int... allrounders |
property int... features |
property int numBlocks | [read-only] |
property Box othersPaddingBox |
property Box paddingBox | [write-only] |
property Box selfPaddingBox |
property var... symmetries |
property TransformationFeature... transformationFeatures |
function int block(int parentIndex, var directionOrPosition, int blockType, vec3 [or nil] size, var color, Matrix [or nil] orientation, var secondaryColor)
Adds a new block to the part.
Parameters
directionOrPosition Direction the block is attached in. Can be a vec3 or a direction. A position must be passed as a vec3 and will be clamped so the new block and parent block touch each other. A direction can be passed as a string ("x", "-x", "px", "nx", "+x" etc.), an ivec3, or an int (-x = 0, +x = 1, -y = 2, +y = 3, -z = 4, +z = 5)
blockType The BlockType of the new block
size The size of the new block. If nil, the size of the parent will be used
color The color of the new block. Can be passed as a Color type, a table with HSV values {h=1, s=1, v=1}, a table with RGB values {r=1, g=1, b=1}, a vec4 (will be interpreted as RGBA), a vec3 (will be interpreted as RGB), or as a number (will be interpreted as a hex int). If nil, color of the parent block will be used.
orientation A matrix containing the orientation of the block. If nil, the identity matrix will be used.
secondaryColor The color of the new block. Similar to color. If nil, ColorNone() will be used.
Returns
The index of the new block
function var connector(int blockIndex, var direction, table_t flags)
Adds a new connector to the part. Connectors are used to attach parts during the generation process. Connectors are always in the middle of a block. No 2 connectors in the same direction can exist on the same block.
Parameters
direction Direction of the connector. A direction can be passed as a string ("x", "-x", "px", "nx", "+x" etc.), an ivec3, or an int (-x = 0, +x = 1, -y = 2, +y = 3, -z = 4, +z = 5)
flags Optional table with flags: {mirror = "x", repeatable = true, featureWhitelist = {...}, featureBlacklist = {...}, out = true, in = true}
flags.mirror: Direction that connector should mirror in. All subsequent parts added to this connector will have the same mirror direction.
flags.out: Counterpart to "inOnly". Mutually exclusive. Connector is only used when the part was already attached to the plan. It cannot be used to attach the part itself to the plan.
flags.inOnly: Counterpart to "out". Mutually exclusive. Connector is only used to attach the part to the plan. It cannot be used to other, subsequent parts to this part.
flags.repeatable: Allows the part to repeat itself at this connector. See PlanGenerationStage docs for more details.
flags.featureWhitelist: An array-style table containing features. Only parts with the herein defined features can be added to this connector.
flags.featureBlacklist: An array-style table containing features. Only parts without the herein defined features can be added to this connector.
Returns
nothing
function var erase(int blockIndex, var direction)
Erases a block or connector
Parameters
direction Optional. If set, tries to erase a connector from the block into the direction. If nil, the block is erased.
Returns
nothing
function BlockPlanBlock getBlock(int index)
Finds a block.
Parameters
Returns
BlockPlanBlock The block, or nil if not found
function int... getBlocks(int... types)
Gathers all blocks of certain types.
Parameters
Returns
A table containing the found blocks.
function table_t... getConnectors()
Returns
Returns a table with all connectors of the part
function BlockPlan getPlan()
returns the internal plan of the part
function int... merge(int... blocks)
Merges blocks, similar to the building mode command.
Parameters
Returns
multiple return values: All block indices that remain of the blocks passed into the function
function var mirror(var axis)
Mirrors the entire part along an axis.
Parameters
Returns
nothing
function var resize(int blockIndex, var x, var y, var z)
Resizes a block
Parameters
x The x scale factor
y The y scale factor
z The z scale factor
Returns
nothing
function var rotate(var axis, int times)
Rotates the entire part around an axis X times by 90 degrees.
Parameters
times The amount of times the part should be rotated. Can be -2, -1, 1, 2
Returns
nothing
function var scale(vec3 factor)
Scales the entire part.
Parameters
Returns
nothing
function var setConnectorFlags(int blockIndex, var direction, table_t flags)
Sets the flags of a connector. Note: internally calls erase() and then connector()
Parameters
direction The direction of the connector
flags The new flags of the connector. See connector() function for details on those
Returns
nothing
function var setPlan(BlockPlan plan)
Sets the entire plan of the part.
Parameters
Returns
nothing
function var transform(int blockIndex, table_t flags)
Changes some properties of the given block.
Parameters
flags Flags table containing the changes of the block. If nil, this property of the part isn't changed: {type = BlockType.Hull, lower = vec3(...), upper = vec3(...), position = vec3(...), size = vec3(...), color = ..., orientation = Matrix()}
flags.type: The new type of the part
flags.lower, flags.upper: vec3s containing the new lower, upper dimensions of the block. Do not use together with position, size
flags.position, flags.size: vec3s containing the new position, size dimensions of the block. Do not use together with lower, upper
flags.color: The new color of the block. See block() for details on how to pass colors
flags.orientation: Matrix containing the new orientation of the block
Returns
nothing
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 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
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
EntityIcon EntityTooltip PlanMesh ReadOnlyIcon ReadOnlyPlanMesh ReadOnlyScriptUI ReadOnlyTooltip ScriptUI
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
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
EntityTransferrer FighterController Loot ReadOnlyEntityTransferrer ReadOnlyFighterController ReadOnlyLoot ReadOnlyTurretController ReadOnlyWreckageCreator TurretController WreckageCreator
Alliance [Server] Faction [Server] Galaxy [Server] Player [Server] ReadOnlySector Sector [Server] Server ShipDatabaseEntry [Server]
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.7 c8e4beec84f7