new documentation and some fixes in code

This commit is contained in:
Evil Factory
2021-09-12 15:58:59 -03:00
parent 3cd5a23af7
commit 656af7df2f
29 changed files with 1861 additions and 5 deletions

19
docs/lua/Character.lua Normal file
View File

@@ -0,0 +1,19 @@
-- luacheck: ignore 111
--[[--
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
--- Creates a CharacterInfo.
-- @treturn CharacterInfo
-- @realm server
function Create(speciesName, name, jobPrefab, ragdollFileName, variant, randSync, npcIdentifier) end
--- List of all characters.
-- @treturn table
-- @realm shared
CharacterList = {}

View File

@@ -0,0 +1,13 @@
-- luacheck: ignore 111
--[[--
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
--- Creates a Character using CharacterInfo.
-- @treturn Character
-- @realm server
function Create(characterInfo, position, seed, id, isRemotePlayer, hasAi, ragdollParams) end

36
docs/lua/Client.lua Normal file
View File

@@ -0,0 +1,36 @@
-- luacheck: ignore 111
--[[--
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
local myClient = {}
--- Sets the client character.
-- @realm server
function myClient.SetClientCharacter(character) end
--- Kick a client.
-- @realm server
function myClient.Kick(reason) end
--- Ban a client.
-- @realm server
function myClient.Ban(reason, range, seconds) end
--- Checks permissions, Client.Permissions.
-- @realm server
function myClient.CheckPermission(permissions) end
--- Unban a client.
-- @realm server
function Unban(player, endpoint) end
--- List of all connected clients.
-- @treturn table
-- @realm shared
ClientList = {}

40
docs/lua/File.lua Normal file
View File

@@ -0,0 +1,40 @@
-- luacheck: ignore 111
--[[--
Class providing filesystem functionality.
]]
-- @code File
--- Read contents from path
-- @treturn string file contents
-- @realm shared
function Read(path) end
--- Write text to file
-- @realm shared
function Write(path, text) end
--- Check if file exists.
-- @treturn bool
-- @realm shared
function Exists(path) end
--- Check if directory exists.
-- @treturn bool
-- @realm shared
function DirectoryExists(path) end
--- Check if directory exists.
-- @treturn table table containing all files
-- @realm shared
function GetFiles(path) end
--- List all directories.
-- @treturn table table containing all directories
-- @realm shared
function GetDirectories(path) end
--- Search directory for all files including sub directories.
-- @treturn table table containing all files
-- @realm shared
function DirSearch(path) end

88
docs/lua/Game.lua Normal file
View File

@@ -0,0 +1,88 @@
-- luacheck: ignore 111
--[[--
Class providing game related things, Access fields and functions like that: Game.*
]]
-- @code Game
local Game = {}
--- Is the round started?
-- @realm shared
RoundStarted = true
--- Is dedicated server?
-- @realm server
IsDedicated = true
--- Send chat message to every client.
-- @realm server
function SendMessage(msg, messageType, sender, character) end
--- Send traitor message.
-- @realm server
function SendTraitorMessage(client, msg, missionid, type) end
--- Send direct message.
-- @realm server
function SendDirectChatMessage(sendername, text, senderCharacter, chatMessageType, client, iconStyle) end
--- Send direct message.
-- @realm server
function SendDirectChatMessage(chatMessage, client) end
--- True to override traitors.
-- @realm server
function OverrideTraitors(override) end
--- True to override respawn shuttle.
-- @realm server
function OverrideRespawnSub(override) end
--- True to make wifi chat always work.
-- @realm server
function AllowWifiChat(override) end
--- True to prevent headsets from transmitting wifi signals.
-- @realm server
function OverrideSignalRadio(override) end
--- True to disable spam filter.
-- @realm server
function DisableSpamFilter(override) end
--- Log message to server logs.
-- @realm server
function Log(message, ServerLogMessageType) end
--- Spawn explosion.
-- @realm server
function Explode(pos, range, force, damage, structureDamage, itemDamage, empStrength, ballastFloraStrength) end
--- Get respawn shuttle submarine.
--@treturn Submarine Respawn Shuttle
-- @realm shared
function GetRespawnShuttle() end
--- Dispatch respawn shuttle.
-- @realm server
function DispatchRespawnSub() end
--- Execute console command.
-- @realm server
function ExecuteCommand(command) end
--- Starts the game.
-- @realm server
function StartGame() end
--- Gets all enabled content packages.
--@treturn table Table containing ContentPackages
-- @realm shared
function 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

128
docs/lua/Hooks.lua Normal file
View File

@@ -0,0 +1,128 @@
-- luacheck: ignore 111
--[[--
Hooks are basically functions that get called when events happen in-game, like chat messages.
]]
-- @code Hooks
local Hook = {}
--- Adds a hook.
-- @tparam string eventname event name
-- @tparam string hookname hook name
-- @tparam function func callback
-- @realm shared
-- @usage
-- Hook.Add("characterDeath", "characterDeathExample", function(character)
-- print(character)
-- end)
function Hook.Add(eventname, hookname, func) end
--- Removes a hook.
-- @tparam string eventname event name
-- @tparam string hookname hook name
-- @realm shared
-- @usage
-- Hook.Remove("characterDeath", "characterDeathExample")
function Hook.Remove(eventname, hookname) end
--- Calls a hook.
-- @tparam string eventname event name
-- @tparam table parameters parameters to be passed in
-- @realm shared
-- @usage
-- Hook.Add("think", "happyDebuggingSuckers", function()
-- Hook.Call("characterDead", {}) -- ruin someone's day
-- end)
function Hook.Call(eventname, parameters) end
--- Gets called everytime someone sends a chat message, return true to cancel message
-- @tparam string message
-- @tparam client sender
-- @realm shared
function chatMessage(message, sender) end
--- Called every update
-- @realm shared
function think() end
--- Called when a client connects
-- @tparam client connectedClient
-- @realm shared
function clientConnected(connectedClient) end
--- Called when a client disconnects
-- @tparam client disconnectedClient
-- @realm shared
function clientDisconnected(disconnectedClient) end
--- Called on round start
-- @realm shared
function roundStart() end
--- Called on round end
-- @realm shared
function roundEnd() end
--- Gets callled everytime a character is created.
-- @tparam character createdCharacter
-- @realm shared
function characterCreated(createdCharacter) end
--- Gets called everytime a Character dies.
-- @tparam Character character A dead Character.
-- @realm shared
-- @usage
-- Hook.Add("characterDeath", "characterDeathExample", function(character)
-- print(character)
-- end)
function characterDeath(character) end
---
-- @realm shared
function afflictionApplied(affliction, characterHealth, limb) end
---
-- @realm shared
function afflictionUpdate(affliction, characterHealth, limb) end
---
-- @realm shared
function itemUse(item, itemUser, targetLimb) end
---
-- @realm shared
function itemSecondaryUse(item, itemUser) end
---
-- @realm shared
function itemApplyTreatment(item, usingCharacter, targetCharacter, limb) end
--- Gets called whenever an item is dropped, You can return true to cancel.
-- @realm shared
function itemDrop(item, character) end
--- Gets called whenever an item is equipped. Return true to cancel.
-- @realm shared
function itemEquip(item, character) end
--- Same as itemEquip, but for unequipping.
-- @realm shared
function itemUnequip() end
---
-- @realm shared
function changeFallDamage() end
---
-- @realm shared
function gapOxygenUpdate() end
---
-- @realm shared
function signalReceived() end
---
-- @realm shared
function signalReceived.YourComponentIdentifier() end
---
-- @realm shared
function wifiSignalTransmitted() end
---
-- @realm shared
function serverLog() end

22
docs/lua/Item.lua Normal file
View File

@@ -0,0 +1,22 @@
-- luacheck: ignore 111
--[[--
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
--- Adds to remove queue, use this instead of Remove, to prevent desync.
-- @realm server
function AddToRemoveQueue(item) end
--- Sends a signal.
-- @realm server
function SendSignal(signalOrString, connectionOrConnectionName) end
--- List of all items.
-- @treturn table
-- @realm shared
ItemList = {}

28
docs/lua/ItemPrefab.lua Normal file
View File

@@ -0,0 +1,28 @@
-- luacheck: ignore 111
--[[--
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
--- 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
--- 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
--- Get a item prefab via name or id
-- @tparam string itemNameOrId
-- @treturn ItemPrefab
-- @realm shared
function GetItemPrefab(itemNameOrId) end

16
docs/lua/Networking.lua Normal file
View File

@@ -0,0 +1,16 @@
-- luacheck: ignore 111
--[[--
Class providing networking related tasks.
]]
-- @code Networking
--- Send a post HTTP Request.
-- treturn string result.
-- @realm server
function RequestPostHTTP(url, textData, contentType) end
--- Send a get HTTP Request.
-- treturn string result.
-- @realm server
function RequestGetHTTP(url) end

13
docs/lua/Signal.lua Normal file
View File

@@ -0,0 +1,13 @@
-- luacheck: ignore 111
--[[--
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
--- Creates a Signal.
-- @treturn Signal
-- @realm shared
function Create(stringValue, stepsTaken, characterSender, itemSource, power, strength) end

11
docs/lua/Timer.lua Normal file
View File

@@ -0,0 +1,11 @@
-- luacheck: ignore 111
--[[--
Class providing timing related things.
]]
-- @code Timer
--- Get time in seconds.
-- @treturn number current time in seconds
-- @realm shared
function GetTime() end

28
docs/lua/Vectors.lua Normal file
View File

@@ -0,0 +1,28 @@
-- luacheck: ignore 111
--[[--
Class providing vector functionality.
These are the XNA Vectors, you can find all the functions and fields here: <br>
<a href="https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/bb199660(v=xnagamestudio.35">XNA Vector2</a> <br>
<a href="https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/bb199670(v=xnagamestudio.35">XNA Vector3</a> <br>
<a href="https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/bb199679(v=xnagamestudio.35">XNA Vector4</a> <br>
Access them via Vector2.\*, Vector3.\*, Vector4.\* <br>
CreateVector2, CreateVector3, CreateVector4 are globals.
]]
-- @code Vectors
--- Create Vector2
-- @treturn Vector2
-- @realm shared
function CreateVector2(path) end
--- Create Vector3
-- @treturn Vector3
-- @realm shared
function CreateVector2(path) end
--- Create Vector4
-- @treturn Vector4
-- @realm shared
function CreateVector2(path) end