docs update
This commit is contained in:
@@ -6,6 +6,9 @@ Barotrauma Character class with some additional functions and fields
|
||||
Barotrauma source code: [Character.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs)
|
||||
]]
|
||||
-- @code Character
|
||||
-- @pragma nostrip
|
||||
|
||||
local Character = {}
|
||||
|
||||
--- Creates a Character using CharacterInfo.
|
||||
-- @treturn Character
|
||||
@@ -14,10 +17,10 @@ Barotrauma source code: [Character.cs](https://github.com/evilfactory/Barotrauma
|
||||
-- local vsauce = CharacterInfo.Create("human", "VSAUCE HERE")
|
||||
-- local character = Character.Create(vsauce, CreateVector2(0, 0), "some random characters")
|
||||
-- print(character)
|
||||
function Create(characterInfo, position, seed, id, isRemotePlayer, hasAi, ragdollParams) end
|
||||
function Character.Create(characterInfo, position, seed, id, isRemotePlayer, hasAi, ragdollParams) end
|
||||
|
||||
|
||||
--- List of all characters.
|
||||
-- @treturn table
|
||||
-- @realm shared
|
||||
CharacterList = {}
|
||||
Character.CharacterList = {}
|
||||
@@ -6,6 +6,9 @@ Barotrauma CharacterInfo class with some additional functions and fields
|
||||
Barotrauma source code: [CharacterInfo.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Characters/CharacterInfo.cs)
|
||||
]]
|
||||
-- @code CharacterInfo
|
||||
-- @pragma nostrip
|
||||
|
||||
local CharacterInfo = {}
|
||||
|
||||
--- Creates a CharacterInfo.
|
||||
-- @treturn CharacterInfo
|
||||
@@ -14,4 +17,4 @@ Barotrauma source code: [CharacterInfo.cs](https://github.com/evilfactory/Barotr
|
||||
-- local vsauce = CharacterInfo.Create("human", "VSAUCE HERE")
|
||||
-- local character = Character.Create(vsauce, CreateVector2(0, 0), "some random characters")
|
||||
-- print(character)
|
||||
function Create(speciesName, name, jobPrefab, ragdollFileName, variant, randSync, npcIdentifier) end
|
||||
function CharacterInfo.Create(speciesName, name, jobPrefab, ragdollFileName, variant, randSync, npcIdentifier) end
|
||||
+8
-7
@@ -6,31 +6,32 @@ Barotrauma Character class with some additional functions and fields
|
||||
Barotrauma source code: [Client.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Networking/Client.cs)
|
||||
]]
|
||||
-- @code Client
|
||||
-- @pragma nostrip
|
||||
|
||||
local myClient = {}
|
||||
local Client = {}
|
||||
|
||||
--- Sets the client character.
|
||||
-- @realm server
|
||||
function myClient.SetClientCharacter(character) end
|
||||
function Client:SetClientCharacter(character) end
|
||||
|
||||
--- Kick a client.
|
||||
-- @realm server
|
||||
function myClient.Kick(reason) end
|
||||
function Client:Kick(reason) end
|
||||
|
||||
--- Ban a client.
|
||||
-- @realm server
|
||||
function myClient.Ban(reason, range, seconds) end
|
||||
function Client:Ban(reason, range, seconds) end
|
||||
|
||||
--- Checks permissions, Client.Permissions.
|
||||
-- @realm server
|
||||
function myClient.CheckPermission(permissions) end
|
||||
function Client:CheckPermission(permissions) end
|
||||
|
||||
--- Unban a client.
|
||||
-- @realm server
|
||||
function Unban(player, endpoint) end
|
||||
function Client.Unban(player, endpoint) end
|
||||
|
||||
|
||||
--- List of all connected clients.
|
||||
-- @treturn table
|
||||
-- @realm shared
|
||||
ClientList = {}
|
||||
Client.ClientList = {}
|
||||
+10
-7
@@ -4,37 +4,40 @@
|
||||
Class providing filesystem functionality.
|
||||
]]
|
||||
-- @code File
|
||||
-- @pragma nostrip
|
||||
|
||||
File = {}
|
||||
|
||||
--- Read contents from path
|
||||
-- @treturn string file contents
|
||||
-- @realm shared
|
||||
function Read(path) end
|
||||
function File.Read(path) end
|
||||
|
||||
--- Write text to file
|
||||
-- @realm shared
|
||||
function Write(path, text) end
|
||||
function File.Write(path, text) end
|
||||
|
||||
--- Check if file exists.
|
||||
-- @treturn bool
|
||||
-- @realm shared
|
||||
function Exists(path) end
|
||||
function File.Exists(path) end
|
||||
|
||||
--- Check if directory exists.
|
||||
-- @treturn bool
|
||||
-- @realm shared
|
||||
function DirectoryExists(path) end
|
||||
function File.DirectoryExists(path) end
|
||||
|
||||
--- Check if directory exists.
|
||||
-- @treturn table table containing all files
|
||||
-- @realm shared
|
||||
function GetFiles(path) end
|
||||
function File.GetFiles(path) end
|
||||
|
||||
--- List all directories.
|
||||
-- @treturn table table containing all directories
|
||||
-- @realm shared
|
||||
function GetDirectories(path) end
|
||||
function File.GetDirectories(path) end
|
||||
|
||||
--- Search directory for all files including sub directories.
|
||||
-- @treturn table table containing all files
|
||||
-- @realm shared
|
||||
function DirSearch(path) end
|
||||
function File.DirSearch(path) end
|
||||
+21
-20
@@ -4,89 +4,90 @@
|
||||
Class providing game related things, Access fields and functions like that: Game.*
|
||||
]]
|
||||
-- @code Game
|
||||
-- @pragma nostrip
|
||||
|
||||
local Game = {}
|
||||
|
||||
--- Is the round started?
|
||||
-- @realm shared
|
||||
RoundStarted = true
|
||||
Game.RoundStarted = true
|
||||
|
||||
--- Is dedicated server?
|
||||
-- @realm server
|
||||
IsDedicated = true
|
||||
Game.IsDedicated = true
|
||||
|
||||
--- Server settings.
|
||||
-- @realm server
|
||||
ServerSettings = true
|
||||
Game.ServerSettings = true
|
||||
|
||||
--- Send chat message to every client.
|
||||
-- @realm server
|
||||
function SendMessage(msg, messageType, sender, character) end
|
||||
function Game.SendMessage(msg, messageType, sender, character) end
|
||||
|
||||
--- Send traitor message.
|
||||
-- @realm server
|
||||
function SendTraitorMessage(client, msg, missionid, type) end
|
||||
function Game.SendTraitorMessage(client, msg, missionid, type) end
|
||||
|
||||
|
||||
--- Send direct message.
|
||||
-- @realm server
|
||||
function SendDirectChatMessage(sendername, text, senderCharacter, chatMessageType, client, iconStyle) end
|
||||
function Game.SendDirectChatMessage(sendername, text, senderCharacter, chatMessageType, client, iconStyle) end
|
||||
|
||||
--- Send direct message.
|
||||
-- @realm server
|
||||
function SendDirectChatMessage(chatMessage, client) end
|
||||
function Game.SendDirectChatMessage(chatMessage, client) end
|
||||
|
||||
--- True to override traitors.
|
||||
-- @realm server
|
||||
function OverrideTraitors(override) end
|
||||
function Game.OverrideTraitors(override) end
|
||||
|
||||
--- True to override respawn sub, stops players from being respawned.
|
||||
-- @realm server
|
||||
function OverrideRespawnSub(override) end
|
||||
function Game.OverrideRespawnSub(override) end
|
||||
|
||||
--- True to make wifi chat always work.
|
||||
-- @realm server
|
||||
function AllowWifiChat(override) end
|
||||
function Game.AllowWifiChat(override) end
|
||||
|
||||
--- True to prevent headsets from transmitting wifi signals.
|
||||
-- @realm server
|
||||
function OverrideSignalRadio(override) end
|
||||
function Game.OverrideSignalRadio(override) end
|
||||
|
||||
--- True to disable spam filter.
|
||||
-- @realm server
|
||||
function DisableSpamFilter(override) end
|
||||
function Game.DisableSpamFilter(override) end
|
||||
|
||||
--- Log message to server logs.
|
||||
-- @realm server
|
||||
function Log(message, ServerLogMessageType) end
|
||||
function Game.Log(message, ServerLogMessageType) end
|
||||
|
||||
--- Spawn explosion.
|
||||
-- @realm server
|
||||
function Explode(pos, range, force, damage, structureDamage, itemDamage, empStrength, ballastFloraStrength) end
|
||||
function Game.Explode(pos, range, force, damage, structureDamage, itemDamage, empStrength, ballastFloraStrength) end
|
||||
|
||||
--- Get respawn sub submarine.
|
||||
--@treturn Submarine Respawn Shuttle
|
||||
-- @realm shared
|
||||
function GetRespawnSub() end
|
||||
function Game.GetRespawnSub() end
|
||||
|
||||
--- Dispatch respawn sub.
|
||||
-- @realm server
|
||||
function DispatchRespawnSub() end
|
||||
function Game.DispatchRespawnSub() end
|
||||
|
||||
--- Execute console command.
|
||||
-- @realm server
|
||||
function ExecuteCommand(command) end
|
||||
function Game.ExecuteCommand(command) end
|
||||
|
||||
--- Starts the game.
|
||||
-- @realm server
|
||||
function StartGame() end
|
||||
function Game.StartGame() end
|
||||
|
||||
--- Gets all enabled content packages.
|
||||
--@treturn table Table containing ContentPackages
|
||||
-- @realm shared
|
||||
function GetEnabledContentPackages() end
|
||||
function Game.GetEnabledContentPackages() end
|
||||
|
||||
--- Gets all enabled content packages by reading directly the player xml, useful when your mod doesn't have any xml.
|
||||
--@treturn table Table containing ContentPackages
|
||||
-- @realm shared
|
||||
function GetEnabledPackagesDirectlyFromFile() end
|
||||
function Game.GetEnabledPackagesDirectlyFromFile() end
|
||||
+2
-1
@@ -3,7 +3,8 @@
|
||||
--[[--
|
||||
Hooks are basically functions that get called when events happen in-game, like chat messages.
|
||||
]]
|
||||
-- @code Hooks
|
||||
-- @code Hook
|
||||
-- @pragma nostrip
|
||||
|
||||
local Hook = {}
|
||||
|
||||
|
||||
+7
-4
@@ -6,21 +6,24 @@ Barotrauma Item class with some additional functions and fields
|
||||
Barotrauma source code: [Item.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs)
|
||||
]]
|
||||
-- @code Item
|
||||
-- @pragma nostrip
|
||||
|
||||
Item = {}
|
||||
|
||||
--- Adds to remove queue, use this instead of Remove, to prevent desync.
|
||||
-- @realm server
|
||||
function AddToRemoveQueue(item) end
|
||||
function Item.AddToRemoveQueue(item) end
|
||||
|
||||
--- Gets a component from an item by a string name.
|
||||
-- @treturn Component component
|
||||
-- @realm server
|
||||
function GetComponentString(componentName) end
|
||||
function Item:GetComponentString(componentName) end
|
||||
|
||||
--- Sends a signal.
|
||||
-- @realm server
|
||||
function SendSignal(signalOrString, connectionOrConnectionName) end
|
||||
function Item:SendSignal(signalOrString, connectionOrConnectionName) end
|
||||
|
||||
--- List of all items.
|
||||
-- @treturn table
|
||||
-- @realm shared
|
||||
ItemList = {}
|
||||
Item.ItemList = {}
|
||||
@@ -6,23 +6,26 @@ Barotrauma ItemPrefab class with some additional functions and fields
|
||||
Barotrauma source code: [ItemPrefab.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Items/ItemPrefab.cs)
|
||||
]]
|
||||
-- @code ItemPrefab
|
||||
-- @pragma nostrip
|
||||
|
||||
local ItemPrefab = {}
|
||||
|
||||
--- Add ItemPrefab to spawn queue and spawns it at the specified position
|
||||
-- @tparam ItemPrefab itemPrefab
|
||||
-- @tparam Vector2 position
|
||||
-- @tparam function spawned
|
||||
-- @realm server
|
||||
function AddToSpawnQueue(itemPrefab, position, spawned) end
|
||||
function ItemPrefab.AddToSpawnQueue(itemPrefab, position, spawned) end
|
||||
|
||||
--- Add ItemPrefab to spawn queue and spawns it inside the specified inventory
|
||||
-- @tparam ItemPrefab itemPrefab
|
||||
-- @tparam Inventory inventory
|
||||
-- @tparam function spawned
|
||||
-- @realm server
|
||||
function AddToSpawnQueue(itemPrefab, inventory, spawned) end
|
||||
function ItemPrefab.AddToSpawnQueue(itemPrefab, inventory, spawned) end
|
||||
|
||||
--- Get a item prefab via name or id
|
||||
-- @tparam string itemNameOrId
|
||||
-- @treturn ItemPrefab
|
||||
-- @realm shared
|
||||
function GetItemPrefab(itemNameOrId) end
|
||||
function ItemPrefab.GetItemPrefab(itemNameOrId) end
|
||||
|
||||
@@ -4,13 +4,16 @@
|
||||
Class providing networking related tasks.
|
||||
]]
|
||||
-- @code Networking
|
||||
-- @pragma nostrip
|
||||
|
||||
local Networking = {}
|
||||
|
||||
--- Send a post HTTP Request.
|
||||
-- treturn string result.
|
||||
-- @realm server
|
||||
function RequestPostHTTP(url, textData, contentType) end
|
||||
function Networking.RequestPostHTTP(url, textData, contentType) end
|
||||
|
||||
--- Send a get HTTP Request.
|
||||
-- treturn string result.
|
||||
-- @realm server
|
||||
function RequestGetHTTP(url) end
|
||||
function Networking.RequestGetHTTP(url) end
|
||||
+4
-1
@@ -6,8 +6,11 @@ Barotrauma Signal struct with some additional functions and fields
|
||||
Barotrauma source code: [Signal.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/Signal.cs)
|
||||
]]
|
||||
-- @code Signal
|
||||
-- @pragma nostrip
|
||||
|
||||
Signal = {}
|
||||
|
||||
--- Creates a Signal.
|
||||
-- @treturn Signal
|
||||
-- @realm shared
|
||||
function Create(stringValue, stepsTaken, characterSender, itemSource, power, strength) end
|
||||
function Signal.Create(stringValue, stepsTaken, characterSender, itemSource, power, strength) end
|
||||
+4
-1
@@ -4,8 +4,11 @@
|
||||
Class providing timing related things.
|
||||
]]
|
||||
-- @code Timer
|
||||
-- @pragma nostrip
|
||||
|
||||
Timer = {}
|
||||
|
||||
--- Get time in seconds.
|
||||
-- @treturn number current time in seconds
|
||||
-- @realm shared
|
||||
function GetTime() end
|
||||
function Timer.GetTime() end
|
||||
@@ -11,4 +11,4 @@ When creating a new Lua mod, you will need to create a new folder on the **Mods*
|
||||
Now you can open **test.lua** in your favorite text editor (vscode recommended) and type in **print("Hello, world")**, now start the server by hosting a game or running the server executable manually, you will see in your console a text appear with the text that you entered in print, you can now type in the server console reloadlua, this will re-execute all the Lua scripts. You can also type in lua (script) to run a short lua snippet, like this `lua print('Hello, world')`, remember to remove double quotes, because Barotrauma console automatically formats those.
|
||||
|
||||
## Learning the libraries
|
||||
In the sidebar of the documentation, you can see a tab named Code, in there you can check out all the functions and fields that each class has, and learn more about them, but not everything is documented here, theres stuff missing that still needs to be added, if you want to find more in-depth functions and fields in the Barotrauma classes, you should check the Barotrauma source code.
|
||||
In the sidebar of the documentation, you can see a tab named Code, in there you can check out all the functions and fields that each class has, each one of them has a box with a color on it, where <span class="realm server"></span> means Server-Side, <span class="realm client"></span> means Client-Side and <span class="realm shared"></span> means both Server-Side and Client-Side, by clicking on them you can learn more about them. Not everything is documented here, theres stuff missing that still needs to be added, if you want to find more in-depth functions and fields in the Barotrauma classes, you should check the Barotrauma source code.
|
||||
Reference in New Issue
Block a user