Skip to content

Instantly share code, notes, and snippets.

@PrincessOfEvil
Forked from Silverfeelin/animator.md
Created August 13, 2019 16:25
Show Gist options
  • Save PrincessOfEvil/a030b735a8442a25aa8bf803780c7527 to your computer and use it in GitHub Desktop.
Save PrincessOfEvil/a030b735a8442a25aa8bf803780c7527 to your computer and use it in GitHub Desktop.
Starbound 1.4 new Lua functions

Json animator.transformPoint(String partName, Vec2F point)

Applies the specified part's transformation on the given point.


Json animator.transformPoly(String partName, PolyF poly)

Applies the specified part's transformation on the given poly.

void celestial.flyShip(Vec3I system, SystemLocation destination)

Flies the player ship to the specified SystemLocation in the specified system.

SystemLocation is either of the following types: Null, CelestialCoordinate, Object, Vec2F

The locations are specified as a pair of type and value

local system = celestial.currentSystem().location
local location = nil -- Null
location = {"coordinate", {location = system, planet = 1, satellite = 0}} -- CelestialCoordinate
location = {"object", "11112222333344445555666677778888"} -- Object (UUID)
location = {0.0, 0.0} -- Vec2F (position in space)
celestial.flyShip(system, location)
  • Renamed from celestial.skyFlying.

WorldId celestial.objectWarpActionWorld(Uuid uuid)

Returns the warp action world ID for the specified object.


Json celestial.objectOrbit(Uuid uuid)

Returns the orbit of the specified object, if any.


Maybe<Vec2F> celestial.objectPosition(Uuid uuid)

Returns the position of the specified object, if any.


Json celestial.objectTypeConfig(String typeName)

Returns the configuration of the specified object type.


Uuid celestial.systemSpawnObject(String typeName, [Vec2F position], [Uuid uuid], [Json parameters])

Spawns an object of typeName at position. Optionally with the specified UUID and parameters.

If no position is specified, one is automatically chosen in a spawnable range.

  • Position is optional.

Maybe<bool> celestial.hasChildren(CelestialCoordinate coordinate)

Returns definitively whether the coordinate has orbiting children. nil return means the coordinate is not loaded.


List<int> celestial.childOrbits(CelestialCoordinate coordinate)

Returns the child orbits for the specified celestial coordinate.


List<CelestialCoordinate> celestial.scanSystems(RectI region, [Set<String> includedTypes])

Returns a list of systems in the given region. If includedTypes is specified, this will return only systems whose typeName parameter is included in the set. This scans for systems asynchronously, meaning it may not return all systems if they have not been generated or sent to the client. Use scanRegionFullyLoaded to see if this is the case.

  • New parameter includedTypes.
  • Now accessible from active item scripts.

Json player.getProperty(String name, Json default)

Returns the value assigned to the specified generic player property. If there is no value set, returns default.


void player.setProperty(String name, Json value)

Sets a generic player property to the specified value.


void player.addScannedObject(String name)

Adds the specified object to the player's scanned objects.


void player.removeScannedObject(String name)

Removes the specified object from the player's scanned objects.


bool player.hasAcceptedQuest(String questId)

Returns true if the player has accepted a quest (which may be active, completed, or failed) with the specified quest id and false otherwise.


bool player.hasActiveQuest(String questId)

Returns true if the player has a currently active quest with the specified quest id and false otherwise.


Maybe<WorldId> player.currentQuestWorld()

If the player's currently tracked quest has an associated world, returns the id of that world.


List<pair<WorldId, bool>> player.questWorlds()

Returns a list of world ids for worlds relevant to the player's current quests, along with a boolean indicating whether that quest is tracked.


Maybe<Json> player.currentQuestLocation()

If the player's currently tracked quest has an associated location (CelestialCoordinate, system orbit, UUID, or system position) returns that location.


List<pair<Json, bool>> player.questWorlds()

Returns a list of locations for worlds relevant to the player's current quests, along with a boolean indicating whether that quest is tracked.


void player.hasCompletedMission(String missionName)

Returns whether the player has completed the specified mission.


List<Json> player.teleportBookmarks()

Lists all of the player's teleport bookmarks.

Json root.monsterParameters(String monsterType, [uint64_t seed])

Returns the parameters for a monster type.

  • Added optional parameter seed.

ActorMovementParameters root.monsterMovementSettings(String monsterType, [uint64_t seed])

Returns the configured base movement parameters for the specified monster type.

  • Added optional parameter seed.

void pane.addWidget(Json widgetConfig, [String widgetName])

Creates a new widget with the specified config and adds it to the pane, optionally with the specified name.


void pane.removeWidget(String widgetName)

Removes the specified widget from the pane.

bool status.uniqueStatusEffectActive(String effectName)

Returns true if the specified unique status effect is currently active and false otherwise.

void widget.addChild(String widgetName, Json childConfig, [String childName])

Creates a new child widget with the specified config and adds it to the specified widget, optionally with the specified name.


void widget.removeAllChildren(String widgetName)

Removes all child widgets of the specified widget.


void widget.removeChild(String widgetName, String childName)

Removes the specified child widget from the specified widget.

Tuple<Maybe<Vec2F>, Maybe<Vec2F>> world.lineCollision(Vec2F startPoint, Vec2F endPoint, [CollisionSet collisionKinds])

If the line between the specified points overlaps any generated collision geometry of the specified collision kinds, returns the point at which the line collides, or nil if the line does not collide. If intersecting a side of the poly, also returns the normal of the intersected side as a second return.

  • Return value changed.

float world.surfaceLevel()

Returns the surface layer base height.


bool world.damageTiles(List<Vec2I> positions, String layerName, Vec2F sourcePosition, String damageType, float damageAmount, [unsigned harvestLevel], [EntityId sourceEntity])

Damages all tiles in the specified layer and positions by the specified amount. The source position of the damage determines the initial direction of the damage particles. Damage types are: "plantish", "blockish", "beamish", "explosive", "fire", "tilling". Harvest level determines whether destroyed materials or mods will drop as items. Returns true if any damage was done and false otherwise.

  • New parameter sourceEntity.

bool world.damageTileArea(Vec2F center, float radius, String layerName, Vec2F sourcePosition, String damageType, float damageAmount, [unsigned harvestLevel, [EntityId sourceEntity)

Identical to world.damageTiles but applies to tiles in a circular radius around the specified center point.

  • New parameter sourceEntity.

List<Vec2I> world.radialTileQuery(Vec2F position, float radius, String layerName)

Returns a list of existing tiles within radius of the given position, on the specified tile layer.


Vec2F world.entityMetaBoundBOx(EntityId entityId)

Returns the meta bound box of the entity, if any.


Maybe<List<MaterialId>> world.biomeBlocksAt(Vec2I position)

Returns the list of biome specific blocks that can place in the biome at the specified position.


Json world.getNpcScriptParameter(EntityId entityId, String parameterName, [Json defaultValue])

Returns the value of the specified NPC's variant script config parameter, or defaultValue or nil if the parameter is not set or the entity is not an NPC.


Promise<Vec2I> world.enqueuePlacement(List<Json> distributionConfigs, [DungeonId id])

Enqueues a biome distribution config for placement through world generation. The returned promise is fulfilled with the position of the placement, once it has been placed.


void world.placeDungeon(String dungeonName, Vec2I position, [DungeonId dungeonId])

Generates the specified dungeon in the world at the specified position. Does not ignore anchoring rules, will fail if the dungeon can't be placed. If a dungeon id is specified, it will be assigned to the dungeon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment