Update openstarbound.md
This commit is contained in:
parent
7705394a1c
commit
dd7e3c91b0
@ -1,3 +1,119 @@
|
|||||||
|
# Unsorted
|
||||||
|
|
||||||
|
These are functions that aren't in any specific table.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `Maybe<LuaFunction>, Maybe<String>` loadstring(`String` source, [`String` name, [`LuaValue` env]])
|
||||||
|
|
||||||
|
Compiles the provided **source** and returns it as a callable function.
|
||||||
|
If there are any syntax errors, returns `nil` and the error as a string instead.
|
||||||
|
|
||||||
|
- **name** is used for error messages, the default is the name of the script that called `loadstring`.
|
||||||
|
- **env** is used as the environment of the returned function, the default is `_ENV`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Root
|
||||||
|
|
||||||
|
The root table now contains extra asset bindings and bindings to return the tile variant that is used for material and matmods at any position.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `String[]` root.assetsByExtension(`String` extension)
|
||||||
|
|
||||||
|
Returns an array containing all assets with the specified file extension.
|
||||||
|
|
||||||
|
By the way, here's a list of every file extension the game does Special Things™ for when loading assets.
|
||||||
|
|
||||||
|
<details><summary><b>File Extensions</b></summary>
|
||||||
|
|
||||||
|
- Items: `item`, `liqitem`, `matitem`, `miningtool`, `flashlight`, `wiretool`, `beamaxe`, `tillingtool`, `painttool`, `harvestingtool`, `head`, `chest`, `legs`, `back`, `currency`, `consumable`, `blueprint`, `inspectiontool`, `instrument`, `thrownitem`, `unlock`, `activeitem`, `augment`
|
||||||
|
- Materials: `material`, `matmod`
|
||||||
|
- Liquids: `liquid`
|
||||||
|
- NPCs: `npctype`
|
||||||
|
- Tenants: `tenant`
|
||||||
|
- Objects: `object`
|
||||||
|
- Vehicles: `vehicle`
|
||||||
|
- Monsters: `monstertype`, `monsterpart`, `monsterskill`, `monstercolors`
|
||||||
|
- Plants: `modularstem`, `modularfoliage`, `grass`, `bush`
|
||||||
|
- Projectiles: `projectile`
|
||||||
|
- Particles: `particle`
|
||||||
|
- Name Gen: `namesource`
|
||||||
|
- AI Missions: `aimission`
|
||||||
|
- Quests: `questtemplate`
|
||||||
|
- Radio Messages: `radiomessages`
|
||||||
|
- Spawn Types: `spawntypes`
|
||||||
|
- Species: `species`
|
||||||
|
- Stagehand: `stagehand`
|
||||||
|
- Behaviors: `nodes`, `behavior`
|
||||||
|
- Biomes: `biome`, `weather`
|
||||||
|
- Terrain: `terrain`
|
||||||
|
- Treasure: `treasurepools`, `treasurechests`
|
||||||
|
- Codex Entries: `codex`
|
||||||
|
- Collections: `collection`
|
||||||
|
- Statistics: `event`, `achievement`
|
||||||
|
- Status Effects: `statuseffect`
|
||||||
|
- Functions: `functions`, `2functions`, `configfunctions`
|
||||||
|
- Tech: `tech`
|
||||||
|
- Damage: `damage`
|
||||||
|
- Dances: `dance`
|
||||||
|
- Effect Sources: `effectsource`
|
||||||
|
- Command Macros: `macros`
|
||||||
|
- Recipes: `recipe`
|
||||||
|
</details>
|
||||||
|
|
||||||
|
#### `String` root.assetData(`String` path)
|
||||||
|
|
||||||
|
Returns the raw data of an asset.
|
||||||
|
|
||||||
|
#### `String, Maybe<LuaTable>` root.assetOrigin(`String` path, [`bool` getPatches])
|
||||||
|
|
||||||
|
Returns the asset source path of an asset, or nil if the asset doesn't exist. If you specify getPatches as true then also returns the patches for the asset as an array, each element containing the source path and patch path in indexes 1 and 2 respectively.
|
||||||
|
|
||||||
|
#### `LuaTable` root.assetSourcePaths([`bool` withMetadata])
|
||||||
|
|
||||||
|
Without metadata: Returns an array with all the asset source paths.
|
||||||
|
With metadata: Returns a table, key/value being source path/metadata.
|
||||||
|
|
||||||
|
#### `Json` root.getConfiguration(`String` key)
|
||||||
|
|
||||||
|
Gets a configuration value in `/storage/starbound.config`.
|
||||||
|
|
||||||
|
#### `Json` root.getConfigurationPath(`String` path)
|
||||||
|
|
||||||
|
Gets a configuration value in `/storage/starbound.config` by path.
|
||||||
|
|
||||||
|
*Both getters will error if you try to get `title`, as that can contain the player's saved server login.*
|
||||||
|
|
||||||
|
#### `Json` root.setConfiguration(`String` key, `Json` value)
|
||||||
|
|
||||||
|
Sets a configuration value in `/storage/starbound.config`.
|
||||||
|
|
||||||
|
#### `Json` root.setConfigurationPath(`String` path, `Json` value)
|
||||||
|
|
||||||
|
Sets a configuration value in `/storage/starbound.config` by path.
|
||||||
|
|
||||||
|
*Both setters will error if you try to set `safeScripts`, as that can break Starbound's sandbox.*
|
||||||
|
|
||||||
|
#### `Json` root.assetImage(`String` image)
|
||||||
|
|
||||||
|
*TODO*
|
||||||
|
|
||||||
|
#### `Json` root.assetPatches(`String` asset)
|
||||||
|
|
||||||
|
*TODO*
|
||||||
|
|
||||||
|
#### `JsonArray` root.allRecipes()
|
||||||
|
|
||||||
|
Returns all recipes.
|
||||||
|
|
||||||
|
# Player
|
||||||
|
|
||||||
|
The player table now contains bindings which contains functions to save/load, access and modify the player's identity, mode, aim, emote and more.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
#### `Json` player.save()
|
#### `Json` player.save()
|
||||||
|
|
||||||
Serializes the player to Json the same way Starbound does for disk storage and returns it.
|
Serializes the player to Json the same way Starbound does for disk storage and returns it.
|
||||||
|
Loading…
Reference in New Issue
Block a user