Last active
May 22, 2022 22:08
-
-
Save jordoh/7864154 to your computer and use it in GitHub Desktop.
Starbound lua API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Stubs for entity.* callbacks defined in C++. | |
-- | |
-- DO NOT INCLUDE this file in your scripts, it is for documentation purposes only. | |
-- | |
-- Entity callbacks query and mutate the specific entity that is running the | |
-- lua script. They can be called from a _different_ entity using | |
-- world.callScriptedEntity(targetEntityId, "entity.*"), replacing "*" with the | |
-- name of a function defined below. | |
-- | |
-- Specific types of entities (e.g. NPCs, Objects) define different sets of | |
-- entity.* functions - if a function is only defined for a specific entity | |
-- type, it will be indicated in the function's comment below. | |
-- | |
entity = { | |
--- Gets a numeric id that can be used to identify this specific entity until it is unloaded | |
-- @returns Numeric (integer) entity id | |
id = function() end, | |
--- Gets the entity's current world position | |
-- @returns Table { x, y } representing position | |
position = function() end, | |
--- Gets the entity's damage team | |
-- Damage teams control which other entities can be damaged by this entity. | |
-- @returns Table (map) of: { type = <numeric>, team = <numeric> } | |
damageTeam = function() end, | |
--- Gets the entity id of the closest valid target entity | |
-- Note that "valid target entities" are defined as entities that can be | |
-- damaged (based on damage teams); and are players, NPCs, or aggressive | |
-- monsters | |
-- @param radius Maximum distance a valid target can be from this entity's position | |
-- @returns entity id of the closest target, or 0 if there is no valid target | |
-- entity within the given range | |
closestValidTarget = function(radius) end, | |
--- Determines whether the given entity is a valid target of this entity. | |
-- Note that "valid target entities" are defined as entities that can be | |
-- damaged (based on damage teams); and are players, NPCs, or aggressive | |
-- monsters | |
-- @param entityId the id of the potential valid target entity | |
-- @returns true if the given entity is a valid target, false otherwise | |
isValidTarget = function(entityId) end, | |
--- Gets the vector from this entity's position to the given entity's position | |
-- @param entityId entity to get a vector to | |
-- @returns { x, y } vector from this entity to the given entity, or { 0, 0 } | |
-- if no entity exists with the given entity id | |
distanceToEntity = function(entityId) end, | |
--- Determines if the given entity is in sight to this entity | |
-- Note that "in sight" is defined as not having solid collision | |
-- intersecting the line between the entities' positions | |
-- @param entityId the id of the entity to check for line of sight on | |
-- @returns true if the entity is in sight, false otherwise | |
entityInSight = function(entityId) end, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Stubs for global functions monster scripts can define, which will be called by C++ | |
--- Called once when the monster is initialized | |
function init() end | |
--- Update loop handler, called once every scriptDelta (defined in *.monstertype) ticks | |
function main() end | |
--- Called when the monster has died and is about to be removed | |
function die() end | |
--- Called after the NPC has taken damage | |
-- @param args Table (map) of info about the damage, structured as: | |
-- { | |
-- sourceId = <entity id of entity that caused the damage>, | |
-- damage = <numeric amount of damage that was taken>, | |
-- sourceDamage = <numeric amount of damage that was originally dealt>, | |
-- sourceKind = <string kind of damage being applied, as defined in "damageKind" value in a *.projectile config> | |
-- } | |
-- Note that "sourceDamage" can be higher than "damage" if - for | |
-- instance - some damage was blocked by a shield. | |
function damage(args) end | |
--- Called when the monster's health has been depleted to determine if the monster can die | |
-- @returns true if the monster can die, false to keep the monster alive (with zero health) | |
function shouldDie() end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Stubs for global functions NPC scripts can define, which will be called by C++ | |
--- Called once when the NPC is initialized | |
function init() end | |
--- Update loop handler, called once every scriptDelta (defined in *.npctype) ticks | |
function main() end | |
--- Called when the npc has died and is about to be removed | |
function die() end | |
--- Called after the NPC has taken damage | |
-- @param args Table (map) of info about the damage, structured as: | |
-- { | |
-- sourceId = <entity id of entity that caused the damage>, | |
-- damage = <numeric amount of damage that was taken>, | |
-- sourceDamage = <numeric amount of damage that was originally dealt>, | |
-- sourceKind = <string kind of damage being applied, as defined in "damageKind" value in a *.projectile config> | |
-- } | |
-- Note that "sourceDamage" can be higher than "damage" if - for | |
-- instance - some damage was blocked by a shield. | |
function damage(args) end | |
--- Called when the NPC is interacted with (e.g. by a player) | |
-- | |
-- @param args Table (map) of interaction event arguments: | |
-- sourceId -> Entity id of the entity interacting with this NPC | |
-- sourcePosition -> The {x,y} position of the interacting entity | |
-- | |
-- @returns nil, or a string describing an interaction response, or a table | |
-- (array) of { <interaction response string>, <interaction response config table (map)> } | |
-- Available interaction responses are: | |
-- "OpenCockpitInterface" | |
-- "SitDown" | |
-- "OpenCraftingInterface" | |
-- "OpenCookingInterface" | |
-- "OpenTechInterface" | |
-- "Teleport" | |
-- "OpenStreamingVideoInterface" | |
-- "PlayCinematic" | |
-- "OpenSongbookInterface" | |
-- "OpenNpcInterface" | |
-- "OpenNpcCraftingInterface" | |
-- "OpenTech3DPrinterDialog" | |
-- "ShowPopup" | |
function interact(args) end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Stubs for functions that object scripts can define which will then be called by C++ | |
--- Called once when the object is initialized | |
-- | |
-- @param virtual boolean that indicates whether the object is in placement | |
-- preview mode (true) or is actually placed in the world (false) | |
function init(virtual) end | |
--- Update loop handler, called once every scriptDelta (defined in *.object) ticks | |
function main() end | |
--- Called when the object has been destroyed and is about to be removed | |
function die() end | |
--- Called when the object is interacted with (e.g. by a player) | |
-- | |
-- @param args Table (map) of interaction event arguments: | |
-- source -> The {x,y} vector from the object's position to the | |
-- interacting entity's position | |
-- sourceId -> Entity id of the entity interacting with the object | |
-- | |
-- @returns nil, or a string describing an interaction response, or a table | |
-- (array) of { <interaction response string>, <interaction response config table (map)> } | |
-- Available interaction responses are: | |
-- "OpenCockpitInterface" | |
-- "SitDown" | |
-- "OpenCraftingInterface" | |
-- "OpenCookingInterface" | |
-- "OpenTechInterface" | |
-- "Teleport" | |
-- "OpenStreamingVideoInterface" | |
-- "PlayCinematic" | |
-- "OpenSongbookInterface" | |
-- "OpenNpcInterface" | |
-- "OpenNpcCraftingInterface" | |
-- "OpenTech3DPrinterDialog" | |
-- "ShowPopup" | |
function onInteraction(args) end | |
--- Called when the level of an inbound connected node changes | |
-- | |
-- @param args Table (map) of parameters: | |
-- node -> (int) index of the node that is changing | |
-- level -> new level of the node | |
function onInboundNodeChange(args) end | |
--- Called when a node is connected or disconnected | |
function onNodeConnectionChange() end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Stubs for world.* callbacks defined in C++. | |
-- | |
-- DO NOT INCLUDE this file in your scripts, it is for documentation purposes only. | |
-- | |
world = { | |
--- Finds all entities in the given region | |
-- | |
-- @param center Center of circular region to find entities in, or min | |
-- position of a rect if radius is a 2-vector | |
-- | |
-- @param radius If a single numeric value, the radius of the circular region. | |
-- Can also be given a 2-vector, in which case the search | |
-- region will be a rectangle defined by a min/max position. | |
-- | |
-- @param options Additional filtering options table, accepts the following: | |
-- withoutEntityId - an entity id (numeric) that will not be returned, even | |
-- if it is found in the search region. | |
-- callScript - The (string) name of a script to call in each considered | |
-- entity (only entities that support script calls will be | |
-- returned if this option is given). | |
-- callScriptArgs - Arguments (array) passed to the script named in callScript. | |
-- callScriptResult - Expected result of calling the script function named | |
-- in callScript. Only entities that return a matching | |
-- result will be returned. Defaults to true. | |
-- inSightOf - an entity id that all returned entities must have line of | |
-- sight on. | |
-- validTargetOf - an entity id that all returned entities must be valid | |
-- targets of | |
-- notAnObject - If true, no Object types will be considered. Defaults to | |
-- false. | |
-- order - The desired ordering of the returned entities, only supports the | |
-- value "nearest" which will sort the resulting entities by | |
-- ascending distance from the center of the search region. | |
-- @returns Table of entity ids | |
entityQuery = function(center, radius, options) end, | |
--- Entity query that only considers monsters | |
-- | |
-- @see entityQuery | |
-- @returns Table (array) of entity ids | |
monsterQuery = function(center, radius, options) end, | |
--- Entity query that only considers npcs (humanoids) | |
-- | |
-- @see entityQuery | |
-- @returns Table (array) of entity ids | |
npcQuery = function(center, radius, options) end, | |
--- Entity query that only considers all placeable objects (including things like bushes) | |
-- Adds the following options to the options argument: | |
-- name - Only objects with this (string) name will be returned. | |
-- | |
-- @see entityQuery | |
-- @returns Table (array) of entity ids | |
objectQuery = function(center, radius, options) end, | |
--- Entity query that only considers item drops | |
-- | |
-- @see entityQuery | |
-- @returns Table (array) of entity ids | |
itemDropQuery = function(center, radius, options) end, | |
--- Entity query that only considers players | |
-- | |
-- @see entityQuery | |
-- @returns Table (array) of entity ids | |
playerQuery = function(center, radius, options) end, | |
--- Entity query that only loungable objects (humanoids can sit/lay on them) | |
-- Adds the following options to the options argument: | |
-- orientation - Filters results that match the given orientation, valid | |
-- values are "sit" and "lay" | |
-- | |
-- @see entityQuery | |
-- @returns Table (array) of entity ids | |
loungableQuery = function(center, radius, options) end, | |
--- Entity query that only matches entities intersecting the given line. | |
-- | |
-- @see entityQuery for valid options | |
-- @returns Table (array) of entity ids | |
entityLineQuery = function(min, max, options) end, | |
--- Entity query that only matches objects intersecting the given line. | |
-- | |
-- @see entityQuery for valid options | |
-- @returns Table (array) of entity ids | |
objectLineQuery = function(min, max, options) end, | |
--- Entity query that only matches npcs intersecting the given line. | |
-- | |
-- @see entityQuery for valid options | |
-- @returns Table (array) of entity ids | |
npcLineQuery = function(min, max, options) end, | |
--- Determines if an entity still exists | |
-- | |
-- @param entityId Id of the entity to check | |
-- @returns Boolean | |
entityExists = function(entityId) end, | |
--- Determines the general type of the given entity id | |
-- | |
-- @param entityId Id of the entity to check | |
-- | |
-- @returns string entity type or nil if entity doesn't exist or isn't of one | |
-- of the following possible types: | |
-- "player" | |
-- "monster" | |
-- "object" | |
-- "itemdrop" | |
-- "projectile" | |
-- "plant" | |
-- "plantdrop" | |
-- "effect" | |
-- "npc" | |
entityType = function(entityId) end, | |
--- Gets the position of an entity | |
-- | |
-- @param entityId Id of the entity to get the position of | |
-- | |
-- @return { x, y } or nil if the entity does not exist. | |
entityPosition = function(entityId) end, | |
--- Gets the current and maximum health of an entity | |
-- Only valid for entities that have health (monsters, npcs) | |
-- | |
-- @param entityId entity to get the health of | |
-- | |
-- @return { health, maxHealth } or nil if the entity does not exist. | |
entityHealth = function(entityId) end, | |
--- Gets the species of the entity | |
-- Only valid for entities that have a notion of humanoid species (npcs, players) | |
-- | |
-- @param entityId entity to get the species of | |
-- | |
-- @return string species name (e.g. "apex" or "human") | |
entitySpecies = function(entityId) end, | |
--- Gets the name of the entity. | |
-- Note that the meaning of "name" depends on the type of entity | |
-- | |
-- @param entityId entity to get the name of | |
-- | |
-- @return string entity name, which will be (based on entity type): | |
-- Player,NPC,Monster: A name for the specific entity instance, e.g. "John Doe" | |
-- Object: The objectName value from the object's *.object config file | |
-- ItemDrop: The itemName value from the item's *.item config file | |
entityName = function(entityId) end, | |
--- Gets an item descriptor for the item held in the entity's hand | |
-- Only valid for entities that can hold items (npcs, players) | |
-- | |
-- @param entityId entity to get hand item of | |
-- @param hand Name of the hand to check, accepts: "primary" or "alt" | |
entityHandItem = function(entityId, hand) end, | |
--- Calls a lua function in the given entity's lua context | |
-- | |
-- @param entityId The (int) entity id of the entity to call the function on. | |
-- @param name The name of the function to call. This does not need to be a | |
-- global function - i.e. "entity.say" would call the "say" function | |
-- on the "entity" table (as defined in the target entity's lua | |
-- context). | |
-- @param ... (optional) Arguments passed to function | |
-- | |
-- @returns The result of calling the function, or nil if the entity does not | |
-- exist or does not support lua calls. | |
callScriptedEntity = function(entityId, name, ...) end, | |
--- Determine if a loungable object is occupied by a humanoid (player or NPC) | |
-- | |
-- @param entityId The (int) entity id of the entity to check. | |
-- | |
-- @returns nil if the entity does not exist, or is not a loungable object. | |
-- Otherwise, true if the entity is occupied or fals if it is not. | |
loungableOccupied = function(entityId) end, | |
--- Determine if the given entity id is that of a monster entity | |
-- | |
-- @param entityId (int) entity id to check | |
-- @param isAggressive (optional) If given as true, will only return true if | |
-- the entity is a monster and is marked as aggressive. If false is | |
-- given, will only return true if the entity is not marked as | |
-- aggressive. | |
-- | |
-- @returns True if entity is a monster (and the aggressive flag was omitted, | |
-- or matches the monster's aggressive flag); otherwise false | |
isMonster = function(entityId, isAggressive) end, | |
--- Determine if the given entity id is that of an NPC entity | |
-- @param entityId the (int) entity ID of the entity to check | |
-- @param damageTeam (optional) If given, the (int) damageTeam that a | |
-- NPC entity must have for this function to return true. | |
-- | |
-- @returns True if entity is an NPC and the damageTeam argument was omitted | |
-- or matches the NPC's damage team. Otherwise false. | |
isNpc = function(entityId, damageTeam) end, | |
--- Mark the given item drop entity as taken | |
-- | |
-- @param entityId Entity id of an item drop entity. | |
-- @param takenByEntityId (optional) entity id that is taking the item drop. | |
-- If given, the item drop will animate towards this entity for a bit. | |
-- | |
-- @returns The descriptor of the item taken, or nil if the item was already | |
-- taken, was not an item drop, or could not be taken for some | |
-- other reason. | |
takeItemDrop = function(entityId, takenByEntityId) end, | |
--- Gets the amount of light applied to a given position | |
-- | |
-- @param position { x, y } position to get light level of | |
-- | |
-- @returns numerical light level | |
lightLevel = function(location) end, | |
--- Returns the level of wind at the given location | |
-- @param location {x,y} in world coordinates | |
-- | |
-- @returns numerical wind level | |
windLevel = function(location) end, | |
--- Returns the temperature at the given location | |
-- @param location {x,y} in world coordinates | |
-- | |
-- @returns numerical temperature level | |
temperature = function(location) end, | |
--- Returns whether or not the location is breathable | |
-- @param location {x,y} in world coordinates | |
-- | |
-- @returns True if you can breathe there, otherwise false. | |
breathable = function(location) end, | |
--- Determine whether the given position is below the underground level | |
-- | |
-- @param position { x, y } location to check | |
-- | |
-- @returns True if the given position is below the underground level. | |
underground = function(position) end, | |
--- Gets the name of the material at the given tile position | |
-- | |
-- @param position The { x, y } position to check | |
-- @param layer The layer to check: "foreground" or "background" | |
-- | |
-- @returns The (string) material name, as defined in the materialName value | |
-- of a *.material file. Or nil if there is no material placed. | |
material = function(position, layer) end, | |
--- Gets the tile modification on the tile at the given position | |
-- | |
-- @param position The { x, y } position to check | |
-- @param layer The layer to check: "foreground" or "background" | |
-- | |
-- @returns The (string) mod name, as defined in the modName value | |
-- of a *.matmod file. Or nil if there is no modification placed. | |
mod = function(position, layer) end, | |
--- Applies damage to the tiles at the given positions | |
-- | |
-- @param positions List of { x, y } positions to damage tiles at | |
-- @param layer The tile layer to damage: "foreground" or "background" | |
-- @param sourcePosition The { x, y } position of the cause of the damage | |
-- @param type The type of damage to apply, allowed values are: | |
-- "plantish", "blockish", "beamish", "explosive", "fire", "tilling" | |
-- or "crushing". Note that "crushing" damage will prevent destroyed | |
-- tiles from dropping a material item. | |
-- @param amount The amount of damage to apply to each tile | |
-- | |
-- @returns true if any tiles were actually damaged, false otherwise | |
damageTiles = function(positions, layer, sourcePosition, type, amount) end, | |
--- Places a tile of a specific material at the given location | |
-- | |
-- @param position The { x, y } position to place the material at - | |
-- fractional values will be ignored, placing at a tile position. | |
-- @param layer The tile layer to place the tile on: "foreground" or "background" | |
-- @param materialName The name of the material to place, as specified in the | |
-- materialName value in a *.material file. | |
-- @param materialHue (optional) numeric (integer) hue shift to apply to the | |
-- material, if omitted (or nil), will default to whatever hue matches | |
-- the biome in which it is placed | |
-- @param allowOverlap (optional) If true, allows tiles to be placed even if | |
-- they overlap entities at the same location (defaults to false) | |
-- | |
-- @returns true if the material could be placed, false otherwise | |
placeMaterial = function(position, layer, materialName, materialHue, allowOverlap) end, | |
--- Gets the vector between two positions, accounting for the world wrap. | |
-- | |
-- @param position1 {x,y} position in world coordinates | |
-- @param position2 {x,y} position in world coordinates | |
-- | |
-- @returns Vector (position1 - position2) from position2 to position1, which | |
-- will be correct even when around the world wrap. | |
distance = function(position1, position2) end, | |
--- Calculates the magnitude of a 2-vector table, or the magnitude of the distance between two 2-vectors. | |
-- Accounts for world wrapping if two vectors are given | |
-- | |
-- @param vector1 Vector or start point of a line segment | |
-- @param vector2 If given, the magnitude of (vector1 - vector2) will be calculated | |
-- | |
-- @returns Numeric magnitude | |
magnitude = function(vector1, vector2) end, | |
--- Determines if the given region overlaps a player's screen region | |
-- | |
-- @param region { minX, minY, maxX, maxY } region to check | |
-- | |
-- @returns true if the region overlaps a player's screen region | |
isVisibleToPlayer = function(region) end, | |
--- Check if the given position collides with solid and/or platform collision | |
-- | |
-- @param position The { x, y } position to check | |
-- @param solidOnly (optional) If true, will only check for solid collision, | |
-- otherwise will include platform collision. Defaults to | |
-- true. | |
-- | |
-- @returns True if the given position falls inside of a collision region | |
pointCollision = function(position, solidOnly) end, | |
--- Check if the given line collides with solid and/or platform collision | |
-- | |
-- @param startPoint The { x, y } position of the line start point | |
-- @param endPoint The { x, y } position of the line end point | |
-- @param solidOnly (optional) If true, will only check for solid collision, | |
-- otherwise will include platform collision. Defaults to | |
-- true. | |
-- | |
-- @returns True if the given line intersects a collision region | |
lineCollision = function(startPoint, endPoint, solidOnly) end, | |
--- Check if the given rectangle collides with solid and/or platform collision | |
-- | |
-- @param region { minX, minY, maxX, maxY } region to check | |
-- @param solidOnly (optional) If true, will only check for solid collision, | |
-- otherwise will include platform collision. Defaults to | |
-- true. | |
-- | |
-- @returns True if the given rectangle overlaps with a collision region | |
rectCollision = function(region, solidOnly) end, | |
--- Returns all the tile positions along the given line that contain collision | |
-- | |
-- @param startPoint The { x, y } position of the line start point | |
-- @param endPoint The { x, y } position of the line end point | |
-- @param solidOnly (optional) If true, will only check for solid collision, | |
-- otherwise will include platform collision. Defaults to | |
-- true. | |
-- @param maxSize (optional The maximum number of collision positions to | |
-- return, defaults to no limit (-1). | |
-- | |
-- @returns A table (array) of {x,y} positions (integral) of the tiles with | |
-- collision, ordered by (smallest) distance to the start point. | |
collisionBlocksAlongLine = function(startPoint, endPoint, solidOnly, maxSize) end, | |
--- Gets the type and level of liquid at the given position | |
-- | |
-- @param position The {x,y} position to check. | |
-- | |
-- @returns null if no liquid is present at the given location, or a table | |
-- (array) of { <liquid id>, <liquid level> } where liquid id can be: | |
-- 1 -> water | |
-- 2 -> endless water | |
-- 3 -> lava | |
-- 4 -> acid | |
-- 5 -> endless lava | |
-- 6 -> tentacle juice | |
-- 7 -> tar | |
liquidAt = function(position) end, | |
--- Creates liquid at the given location | |
-- | |
-- @param position The {x,y} position to place the liquid at | |
-- @param liquidId The numeric (integer) liquid type to spawn - see return | |
-- values of world.liquidAt for valid options. | |
-- @param quantity The amount of liquid to spawn. | |
-- | |
-- @returns true if the requested liquid was spawned, false otherwise | |
spawnLiquid = function(position, liquidId, quantity) end, | |
--- Removes liquid at the given location | |
-- | |
-- @param position The {x,y} position to remove liquid from | |
-- | |
-- @returns nil if there was no liquid at the given position or the liquid | |
-- could not be removed, a table (array) of { <liquidId>, <liquidLevel> } | |
-- if the liquid was removed | |
destroyLiquid = function(position) end, | |
--- Places an object at the given position | |
-- | |
-- @param objectName Name of object to spawn, as specified in an *.object file | |
-- @param position { x, y } anchor position of the object | |
-- @param direction (optional) -1 for Left, 1 for Right (defaults to Right) | |
-- @param config (optional) Additional table (hash) of configuration options | |
-- that will be merged in with the final object configuration. | |
placeObject = function(objectName, position, direction, config) end, | |
--- Spawns an item drop at the given position | |
-- | |
-- @param objectName Name of object to spawn, as specified in an *.object file | |
-- @param spawnPosition World position { x, y } to spawn item at | |
-- @param count (optional) Number of items to spawn (stacked), defaults to 1. | |
-- @param config (optional) Table (hash) of additional configuration values | |
-- that will be merged into the final object configuration. | |
spawnItem = function(objectName, spawnPosition, count, config) end, | |
--- Spawns a monster at the specified location with the corresponding flags | |
-- | |
-- @param type Monster type as specified in a .monstertype file | |
-- @param spawnPosition {x,y} in world coordinates. | |
-- @param config (optional) configuration table (hash) that will be merged | |
-- into the final monster configuration built from the .monstertype | |
-- | |
-- @returns (int) entity id of the spawned monster | |
spawnMonster = function(type, spawnPosition, config) end, | |
--- Spawns an NPC at the specified location with the corresponding flags | |
-- | |
-- @param spawnPosition {x,y} in world coordinates. | |
-- @param species name of the species of the NPC as defined by the "kind" | |
-- value in a *.species file. | |
-- @param type The type of npc to spawn, as defined by the "type" value in a | |
-- *.npctype file | |
-- @param level The level of the npc to spawn | |
-- @param seed (optional) | |
-- @param config (optional) Configuration options that will be merged into | |
-- the final configuration for the NPC. | |
-- | |
-- @returns (int) entity id of the spawned npc | |
spawnNpc = function(spawnPosition, species, type, level, seed, config) end, | |
--- Spawns a projectile at the given location | |
-- | |
-- @param projectileName The (string) name of a projectile, as specified in a *.projectile file | |
-- @param spawnPosition {x,y} in world coordinates of where to spawn. | |
-- @param sourceEntityId (optional) Entity id that will be set as the source of the projectile | |
-- @param projectileDirection 2-vector direction for projectile to travel | |
-- @param trackSourceEntity If true, projectile position will be relative to source entity position (even if the source entity moves) | |
-- @param config Additional config options that will be merged in to the projectile configuration | |
-- | |
-- @returns (int) entity id of the spawned projectile | |
spawnProjectile = function(projectileName, spawnPosition, sourceEntityId, projectileDirection, trackSourceEntity, config) end, | |
--- Gets the epoch time of the currently active planet | |
-- | |
-- @returns Time since the epoch start (day zero) | |
time = function(...) end, | |
--- Gets the current day | |
-- | |
-- @returns Days since the epoch start (day zero) | |
day = function(...) end, | |
--- Gets the time of day, based on the current planet's day length | |
-- | |
-- @returns Time of day as a ratio, ranging from 0.0 to 1.0 | |
timeOfDay = function() end, | |
--- Gets info about the current world | |
-- | |
-- @returns nil if on a ship, or a table (hash) with the following keys: | |
-- name - friendly name of the world, e.g.: "Alpha Iota Cnc 6335 IV b" | |
-- handle - world identifier string, e.g.: "alpha:63052862:92521378:-8389600:9:7" | |
-- sector - name of the sector the world is in, e.g.: "alpha" | |
info = function() end, | |
--- Gets the general type of an item | |
-- | |
-- @param itemDescriptor Descriptor of an item, could be a string (e.g. | |
-- an objectName value from a *.object config file) or a descriptor | |
-- as listed in a blueprint list (e.g. { "item" : "copperarmorhead" }) | |
-- | |
-- @returns (string) Item type name, mapped from config file type as: | |
-- *.item -> "generic" | |
-- *.matitem -> "material" | |
-- *.miningtool -> "miningtool" | |
-- *.flashlight -> "flashlight" | |
-- *.wiretool -> "wiretool" | |
-- *.beamaxe -> "beamminingtool" | |
-- *.tillingtool -> "tillingtool" | |
-- *.painttool -> "paintingbeamtool" | |
-- *.gun -> "gun" | |
-- *.sword -> "sword" | |
-- *.shield -> "shield" | |
-- *.harvestingtool -> "harvestingtool" | |
-- *.head -> "headarmor" | |
-- *.chest -> "chestarmor" | |
-- *.legs -> "legsarmor" | |
-- *.back -> "backarmor" | |
-- *.coinitem -> "coin" | |
-- *.consumable -> "consumable" | |
-- *.blueprint -> "blueprint" | |
-- *.codexitem -> "codex" | |
-- *.techitem -> "techitem" | |
-- *.instrument -> "instrument" | |
-- *.grapplinghook -> "grapplinghook" | |
-- *.thrownitem -> "thrownitem" | |
-- *.celestial -> "celestialitem" | |
itemType = function(itemDescriptor) end, | |
--- Log text to the starbound.log file | |
-- | |
-- @param format A string to log, or a format specifier string. | |
-- @param ... Arguments that will be used if format is a format specifier | |
-- string. A maximum of 4 arguments are supported. | |
-- | |
-- @returns nil | |
logInfo = function(format, ...) end, | |
--- Render a point that can be viewed when /debug is enabled. | |
-- Note that scripted entities are generally not updated every tick, so this | |
-- point may flicker if the entity's scriptDelta is greater than 1. | |
-- | |
-- @param position The {x,y} position to render the point at | |
-- @param color The color of the point as a string (e.g. "red") or as a table | |
-- (array) of { r, g, b } or { r, g, b, a } | |
-- | |
-- @returns nil | |
debugPoint = function(position, color) end, | |
--- Render a line that can be viewed when /debug is enabled. | |
-- Note that scripted entities are generally not updated every tick, so this | |
-- line may flicker if the entity's scriptDelta is greater than 1. | |
-- | |
-- @param startPoint The {x,y} position of the line's starting point | |
-- @param endPoint The {x,y} position of the line's ending point | |
-- @param color The color of the line as a string (e.g. "red") or as a table | |
-- (array) of { r, g, b } or { r, g, b, a } | |
-- | |
-- @returns nil | |
debugLine = function(startPoint, endPoint, color) end, | |
--- Render text that can be viewed when /debug is enabled. | |
-- Note that scripted entities are generally not updated every tick, so this | |
-- text may flicker if the entity's scriptDelta is greater than 1. | |
-- | |
-- @param format A string of text, or format specifier string. | |
-- @param ... Arguments used if the format param is a format specifier | |
-- string. A maximum of 3 arguments are supported. | |
-- @param position The {x,y} position to render the text at | |
-- @param color The color of the text as a string (e.g. "red") or as a table | |
-- (array) of { r, g, b } or { r, g, b, a } | |
-- | |
-- @returns nil | |
debugText = function(format, ..., position, color) end, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment