From dd7e3c91b06a77238d58965bcf01cc32d46c55ef Mon Sep 17 00:00:00 2001 From: SilverSokolova <80606782+SilverSokolova@users.noreply.github.com> Date: Tue, 9 Jul 2024 22:12:14 -0500 Subject: [PATCH] Update openstarbound.md --- doc/lua/openstarbound.md | 116 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/doc/lua/openstarbound.md b/doc/lua/openstarbound.md index 9bed51f..6e29afc 100644 --- a/doc/lua/openstarbound.md +++ b/doc/lua/openstarbound.md @@ -1,3 +1,119 @@ +# Unsorted + +These are functions that aren't in any specific table. + +--- + +#### `Maybe, Maybe` 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. + +
File Extensions + +- 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` +
+ +#### `String` root.assetData(`String` path) + +Returns the raw data of an asset. + +#### `String, Maybe` 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() Serializes the player to Json the same way Starbound does for disk storage and returns it.