Avorion Script API Documentation

BlockPlan

function BlockPlan()

This is the default constructor of BlockPlan. No further arguments are required.

Returns

A new instance of BlockPlan

property bool accumulatingHealth
property vec3 centerOfMass[read-only]
property bool convex
property double durability[read-only]
property double mass[read-only]
property int numBlocks[read-only]
property double processingPower[read-only]
property float radius[read-only]
property BlockPlanBlock root[read-only]
property var rootIndex[read-only]
property double volume[read-only]

function int addBlock(vec3 position, vec3 size, int parentIndex, int index, Color color, Material material, Matrix orientation, int blockIndex, var secondaryColor)

Add a new block to an existing plan.

Parameters

position The position of the new
size The size of the new block
parentIndex The parent index of the block the new block will be attached to. This parameter will be ignored when there are no blocks in the plan.
index The index of the new block. Use -1 to assign an index automatically (recommended)
color The color of the new block
material The material of the new block
orientation The orientation of the new block
blockIndex The type of the new block, must be a valid block type. See enum BlockType

Returns

Returns the index of the new block on success, nil otherwise.

function var addPlan(int parentIndex, BlockPlan other, int otherBlock)

function var addPlanDisplaced(int parentIndex, BlockPlan other, int otherBlock, vec3 delta)

function var center()

Returns

nothing

function var deleteSubTree(int index)

Returns

nothing

function var displace(vec3 displacement)

Returns

nothing

function BlockPlan... divide(int blockIndex)

function bool empty()

function bool exists(int index)

function var forceMaterial(Material material)

Changes the material of all blocks to the given material. Blocks with an invalid block type for the material get changed to blank hull.

Parameters

material The new material

Returns

nothing

function BlockPlanBlock getBlock(int index)

function int... getBlockIndices()

function int getBlockType(int index)

function Box getBoundingBox()

function Sphere getBoundingSphere()

function double getMoneyValue()

function BlockPlanBlock getNthBlock(int n)

function var getNthIndex(int n)

function double... getResourceValue()

function BlockStatistics getStats()

function double getUndamagedMoneyValue()

function double... getUndamagedResourceValue()

function var mirror(vec3 axis, vec3 mirrorCenter)

Returns

nothing

function bool propertiesEqual(BlockPlan other)

function var reassignParents(var This)

Reassigns parents of blocks depending on their overlap Use this after sloppily creating a blockplan (ie. when you attached all blocks to the root block, even though they don't overlap)

Parameters

This function prints errors if it failed. You can pass an ID for the error, that will printed out so you can identify it.

Returns

nothing

function var removeBlock(int index)

Removes a block from the plan. This function will try to reassign parents where possible to ensure that the tree doesn't break in positions where blocks still intersect with each other.

Parameters

index The index of the block that is to be removed

Returns

nothing

function var resetDurability()

Returns

nothing

function var rotate(vec3 axis, int dir)

Returns

nothing

function var scale(vec3 factor)

Returns

nothing

function var setBlockColor(int index, Color color)

Returns

nothing

function var setBlockType(int index, int blockTypeIndex)

Returns

nothing

function var setColor(Color in)

Returns

nothing

function var setMaterial(Material material)

Changes the material of all blocks to the given material if the new combination of block type and material is allowed. Blocks that don't exist in the given material are left unchanged.

Parameters

material The new material

Returns

nothing

function var setMaterialTier(Material material)

Changes the material of all blocks to the given material if the new combination of block type and material is allowed. The remaining blocks get changed to either the highest allowed material below the given one or the lowest one above.

Parameters

material The new material

Returns

nothing

function var setSecondaryBlockColor(int index, Color color)

Returns

nothing

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