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)
|
Barotrauma source code: [Character.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs)
|
||||||
]]
|
]]
|
||||||
-- @code Character
|
-- @code Character
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
|
local Character = {}
|
||||||
|
|
||||||
--- Creates a Character using CharacterInfo.
|
--- Creates a Character using CharacterInfo.
|
||||||
-- @treturn Character
|
-- @treturn Character
|
||||||
@@ -14,10 +17,10 @@ Barotrauma source code: [Character.cs](https://github.com/evilfactory/Barotrauma
|
|||||||
-- local vsauce = CharacterInfo.Create("human", "VSAUCE HERE")
|
-- local vsauce = CharacterInfo.Create("human", "VSAUCE HERE")
|
||||||
-- local character = Character.Create(vsauce, CreateVector2(0, 0), "some random characters")
|
-- local character = Character.Create(vsauce, CreateVector2(0, 0), "some random characters")
|
||||||
-- print(character)
|
-- 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.
|
--- List of all characters.
|
||||||
-- @treturn table
|
-- @treturn table
|
||||||
-- @realm shared
|
-- @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)
|
Barotrauma source code: [CharacterInfo.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Characters/CharacterInfo.cs)
|
||||||
]]
|
]]
|
||||||
-- @code CharacterInfo
|
-- @code CharacterInfo
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
|
local CharacterInfo = {}
|
||||||
|
|
||||||
--- Creates a CharacterInfo.
|
--- Creates a CharacterInfo.
|
||||||
-- @treturn 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 vsauce = CharacterInfo.Create("human", "VSAUCE HERE")
|
||||||
-- local character = Character.Create(vsauce, CreateVector2(0, 0), "some random characters")
|
-- local character = Character.Create(vsauce, CreateVector2(0, 0), "some random characters")
|
||||||
-- print(character)
|
-- 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)
|
Barotrauma source code: [Client.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Networking/Client.cs)
|
||||||
]]
|
]]
|
||||||
-- @code Client
|
-- @code Client
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
local myClient = {}
|
local Client = {}
|
||||||
|
|
||||||
--- Sets the client character.
|
--- Sets the client character.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function myClient.SetClientCharacter(character) end
|
function Client:SetClientCharacter(character) end
|
||||||
|
|
||||||
--- Kick a client.
|
--- Kick a client.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function myClient.Kick(reason) end
|
function Client:Kick(reason) end
|
||||||
|
|
||||||
--- Ban a client.
|
--- Ban a client.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function myClient.Ban(reason, range, seconds) end
|
function Client:Ban(reason, range, seconds) end
|
||||||
|
|
||||||
--- Checks permissions, Client.Permissions.
|
--- Checks permissions, Client.Permissions.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function myClient.CheckPermission(permissions) end
|
function Client:CheckPermission(permissions) end
|
||||||
|
|
||||||
--- Unban a client.
|
--- Unban a client.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function Unban(player, endpoint) end
|
function Client.Unban(player, endpoint) end
|
||||||
|
|
||||||
|
|
||||||
--- List of all connected clients.
|
--- List of all connected clients.
|
||||||
-- @treturn table
|
-- @treturn table
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
ClientList = {}
|
Client.ClientList = {}
|
||||||
+10
-7
@@ -4,37 +4,40 @@
|
|||||||
Class providing filesystem functionality.
|
Class providing filesystem functionality.
|
||||||
]]
|
]]
|
||||||
-- @code File
|
-- @code File
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
|
File = {}
|
||||||
|
|
||||||
--- Read contents from path
|
--- Read contents from path
|
||||||
-- @treturn string file contents
|
-- @treturn string file contents
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
function Read(path) end
|
function File.Read(path) end
|
||||||
|
|
||||||
--- Write text to file
|
--- Write text to file
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
function Write(path, text) end
|
function File.Write(path, text) end
|
||||||
|
|
||||||
--- Check if file exists.
|
--- Check if file exists.
|
||||||
-- @treturn bool
|
-- @treturn bool
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
function Exists(path) end
|
function File.Exists(path) end
|
||||||
|
|
||||||
--- Check if directory exists.
|
--- Check if directory exists.
|
||||||
-- @treturn bool
|
-- @treturn bool
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
function DirectoryExists(path) end
|
function File.DirectoryExists(path) end
|
||||||
|
|
||||||
--- Check if directory exists.
|
--- Check if directory exists.
|
||||||
-- @treturn table table containing all files
|
-- @treturn table table containing all files
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
function GetFiles(path) end
|
function File.GetFiles(path) end
|
||||||
|
|
||||||
--- List all directories.
|
--- List all directories.
|
||||||
-- @treturn table table containing all directories
|
-- @treturn table table containing all directories
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
function GetDirectories(path) end
|
function File.GetDirectories(path) end
|
||||||
|
|
||||||
--- Search directory for all files including sub directories.
|
--- Search directory for all files including sub directories.
|
||||||
-- @treturn table table containing all files
|
-- @treturn table table containing all files
|
||||||
-- @realm shared
|
-- @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.*
|
Class providing game related things, Access fields and functions like that: Game.*
|
||||||
]]
|
]]
|
||||||
-- @code Game
|
-- @code Game
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
local Game = {}
|
local Game = {}
|
||||||
|
|
||||||
--- Is the round started?
|
--- Is the round started?
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
RoundStarted = true
|
Game.RoundStarted = true
|
||||||
|
|
||||||
--- Is dedicated server?
|
--- Is dedicated server?
|
||||||
-- @realm server
|
-- @realm server
|
||||||
IsDedicated = true
|
Game.IsDedicated = true
|
||||||
|
|
||||||
--- Server settings.
|
--- Server settings.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
ServerSettings = true
|
Game.ServerSettings = true
|
||||||
|
|
||||||
--- Send chat message to every client.
|
--- Send chat message to every client.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function SendMessage(msg, messageType, sender, character) end
|
function Game.SendMessage(msg, messageType, sender, character) end
|
||||||
|
|
||||||
--- Send traitor message.
|
--- Send traitor message.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function SendTraitorMessage(client, msg, missionid, type) end
|
function Game.SendTraitorMessage(client, msg, missionid, type) end
|
||||||
|
|
||||||
|
|
||||||
--- Send direct message.
|
--- Send direct message.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function SendDirectChatMessage(sendername, text, senderCharacter, chatMessageType, client, iconStyle) end
|
function Game.SendDirectChatMessage(sendername, text, senderCharacter, chatMessageType, client, iconStyle) end
|
||||||
|
|
||||||
--- Send direct message.
|
--- Send direct message.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function SendDirectChatMessage(chatMessage, client) end
|
function Game.SendDirectChatMessage(chatMessage, client) end
|
||||||
|
|
||||||
--- True to override traitors.
|
--- True to override traitors.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function OverrideTraitors(override) end
|
function Game.OverrideTraitors(override) end
|
||||||
|
|
||||||
--- True to override respawn sub, stops players from being respawned.
|
--- True to override respawn sub, stops players from being respawned.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function OverrideRespawnSub(override) end
|
function Game.OverrideRespawnSub(override) end
|
||||||
|
|
||||||
--- True to make wifi chat always work.
|
--- True to make wifi chat always work.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function AllowWifiChat(override) end
|
function Game.AllowWifiChat(override) end
|
||||||
|
|
||||||
--- True to prevent headsets from transmitting wifi signals.
|
--- True to prevent headsets from transmitting wifi signals.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function OverrideSignalRadio(override) end
|
function Game.OverrideSignalRadio(override) end
|
||||||
|
|
||||||
--- True to disable spam filter.
|
--- True to disable spam filter.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function DisableSpamFilter(override) end
|
function Game.DisableSpamFilter(override) end
|
||||||
|
|
||||||
--- Log message to server logs.
|
--- Log message to server logs.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function Log(message, ServerLogMessageType) end
|
function Game.Log(message, ServerLogMessageType) end
|
||||||
|
|
||||||
--- Spawn explosion.
|
--- Spawn explosion.
|
||||||
-- @realm server
|
-- @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.
|
--- Get respawn sub submarine.
|
||||||
--@treturn Submarine Respawn Shuttle
|
--@treturn Submarine Respawn Shuttle
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
function GetRespawnSub() end
|
function Game.GetRespawnSub() end
|
||||||
|
|
||||||
--- Dispatch respawn sub.
|
--- Dispatch respawn sub.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function DispatchRespawnSub() end
|
function Game.DispatchRespawnSub() end
|
||||||
|
|
||||||
--- Execute console command.
|
--- Execute console command.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function ExecuteCommand(command) end
|
function Game.ExecuteCommand(command) end
|
||||||
|
|
||||||
--- Starts the game.
|
--- Starts the game.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function StartGame() end
|
function Game.StartGame() end
|
||||||
|
|
||||||
--- Gets all enabled content packages.
|
--- Gets all enabled content packages.
|
||||||
--@treturn table Table containing ContentPackages
|
--@treturn table Table containing ContentPackages
|
||||||
-- @realm shared
|
-- @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.
|
--- 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
|
--@treturn table Table containing ContentPackages
|
||||||
-- @realm shared
|
-- @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.
|
Hooks are basically functions that get called when events happen in-game, like chat messages.
|
||||||
]]
|
]]
|
||||||
-- @code Hooks
|
-- @code Hook
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
local Hook = {}
|
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)
|
Barotrauma source code: [Item.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs)
|
||||||
]]
|
]]
|
||||||
-- @code Item
|
-- @code Item
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
|
Item = {}
|
||||||
|
|
||||||
--- Adds to remove queue, use this instead of Remove, to prevent desync.
|
--- Adds to remove queue, use this instead of Remove, to prevent desync.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function AddToRemoveQueue(item) end
|
function Item.AddToRemoveQueue(item) end
|
||||||
|
|
||||||
--- Gets a component from an item by a string name.
|
--- Gets a component from an item by a string name.
|
||||||
-- @treturn Component component
|
-- @treturn Component component
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function GetComponentString(componentName) end
|
function Item:GetComponentString(componentName) end
|
||||||
|
|
||||||
--- Sends a signal.
|
--- Sends a signal.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function SendSignal(signalOrString, connectionOrConnectionName) end
|
function Item:SendSignal(signalOrString, connectionOrConnectionName) end
|
||||||
|
|
||||||
--- List of all items.
|
--- List of all items.
|
||||||
-- @treturn table
|
-- @treturn table
|
||||||
-- @realm shared
|
-- @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)
|
Barotrauma source code: [ItemPrefab.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Items/ItemPrefab.cs)
|
||||||
]]
|
]]
|
||||||
-- @code ItemPrefab
|
-- @code ItemPrefab
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
|
local ItemPrefab = {}
|
||||||
|
|
||||||
--- Add ItemPrefab to spawn queue and spawns it at the specified position
|
--- Add ItemPrefab to spawn queue and spawns it at the specified position
|
||||||
-- @tparam ItemPrefab itemPrefab
|
-- @tparam ItemPrefab itemPrefab
|
||||||
-- @tparam Vector2 position
|
-- @tparam Vector2 position
|
||||||
-- @tparam function spawned
|
-- @tparam function spawned
|
||||||
-- @realm server
|
-- @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
|
--- Add ItemPrefab to spawn queue and spawns it inside the specified inventory
|
||||||
-- @tparam ItemPrefab itemPrefab
|
-- @tparam ItemPrefab itemPrefab
|
||||||
-- @tparam Inventory inventory
|
-- @tparam Inventory inventory
|
||||||
-- @tparam function spawned
|
-- @tparam function spawned
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function AddToSpawnQueue(itemPrefab, inventory, spawned) end
|
function ItemPrefab.AddToSpawnQueue(itemPrefab, inventory, spawned) end
|
||||||
|
|
||||||
--- Get a item prefab via name or id
|
--- Get a item prefab via name or id
|
||||||
-- @tparam string itemNameOrId
|
-- @tparam string itemNameOrId
|
||||||
-- @treturn ItemPrefab
|
-- @treturn ItemPrefab
|
||||||
-- @realm shared
|
-- @realm shared
|
||||||
function GetItemPrefab(itemNameOrId) end
|
function ItemPrefab.GetItemPrefab(itemNameOrId) end
|
||||||
|
|||||||
@@ -4,13 +4,16 @@
|
|||||||
Class providing networking related tasks.
|
Class providing networking related tasks.
|
||||||
]]
|
]]
|
||||||
-- @code Networking
|
-- @code Networking
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
|
local Networking = {}
|
||||||
|
|
||||||
--- Send a post HTTP Request.
|
--- Send a post HTTP Request.
|
||||||
-- treturn string result.
|
-- treturn string result.
|
||||||
-- @realm server
|
-- @realm server
|
||||||
function RequestPostHTTP(url, textData, contentType) end
|
function Networking.RequestPostHTTP(url, textData, contentType) end
|
||||||
|
|
||||||
--- Send a get HTTP Request.
|
--- Send a get HTTP Request.
|
||||||
-- treturn string result.
|
-- treturn string result.
|
||||||
-- @realm server
|
-- @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)
|
Barotrauma source code: [Signal.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/Signal.cs)
|
||||||
]]
|
]]
|
||||||
-- @code Signal
|
-- @code Signal
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
|
Signal = {}
|
||||||
|
|
||||||
--- Creates a Signal.
|
--- Creates a Signal.
|
||||||
-- @treturn Signal
|
-- @treturn Signal
|
||||||
-- @realm shared
|
-- @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.
|
Class providing timing related things.
|
||||||
]]
|
]]
|
||||||
-- @code Timer
|
-- @code Timer
|
||||||
|
-- @pragma nostrip
|
||||||
|
|
||||||
|
Timer = {}
|
||||||
|
|
||||||
--- Get time in seconds.
|
--- Get time in seconds.
|
||||||
-- @treturn number current time in seconds
|
-- @treturn number current time in seconds
|
||||||
-- @realm shared
|
-- @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.
|
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
|
## 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