diff --git a/docs/lua/Character.lua b/docs/lua/Character.lua index 2d6c3f074..4e431620e 100644 --- a/docs/lua/Character.lua +++ b/docs/lua/Character.lua @@ -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 = {} \ No newline at end of file +Character.CharacterList = {} \ No newline at end of file diff --git a/docs/lua/CharacterInfo.lua b/docs/lua/CharacterInfo.lua index 2ba06e6e6..d9e6abddd 100644 --- a/docs/lua/CharacterInfo.lua +++ b/docs/lua/CharacterInfo.lua @@ -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 \ No newline at end of file +function CharacterInfo.Create(speciesName, name, jobPrefab, ragdollFileName, variant, randSync, npcIdentifier) end \ No newline at end of file diff --git a/docs/lua/Client.lua b/docs/lua/Client.lua index e44a6af1f..4ed8249f3 100644 --- a/docs/lua/Client.lua +++ b/docs/lua/Client.lua @@ -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 = {} \ No newline at end of file +Client.ClientList = {} \ No newline at end of file diff --git a/docs/lua/File.lua b/docs/lua/File.lua index fa1991c1c..179f8d320 100644 --- a/docs/lua/File.lua +++ b/docs/lua/File.lua @@ -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 \ No newline at end of file +function File.DirSearch(path) end \ No newline at end of file diff --git a/docs/lua/Game.lua b/docs/lua/Game.lua index 77edf8187..5c8a4ca29 100644 --- a/docs/lua/Game.lua +++ b/docs/lua/Game.lua @@ -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 \ No newline at end of file +function Game.GetEnabledPackagesDirectlyFromFile() end \ No newline at end of file diff --git a/docs/lua/Hooks.lua b/docs/lua/Hooks.lua index 3c2e805d4..eda0bc34f 100644 --- a/docs/lua/Hooks.lua +++ b/docs/lua/Hooks.lua @@ -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 = {} diff --git a/docs/lua/Item.lua b/docs/lua/Item.lua index 044c25412..b86175605 100644 --- a/docs/lua/Item.lua +++ b/docs/lua/Item.lua @@ -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 = {} \ No newline at end of file +Item.ItemList = {} \ No newline at end of file diff --git a/docs/lua/ItemPrefab.lua b/docs/lua/ItemPrefab.lua index 185835a53..52dbe581c 100644 --- a/docs/lua/ItemPrefab.lua +++ b/docs/lua/ItemPrefab.lua @@ -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 \ No newline at end of file +function ItemPrefab.GetItemPrefab(itemNameOrId) end diff --git a/docs/lua/Networking.lua b/docs/lua/Networking.lua index f591bf8a0..40a9e177a 100644 --- a/docs/lua/Networking.lua +++ b/docs/lua/Networking.lua @@ -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 \ No newline at end of file +function Networking.RequestGetHTTP(url) end \ No newline at end of file diff --git a/docs/lua/Signal.lua b/docs/lua/Signal.lua index 2095fc1d1..311763eff 100644 --- a/docs/lua/Signal.lua +++ b/docs/lua/Signal.lua @@ -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 \ No newline at end of file +function Signal.Create(stringValue, stepsTaken, characterSender, itemSource, power, strength) end \ No newline at end of file diff --git a/docs/lua/Timer.lua b/docs/lua/Timer.lua index e4c133234..a3ced874d 100644 --- a/docs/lua/Timer.lua +++ b/docs/lua/Timer.lua @@ -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 \ No newline at end of file +function Timer.GetTime() end \ No newline at end of file diff --git a/docs/manual/getting-started.md b/docs/manual/getting-started.md index 56fef0872..dc437f16c 100644 --- a/docs/manual/getting-started.md +++ b/docs/manual/getting-started.md @@ -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. \ No newline at end of file +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 means Server-Side, means Client-Side and 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. \ No newline at end of file