diff --git a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaDocs.cs b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaDocs.cs index b0a6bff19..47d8899df 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaDocs.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaDocs.cs @@ -57,16 +57,72 @@ namespace Barotrauma return type; } - public static void GenerateDocs(Type type) + public static string EscapeName(string n) + { + if (n == "end") + return "endparam"; + + return n; + } + + public static void GenerateDocsAll() + { + GenerateDocs(typeof(Character), "Character.lua"); + GenerateDocs(typeof(CharacterInfo), "CharacterInfo.lua"); + GenerateDocs(typeof(Client), "Client.lua"); + GenerateDocs(typeof(Entity), "Entity.lua"); + GenerateDocs(typeof(EntitySpawner), "Entity.Spawner.lua", "Entity.Spawner"); + GenerateDocs(typeof(Item), "Item.lua"); + GenerateDocs(typeof(ItemPrefab), "ItemPrefab.lua"); + GenerateDocs(typeof(Submarine), "Submarine.lua"); + GenerateDocs(typeof(Job), "Job.lua"); + GenerateDocs(typeof(JobPrefab), "JobPrefab.lua"); + GenerateDocs(typeof(GameSession), "GameSession.lua", "Game.GameSession"); + GenerateDocs(typeof(NetLobbyScreen), "NetLobbyScreen.lua", "Game.NetLobbyScreen"); + GenerateDocs(typeof(GameScreen), "GameScreen.lua", "Game.GameScreen"); + GenerateDocs(typeof(FarseerPhysics.Dynamics.World), "World.lua", "Game.World"); + } + + public static void GenerateDocs(Type type, string name, string? categoryName = null) + { + GenerateDocs(type, "../../../../docs/baseluadocs/" + name, "../../../../docs/lua/generated/" + name, categoryName); + } + + public static void GenerateDocs(Type type, string baselua, string fileresult, string? categoryName = null) { var sb = new StringBuilder(); + if (categoryName == null) + categoryName = type.Name; + + var baseluatext = ""; + + if (!File.Exists(baselua)) + { + const string EMPTY_TABLE = "{}"; + + baseluatext = @$"-- luacheck: ignore 111 + +--[[-- +{type.FullName} +]] +-- @code {categoryName} +-- @pragma nostrip +local {type.Name} = {EMPTY_TABLE}"; + + File.WriteAllText(baselua, baseluatext); + } + else + baseluatext = File.ReadAllText(baselua); + + sb.Append(baseluatext + "\n\n"); + var members = type.GetMembers(); foreach(var member in members) { Console.WriteLine("'{0}' is a {1}", member.Name, member.MemberType); - + if (member.MemberType == MemberTypes.Method) { var method = (MethodInfo)member; @@ -85,11 +141,11 @@ namespace Barotrauma var parameter = parameters[i]; if(i == parameters.Length - 1) - paramNames = paramNames + parameter.Name; + paramNames = paramNames + EscapeName(parameter.Name); else - paramNames = paramNames + parameter.Name + ", "; + paramNames = paramNames + EscapeName(parameter.Name) + ", "; - sb.Append($"-- @tparam {ConvertTypeName(parameter.ParameterType.Name)} {parameter.Name}\n"); + sb.Append($"-- @tparam {ConvertTypeName(parameter.ParameterType.Name)} {EscapeName(parameter.Name)}\n"); } if (method.ReturnType != typeof(void)) @@ -113,7 +169,7 @@ namespace Barotrauma sb.Append($"---\n"); sb.Append($"-- "); - var name = field.Name; + var name = EscapeName(field.Name); var returnName = ConvertTypeName(field.FieldType.Name); @@ -135,7 +191,7 @@ namespace Barotrauma sb.Append($"---\n"); sb.Append($"-- "); - var name = property.Name; + var name = EscapeName(property.Name); var returnName = ConvertTypeName(property.PropertyType.Name); @@ -151,7 +207,7 @@ namespace Barotrauma } } - File.WriteAllText("luadocs.lua", sb.ToString()); + File.WriteAllText(fileresult, sb.ToString()); } } } \ No newline at end of file diff --git a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaSetup.cs b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaSetup.cs index df5d382ec..5a57e7930 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaSetup.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaSetup.cs @@ -401,7 +401,7 @@ namespace Barotrauma lua.Globals["SERVER"] = isServer; lua.Globals["CLIENT"] = !isServer; - // LuaDocs.GenerateDocs(typeof(EntitySpawner)); + // LuaDocs.GenerateDocsAll(); if (File.Exists("Lua/LuaSetup.lua")) // try the default loader DoFile("Lua/LuaSetup.lua"); diff --git a/config.ld b/config.ld index 8d2c665fc..be79c6efe 100644 --- a/config.ld +++ b/config.ld @@ -18,7 +18,7 @@ format = "markdown" ignore = true topics = "docs/manual" use_markdown_titles = true -kind_names = {module = "Classes", topic = "Manual"} +kind_names = {topic = "Manual", module = "Classes"} merge = true sort = true sort_modules = true @@ -47,7 +47,6 @@ custom_display_name_handler = function(item, default_handler) return default_handler(item) end - new_type("code", "Code", true) new_type("enum", "Enum", true) @@ -65,6 +64,7 @@ tparam_alias("PhysicsBody", "PhysicsBody") tparam_alias("JobPrefab", "JobPrefab") tparam_alias("Job", "Job") tparam_alias("Inventory", "Inventory") +tparam_alias("Camera", "Camera") tparam_alias("string", "string") diff --git a/docs/CSharpUtils.lua b/docs/CSharpUtils.lua deleted file mode 100644 index 2dee42fca..000000000 --- a/docs/CSharpUtils.lua +++ /dev/null @@ -1,27 +0,0 @@ - -local class = "" - -local generatedDocs = "" - -local function addline(line) - generatedDocs = generatedDocs .. line .. "\n" -end - -for line, _ in io.lines("input.txt") do - local words = {} - for word in line:gmatch("%w+") do table.insert(words, word) end - - if words[1] == "Float" then words[1] = "number" end - if words[1] == "Bool" then words[1] = "bool" end - if words[1] == "String" then words[1] = "string" end - - addline("---") - addline("-- " .. words[2] .. ", returns a " .. words[1] .. ".") - addline("-- @realm shared") - addline("-- @" .. words[1] .. " " .. words[2]) - addline("") - - Character = {} -end - -print(generatedDocs) \ No newline at end of file diff --git a/docs/baseluadocs/Character.lua b/docs/baseluadocs/Character.lua new file mode 100644 index 000000000..c2a321220 --- /dev/null +++ b/docs/baseluadocs/Character.lua @@ -0,0 +1,35 @@ +-- 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 +-- @pragma nostrip + +local Character = {} + +--- Creates a Character using CharacterInfo. +-- @treturn Character +-- @realm server +-- @usage +-- local vsauce = CharacterInfo("human", "VSAUCE HERE") +-- local character = Character.Create(vsauce, Vector2(0, 0), "some random characters") +-- print(character) +function Character.Create(characterInfo, position, seed, id, isRemotePlayer, hasAi, ragdollParams) end + + +--- Teleports a character to a position. +-- @realm server +-- @tparam Vector2 position +-- @usage +-- Character.CharacterList[1].TeleportTo(Vector2(0, 0)) -- teleports first created characters to 0, 0 +function TeleportTo(position) end + + +--- +-- Character.CharacterList, Table containing all characters. +-- @realm shared +-- @Character Character.CharacterList + diff --git a/docs/baseluadocs/CharacterInfo.lua b/docs/baseluadocs/CharacterInfo.lua new file mode 100644 index 000000000..f0501c011 --- /dev/null +++ b/docs/baseluadocs/CharacterInfo.lua @@ -0,0 +1,11 @@ +-- 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 +-- @pragma nostrip + +local CharacterInfo = {} \ No newline at end of file diff --git a/docs/baseluadocs/Client.lua b/docs/baseluadocs/Client.lua new file mode 100644 index 000000000..39544ed37 --- /dev/null +++ b/docs/baseluadocs/Client.lua @@ -0,0 +1,31 @@ +-- 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 +-- @pragma nostrip + +local Client = {} + +--- Sets the client character. +-- @realm server +function SetClientCharacter(character) end + +--- Kick a client. +-- @realm server +function Kick(reason) end + +--- Ban a client. +-- @realm server +function Ban(reason, range, seconds) end + +--- Checks permissions, Client.Permissions. +-- @realm server +function CheckPermission(permissions) end + +--- Unban a client. +-- @realm server +function Client.Unban(player, endpoint) end diff --git a/docs/baseluadocs/Entity.Spawner.lua b/docs/baseluadocs/Entity.Spawner.lua new file mode 100644 index 000000000..8c789af5a --- /dev/null +++ b/docs/baseluadocs/Entity.Spawner.lua @@ -0,0 +1,9 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma EntitySpawner class with some additional functions and fields + +Barotrauma source code: [EntitySpawner.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Networking/EntitySpawner.cs) +]] +-- @code Entity.Spawner +-- @pragma nostrip diff --git a/docs/baseluadocs/Entity.lua b/docs/baseluadocs/Entity.lua new file mode 100644 index 000000000..46f508dce --- /dev/null +++ b/docs/baseluadocs/Entity.lua @@ -0,0 +1,9 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma Entity class with some additional functions and fields + +Barotrauma source code: [Entity.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Map/Entity.cs) +]] +-- @code Entity +-- @pragma nostrip \ No newline at end of file diff --git a/docs/baseluadocs/GameScreen.lua b/docs/baseluadocs/GameScreen.lua new file mode 100644 index 000000000..74ed1ad65 --- /dev/null +++ b/docs/baseluadocs/GameScreen.lua @@ -0,0 +1,8 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma.GameScreen +]] +-- @code Game.GameScreen +-- @pragma nostrip +local GameScreen = {} \ No newline at end of file diff --git a/docs/baseluadocs/GameSession.lua b/docs/baseluadocs/GameSession.lua new file mode 100644 index 000000000..02b3cbe53 --- /dev/null +++ b/docs/baseluadocs/GameSession.lua @@ -0,0 +1,8 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma.GameSession +]] +-- @code Game.GameSession +-- @pragma nostrip +local GameSession = {} \ No newline at end of file diff --git a/docs/baseluadocs/Item.lua b/docs/baseluadocs/Item.lua new file mode 100644 index 000000000..52d0e110f --- /dev/null +++ b/docs/baseluadocs/Item.lua @@ -0,0 +1,46 @@ +-- 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 +-- @pragma nostrip + +Item = {} + +--- Adds to remove queue, use this instead of Remove, to prevent desync. +-- @realm server +function Item.AddToRemoveQueue(item) end + +--- Gets a component from an item by a string name. +-- @treturn Component component +-- @realm server +function GetComponentString(componentName) end + +--- Sends a signal. +-- @realm server +function SendSignal(signalOrString, connectionOrConnectionName) end + +--- +-- Physics body of the item. +-- @realm shared +-- @PhysicsBody body +-- @usage +-- Item.ItemList[1].body.position = CreateVector2(0, 0) -- teleports first item created to 0, 0 of the level + +--- +-- Item.ItemList, Table containing all items. +-- @realm shared +-- @Item Item.ItemList + +--- +-- Prefab, ItemPrefab containing the original prefab of the item. +-- @realm shared +-- @ItemPrefab Prefab + +--- +-- WorldPosition, Vector2 position of the item in the world +-- @realm shared +-- @Vector2 WorldPosition diff --git a/docs/baseluadocs/ItemPrefab.lua b/docs/baseluadocs/ItemPrefab.lua new file mode 100644 index 000000000..b4e175dfb --- /dev/null +++ b/docs/baseluadocs/ItemPrefab.lua @@ -0,0 +1,36 @@ +-- 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 +-- @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 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 ItemPrefab.AddToSpawnQueue(itemPrefab, inventory, spawned) end + +--- Get a item prefab via name or id +-- @tparam string itemNameOrId +-- @treturn ItemPrefab +-- @realm shared +function ItemPrefab.GetItemPrefab(itemNameOrId) end + +--- +-- Identifier, the identifier of the prefab. +-- @realm shared +-- @string Identifier diff --git a/docs/baseluadocs/Job.lua b/docs/baseluadocs/Job.lua new file mode 100644 index 000000000..ff7a24d0d --- /dev/null +++ b/docs/baseluadocs/Job.lua @@ -0,0 +1,11 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma Job class with some additional functions and fields + +Barotrauma source code: [Job.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs) +]] +-- @code Job +-- @pragma nostrip + +local Job = {} diff --git a/docs/baseluadocs/JobPrefab.lua b/docs/baseluadocs/JobPrefab.lua new file mode 100644 index 000000000..ef0b72b66 --- /dev/null +++ b/docs/baseluadocs/JobPrefab.lua @@ -0,0 +1,11 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma JobPrefab class with some additional functions and fields + +Barotrauma source code: [JobPrefab.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs) +]] +-- @code JobPrefab +-- @pragma nostrip + +local JobPrefab = {} \ No newline at end of file diff --git a/docs/baseluadocs/NetLobbyScreen.lua b/docs/baseluadocs/NetLobbyScreen.lua new file mode 100644 index 000000000..9dea71831 --- /dev/null +++ b/docs/baseluadocs/NetLobbyScreen.lua @@ -0,0 +1,8 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma.NetLobbyScreen +]] +-- @code Game.NetLobbyScreen +-- @pragma nostrip +local NetLobbyScreen = {} \ No newline at end of file diff --git a/docs/baseluadocs/Submarine.lua b/docs/baseluadocs/Submarine.lua new file mode 100644 index 000000000..039c193a6 --- /dev/null +++ b/docs/baseluadocs/Submarine.lua @@ -0,0 +1,13 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma Submarine class with some additional functions and fields + +Barotrauma source code: [Submarine.cs](https://github.com/evilfactory/Barotrauma-lua-attempt/blob/master/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs) + +Not all fields and methods will work, this doc was autogenerated. +]] +-- @code Submarine +-- @pragma nostrip + +local Submarine = {} \ No newline at end of file diff --git a/docs/baseluadocs/World.lua b/docs/baseluadocs/World.lua new file mode 100644 index 000000000..8c3f25907 --- /dev/null +++ b/docs/baseluadocs/World.lua @@ -0,0 +1,8 @@ +-- luacheck: ignore 111 + +--[[-- +FarseerPhysics.Dynamics.World +]] +-- @code Game.World +-- @pragma nostrip +local World = {} \ No newline at end of file diff --git a/docs/build_docs.bat b/docs/build_docs.bat index 0d77209c3..2cc1e0904 100644 --- a/docs/build_docs.bat +++ b/docs/build_docs.bat @@ -1,5 +1,5 @@ xcopy css html /Y xcopy js html /Y cd .. -lua D:\programming\lua\LDoc\ldoc.lua . +lua B:\programming\lua\LDoc\ldoc.lua . cd docs \ No newline at end of file diff --git a/docs/input.txt b/docs/input.txt deleted file mode 100644 index 2177a281e..000000000 --- a/docs/input.txt +++ /dev/null @@ -1,50 +0,0 @@ -Bool IsRemotelyControlled -Bool IsObserving -Bool IsBot -Bool IsDead -Bool IsHuman -Bool IsMale -Bool IsFemale -Bool CanSpeak -Bool NeedsAir -Bool NeedsWater -Bool NeedsOxygen -Bool IsTraitor -Bool HideFace -Bool LockHands -Bool CanMove -Bool CanInteract -Bool ObstructVision -Bool IsRagdolled -Bool IsIncapacitated -Bool IsUnconscious -Bool IsPet -Bool UseHullOxygen -Bool CanBeSelected -Bool CanBeDragged -Bool CanInventoryBeAccessed -Bool GodMode -Bool IsInFriendlySub -Vector2 Position -Vector2 DrawPosition -Vector2 CursorPosition -Vector2 SmoothedCursorPosition -Vector2 CursorWorldPosition -Float LowPassMultiplier -Float Oxygen -Float OxygenAvailable -Float Stun -Float Vitality -Float MaxVitality -Float Health -Float HealthPercentage -Float SpeechImpediment -Float PressureTimer -Float CurrentSpeed -Item FocusedItem -Item PickingItem -String Name -String DisplayName -String LogName -CharacterInventory Inventory -CauseOfDeath CauseOfDeath \ No newline at end of file diff --git a/docs/lua/Game.lua b/docs/lua/Game.lua index 5c8a4ca29..33fe16017 100644 --- a/docs/lua/Game.lua +++ b/docs/lua/Game.lua @@ -57,6 +57,14 @@ function Game.OverrideSignalRadio(override) end -- @realm server function Game.DisableSpamFilter(override) end +--- True to disable character disconnect logic, aka stop character from being automatically stunned and killed. +-- @realm server +function Game.DisableDisconnectCharacter(override) end + +--- True to allow husks to carry control to players. +-- @realm server +function Game.EnableControlHusk(override) end + --- Log message to server logs. -- @realm server function Game.Log(message, ServerLogMessageType) end @@ -90,4 +98,16 @@ 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 Game.GetEnabledPackagesDirectlyFromFile() end \ No newline at end of file +function Game.GetEnabledPackagesDirectlyFromFile() end + +--- Adds a new command, onExecute is called with a table of strings. +-- @realm shared +function Game.AddCommand(name, help, onExecute, getValidArgs, isCheat) end + +--- Assigns a command for server on execute, onExecute is called with a table of strings. +-- @realm shared +function Game.AssignOnExecute(names, onExecute) end + +--- Assigns a command for client on execute, onExecute is called with a client, mouse position and a table of strings. +-- @realm server +function Game.AssignOnClientRequestExecute(names, onExecute) end \ No newline at end of file diff --git a/docs/lua/Hooks.lua b/docs/lua/Hooks.lua index 0a403ffe6..05a37efb1 100644 --- a/docs/lua/Hooks.lua +++ b/docs/lua/Hooks.lua @@ -38,16 +38,16 @@ function Hook.Remove(eventname, hookname) end -- end) function Hook.Call(eventname, parameters) end +--- Game's fixed update rate, gets called normally 60 times a second. +-- @realm shared +function think() 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 @@ -58,7 +58,6 @@ function clientConnected(connectedClient) end -- @realm shared function clientDisconnected(disconnectedClient) end - --- Called on round start -- @realm shared function roundStart() end @@ -129,18 +128,55 @@ function inventoryItemSwap(inventory, item, characterUser, index, swapWholeStack --- -- @realm shared function changeFallDamage() end + --- Gets called every update when a gap passes oxygen -- @realm shared function gapOxygenUpdate(gap, hull1, hull2) end + --- Gets called everytime an Item receives a wire signal -- @realm shared -function signalReceived(connection, signal) end +function signalReceived(signal, connection) end + --- Same as signalReceived, but gets called only when needed by specifying your component, better performance. -- @realm shared -function signalReceived.YourComponentIdentifier(connection, signal) end +function signalReceived.YourComponentIdentifier(signal, connection) end + --- Gets called everytime a WifiComponent starts transmitting a signal -- @realm shared function wifiSignalTransmitted(wifiComponent, signal, sentFromChat) end ---- Gets called everytime something is logged to the Server Log + +--- Gets called everytime something is logged to the Server Log, do not call print() inside this function, i repeat, do not call print() inside this function. -- @realm shared -function serverLog(text, serverLogMessageType) end \ No newline at end of file +function serverLog(text, serverLogMessageType) end + +--- Called each time a new round start job has been assigned, this context allows for you to change the role before it's applied in game. +-- @realm shared +function jobAssigned(text, serverLogMessageType) end + +--- Check if a client is allowed to hear radio voice to another client, return true to allow, false to disallow. +-- @realm shared +function canUseVoiceRadio(sender, receiver) end + +--- Changes the local voice range, return a number to change the local voice range, 1 = normal, 0.5 = lower range, 2 = higher range. +-- @realm shared +function changeLocalVoiceRange(sender, receiver) end + +--- Called right before a message is going to be sent, return true to stop message from being sent. +-- @realm shared +function modifyChatMessage(chatMessage, wifiComponentSender) end + +--- Called when the script execution is terminating. +-- @realm shared +function stop() end + +--- +-- @realm shared +function husk.clientControl(client, husk) end + +--- +-- @realm shared +function traitor.traitorAssigned(traitor) end + +--- Return true to accept traitor candidate. +-- @realm shared +function traitor.findTraitorCandidate(character, team) end \ No newline at end of file diff --git a/docs/lua/Networking.lua b/docs/lua/Networking.lua index 7c7b1feea..d0890dceb 100644 --- a/docs/lua/Networking.lua +++ b/docs/lua/Networking.lua @@ -32,3 +32,8 @@ function Networking.Send(netMessage, connection, deliveryMethod) end --- Adds a function to listen for lua net messages -- @realm shared function Networking.Receive(netMessageName, callback) end + +--- Writes again the lobby data of a client, useful for syncing submarine lists or other lobby options. +-- @realm server +function Networking.ClientWriteLobby(client) end + diff --git a/docs/lua/Timer.lua b/docs/lua/Timer.lua index a3ced874d..1a4a33cb6 100644 --- a/docs/lua/Timer.lua +++ b/docs/lua/Timer.lua @@ -11,4 +11,16 @@ Timer = {} --- Get time in seconds. -- @treturn number current time in seconds -- @realm shared -function Timer.GetTime() end \ No newline at end of file +function Timer.GetTime() end + +--- Calls a function after a certain amount of time. +-- @realm shared +function Timer.Wait(func, milliseconds) end + +--- Calls a function after a certain amount of time. +-- @realm shared +function Timer.GetUsageMemory() end + +--- Same as GetTime() +-- @realm shared +Timer.Time = 0 \ No newline at end of file diff --git a/docs/lua/enums/CauseOfDeathType.lua b/docs/lua/enums/CauseOfDeathType.lua new file mode 100644 index 000000000..a564a6513 --- /dev/null +++ b/docs/lua/enums/CauseOfDeathType.lua @@ -0,0 +1,39 @@ +--[[-- +CauseOfDeathType enum. +]] +-- @enum CauseOfDeathType + +--- +-- CauseOfDeathType.Unknown = 0 +-- @realm shared +-- @number CauseOfDeathType.Unknown + +--- +-- CauseOfDeathType.Pressure = 1 +-- @realm shared +-- @number CauseOfDeathType.Pressure + +--- +-- CauseOfDeathType.Suffocation = 2 +-- @realm shared +-- @number CauseOfDeathType.Suffocation + +--- +-- CauseOfDeathType.Drowning = 3 +-- @realm shared +-- @number CauseOfDeathType.Drowning + +--- +-- CauseOfDeathType.Drowning = 3 +-- @realm shared +-- @number CauseOfDeathType.Drowning + +--- +-- CauseOfDeathType.Affliction = 4 +-- @realm shared +-- @number CauseOfDeathType.Affliction + +--- +-- CauseOfDeathType.Disconnected = 5 +-- @realm shared +-- @number CauseOfDeathType.Disconnected \ No newline at end of file diff --git a/docs/lua/enums/ServerLogMessageType.lua b/docs/lua/enums/ServerLogMessageType.lua new file mode 100644 index 000000000..ec6135721 --- /dev/null +++ b/docs/lua/enums/ServerLogMessageType.lua @@ -0,0 +1,54 @@ +--[[-- +ServerLogMessageType enum. +]] +-- @enum ServerLogMessageType + +--- +-- ServerLogMessageType.Chat = 0 +-- @realm shared +-- @number ServerLogMessageType.Chat + +--- +-- ServerLogMessageType.ItemInteraction = 1 +-- @realm shared +-- @number ServerLogMessageType.ItemInteraction + +--- +-- ServerLogMessageType.Inventory = 2 +-- @realm shared +-- @number ServerLogMessageType.Inventory + +--- +-- ServerLogMessageType.Attack = 3 +-- @realm shared +-- @number ServerLogMessageType.Attack + +--- +-- ServerLogMessageType.Spawning = 4 +-- @realm shared +-- @number ServerLogMessageType.Spawning + +--- +-- ServerLogMessageType.Wiring = 5 +-- @realm shared +-- @number ServerLogMessageType.Wiring + +--- +-- ServerLogMessageType.ServerMessage = 6 +-- @realm shared +-- @number ServerLogMessageType.ServerMessage + +--- +-- ServerLogMessageType.ConsoleUsage = 7 +-- @realm shared +-- @number ServerLogMessageType.ConsoleUsage + +--- +-- ServerLogMessageType.Karma = 8 +-- @realm shared +-- @number ServerLogMessageType.Karma + +--- +-- ServerLogMessageType.Error = 9 +-- @realm shared +-- @number ServerLogMessageType.Error \ No newline at end of file diff --git a/docs/lua/Character.lua b/docs/lua/generated/Character.lua similarity index 86% rename from docs/lua/Character.lua rename to docs/lua/generated/Character.lua index 3820a0564..42d77bd35 100644 --- a/docs/lua/Character.lua +++ b/docs/lua/generated/Character.lua @@ -9,8 +9,6 @@ Barotrauma source code: [Character.cs](https://github.com/evilfactory/Barotrauma -- @pragma nostrip local Character = {} --- @field public name string @add name field to class Car, you'll see it in code completion - --- Creates a Character using CharacterInfo. -- @treturn Character @@ -35,7 +33,42 @@ function TeleportTo(position) end -- @realm shared -- @Character Character.CharacterList ---------- AUTO DOCS ------------ + + +--- Revive +-- @realm shared +-- @tparam bool removeAllAfflictions +function Revive(removeAllAfflictions) end + +--- Remove +-- @realm shared +function Remove() end + +--- TeleportTo +-- @realm shared +-- @tparam Vector2 worldPos +function TeleportTo(worldPos) end + +--- SaveInventory +-- @realm shared +-- @tparam Inventory inventory +-- @tparam XElement parentElement +function Character.SaveInventory(inventory, parentElement) end + +--- SaveInventory +-- @realm shared +function SaveInventory() end + +--- SpawnInventoryItems +-- @realm shared +-- @tparam Inventory inventory +-- @tparam XElement itemData +function SpawnInventoryItems(inventory, itemData) end + +--- GetAttackContexts +-- @realm shared +-- @treturn IEnumerable`1 +function GetAttackContexts() end --- GetVisibleHulls -- @realm shared @@ -60,10 +93,163 @@ function HasJob(identifier) end -- @treturn bool function IsProtectedFromPressure() end +--- LoadTalents +-- @realm shared +function LoadTalents() end + +--- GiveTalent +-- @realm shared +-- @tparam string talentIdentifier +-- @tparam bool addingFirstTime +-- @treturn bool +function GiveTalent(talentIdentifier, addingFirstTime) end + +--- GiveTalent +-- @realm shared +-- @tparam number talentIdentifier +-- @tparam bool addingFirstTime +-- @treturn bool +function GiveTalent(talentIdentifier, addingFirstTime) end + +--- GiveTalent +-- @realm shared +-- @tparam TalentPrefab talentPrefab +-- @tparam bool addingFirstTime +-- @treturn bool +function GiveTalent(talentPrefab, addingFirstTime) end + +--- HasTalent +-- @realm shared +-- @tparam string identifier +-- @treturn bool +function HasTalent(identifier) end + +--- GetFriendlyCrew +-- @realm shared +-- @tparam Character character +-- @treturn IEnumerable`1 +function Character.GetFriendlyCrew(character) end + +--- HasTalents +-- @realm shared +-- @treturn bool +function HasTalents() end + +--- CheckTalents +-- @realm shared +-- @tparam AbilityEffectType abilityEffectType +-- @tparam AbilityObject abilityObject +function CheckTalents(abilityEffectType, abilityObject) end + +--- CheckTalents +-- @realm shared +-- @tparam AbilityEffectType abilityEffectType +function CheckTalents(abilityEffectType) end + +--- HasRecipeForItem +-- @realm shared +-- @tparam string recipeIdentifier +-- @treturn bool +function HasRecipeForItem(recipeIdentifier) end + +--- GiveMoney +-- @realm shared +-- @tparam number amount +function GiveMoney(amount) end + +--- SetMoney +-- @realm shared +-- @tparam number amount +function SetMoney(amount) end + +--- GetStatValue +-- @realm shared +-- @tparam StatTypes statType +-- @treturn number +function GetStatValue(statType) end + +--- OnWearablesChanged +-- @realm shared +function OnWearablesChanged() end + +--- ChangeStat +-- @realm shared +-- @tparam StatTypes statType +-- @tparam number value +function ChangeStat(statType, value) end + +--- GetSkillStatType +-- @realm shared +-- @tparam string skillIdentifier +-- @treturn StatTypes +function Character.GetSkillStatType(skillIdentifier) end + +--- AddAbilityFlag +-- @realm shared +-- @tparam AbilityFlags abilityFlag +function AddAbilityFlag(abilityFlag) end + +--- RemoveAbilityFlag +-- @realm shared +-- @tparam AbilityFlags abilityFlag +function RemoveAbilityFlag(abilityFlag) end + +--- HasAbilityFlag +-- @realm shared +-- @tparam AbilityFlags abilityFlag +-- @treturn bool +function HasAbilityFlag(abilityFlag) end + +--- GetAbilityResistance +-- @realm shared +-- @tparam AfflictionPrefab affliction +-- @treturn number +function GetAbilityResistance(affliction) end + +--- ChangeAbilityResistance +-- @realm shared +-- @tparam string resistanceId +-- @tparam number value +function ChangeAbilityResistance(resistanceId, value) end + +--- IsFriendly +-- @realm shared +-- @tparam Character other +-- @treturn bool +function IsFriendly(other) end + +--- IsFriendly +-- @realm shared +-- @tparam Character me +-- @tparam Character other +-- @treturn bool +function Character.IsFriendly(me, other) end + --- ResetNetState -- @realm shared function ResetNetState() end +--- GetTargetMovement +-- @realm shared +-- @treturn Vector2 +function GetTargetMovement() end + +--- ApplyMovementLimits +-- @realm shared +-- @tparam Vector2 targetMovement +-- @tparam number currentSpeed +-- @treturn Vector2 +function ApplyMovementLimits(targetMovement, currentSpeed) end + +--- StackSpeedMultiplier +-- @realm shared +-- @tparam number val +function StackSpeedMultiplier(val) end + +--- ResetSpeedMultiplier +-- @realm shared +function ResetSpeedMultiplier() end + --- StackHealthMultiplier -- @realm shared -- @tparam number val @@ -177,8 +363,8 @@ function CanAccessInventory(inventory) end -- @tparam bool ignoreBroken -- @tparam IEnumerable`1 ignoredItems -- @tparam IEnumerable`1 ignoredContainerIdentifiers --- @tparam Func`2 customPredicate --- @tparam Func`2 customPriorityFunction +-- @tparam function customPredicate +-- @tparam function customPriorityFunction -- @tparam number maxItemDistance -- @tparam ISpatialEntity positionalReference -- @treturn bool @@ -216,7 +402,7 @@ function CanInteractWith(item, distanceToItem, checkLinked) end --- SetCustomInteract -- @realm shared --- @tparam Action`2 onCustomInteract +-- @tparam function onCustomInteract -- @tparam string hudText function SetCustomInteract(onCustomInteract, hudText) end @@ -374,8 +560,9 @@ function TrySeverLimbJoints(targetLimb, severLimbsProbability, damage, allowBehe -- @tparam bool playSound -- @tparam number attackImpulse -- @tparam Character attacker +-- @tparam number damageMultiplier -- @treturn AttackResult -function AddDamage(worldPosition, afflictions, stun, playSound, attackImpulse, attacker) end +function AddDamage(worldPosition, afflictions, stun, playSound, attackImpulse, attacker, damageMultiplier) end --- AddDamage -- @realm shared @@ -412,8 +599,9 @@ function AddEncounter(other) end -- @tparam number damageMultiplier -- @tparam bool allowStacking -- @tparam number penetration +-- @tparam bool shouldImplode -- @treturn AttackResult -function DamageLimb(worldPosition, hitLimb, afflictions, stun, playSound, attackImpulse, attacker, damageMultiplier, allowStacking, penetration) end +function DamageLimb(worldPosition, hitLimb, afflictions, stun, playSound, attackImpulse, attacker, damageMultiplier, allowStacking, penetration, shouldImplode) end --- TryAdjustAttackerSkill -- @realm shared @@ -430,7 +618,7 @@ function SetStun(newStun, allowStunDecrease, isNetworkMessage) end --- ApplyStatusEffects -- @realm shared --- @tparam ActionType actionType +-- @tparam function actionType -- @tparam number deltaTime function ApplyStatusEffects(actionType, deltaTime) end @@ -446,35 +634,6 @@ function BreakJoints() end -- @tparam bool log function Kill(causeOfDeath, causeOfDeathAffliction, isNetworkMessage, log) end ---- Revive --- @realm shared -function Revive() end - ---- Remove --- @realm shared -function Remove() end - ---- SaveInventory --- @realm shared --- @tparam Inventory inventory --- @tparam XElement parentElement -function Character.SaveInventory(inventory, parentElement) end - ---- SaveInventory --- @realm shared -function SaveInventory() end - ---- SpawnInventoryItems --- @realm shared --- @tparam Inventory inventory --- @tparam XElement itemData -function SpawnInventoryItems(inventory, itemData) end - ---- GetAttackContexts --- @realm shared --- @treturn IEnumerable`1 -function GetAttackContexts() end - --- Create -- @realm shared -- @tparam CharacterInfo characterInfo @@ -555,7 +714,8 @@ function GiveJobItems(spawnPoint) end --- GiveIdCardTags -- @realm shared -- @tparam WayPoint spawnPoint -function GiveIdCardTags(spawnPoint) end +-- @tparam bool createNetworkEvent +function GiveIdCardTags(spawnPoint, createNetworkEvent) end --- GetSkillLevel -- @realm shared @@ -563,27 +723,6 @@ function GiveIdCardTags(spawnPoint) end -- @treturn number function GetSkillLevel(skillIdentifier) end ---- GetTargetMovement --- @realm shared --- @treturn Vector2 -function GetTargetMovement() end - ---- ApplyMovementLimits --- @realm shared --- @tparam Vector2 targetMovement --- @tparam number currentSpeed --- @treturn Vector2 -function ApplyMovementLimits(targetMovement, currentSpeed) end - ---- StackSpeedMultiplier --- @realm shared --- @tparam number val -function StackSpeedMultiplier(val) end - ---- ResetSpeedMultiplier --- @realm shared -function ResetSpeedMultiplier() end - --- GetPositionUpdateInterval -- @realm shared -- @tparam Client recipient @@ -734,11 +873,26 @@ function GetHashCode() end -- @realm shared -- @Character LastAttacker +--- +-- LastOrderedCharacter, Field of type Character +-- @realm shared +-- @Character LastOrderedCharacter + +--- +-- SecondLastOrderedCharacter, Field of type Character +-- @realm shared +-- @Character SecondLastOrderedCharacter + --- -- SpeciesName, Field of type string -- @realm shared -- @string SpeciesName +--- +-- Group, Field of type string +-- @realm shared +-- @string Group + --- -- IsHumanoid, Field of type bool -- @realm shared @@ -894,6 +1048,11 @@ function GetHashCode() end -- @realm shared -- @bool CanInteract +--- +-- CanEat, Field of type bool +-- @realm shared +-- @bool CanEat + --- -- CursorPosition, Field of type Vector2 -- @realm shared @@ -944,6 +1103,11 @@ function GetHashCode() end -- @realm shared -- @number PressureProtection +--- +-- InPressure, Field of type bool +-- @realm shared +-- @bool InPressure + --- -- IsIncapacitated, Field of type bool -- @realm shared @@ -1004,6 +1168,21 @@ function GetHashCode() end -- @realm shared -- @number MaxVitality +--- +-- MaxHealth, Field of type number +-- @realm shared +-- @number MaxHealth + +--- +-- AIState, Field of type AIState +-- @realm shared +-- @AIState AIState + +--- +-- IsLatched, Field of type bool +-- @realm shared +-- @bool IsLatched + --- -- Bloodloss, Field of type number -- @realm shared @@ -1059,11 +1238,6 @@ function GetHashCode() end -- @realm shared -- @bool IsDead ---- --- IsObserving, Field of type bool --- @realm shared --- @bool IsObserving - --- -- EnableDespawn, Field of type bool -- @realm shared @@ -1254,6 +1428,11 @@ function GetHashCode() end -- @realm shared -- @AITarget AiTarget +--- +-- InDetectable, Field of type bool +-- @realm shared +-- @bool InDetectable + --- -- SpawnTime, Field of type number -- @realm shared @@ -1304,6 +1483,11 @@ function GetHashCode() end -- @realm shared -- @HumanPrefab Prefab +--- +-- Latchers, Field of type HashSet`1 +-- @realm shared +-- @HashSet`1 Latchers + --- -- CombatAction, Field of type CombatAction -- @realm shared @@ -1434,6 +1618,11 @@ function GetHashCode() end -- @realm shared -- @Character Character.Controlled +--- +-- Character.CharacterList, Field of type table +-- @realm shared +-- @table Character.CharacterList + --- -- Character.KnockbackCooldown, Field of type number -- @realm shared diff --git a/docs/lua/CharacterInfo.lua b/docs/lua/generated/CharacterInfo.lua similarity index 63% rename from docs/lua/CharacterInfo.lua rename to docs/lua/generated/CharacterInfo.lua index 6bd6e857c..35eebba0e 100644 --- a/docs/lua/CharacterInfo.lua +++ b/docs/lua/generated/CharacterInfo.lua @@ -10,131 +10,88 @@ Barotrauma source code: [CharacterInfo.cs](https://github.com/evilfactory/Barotr local CharacterInfo = {} ---- ApplyHealthData +--- RefreshHead -- @realm shared --- @tparam Character character --- @tparam XElement healthData -function CharacterInfo.ApplyHealthData(character, healthData) end - ---- ReloadHeadAttachments --- @realm shared -function ReloadHeadAttachments() end - ---- ResetHeadAttachments --- @realm shared -function ResetHeadAttachments() end - ---- ClearCurrentOrders --- @realm shared -function ClearCurrentOrders() end - ---- Remove --- @realm shared -function Remove() end - ---- Create --- @realm shared --- @tparam string speciesName --- @tparam string name --- @tparam JobPrefab jobPrefab --- @tparam string ragdollFileName --- @tparam number variant --- @tparam RandSync randSync --- @tparam string npcIdentifier --- @treturn CharacterInfo --- @usage --- local vsauce = CharacterInfo("human", "VSAUCE HERE") --- local character = Character.Create(vsauce, Vector2(0, 0), "some random characters") --- print(character) -function CharacterInfo(speciesName, name, jobPrefab, ragdollFileName, variant, randSync, npcIdentifier) end - ---- ServerWrite --- @realm shared --- @tparam IWriteMessage msg -function ServerWrite(msg) end - ---- CheckDisguiseStatus --- @realm shared --- @tparam bool handleBuff --- @tparam IdCard idCard -function CheckDisguiseStatus(handleBuff, idCard) end - ---- GetRandomGender --- @realm shared --- @tparam RandSync randSync --- @treturn Gender -function GetRandomGender(randSync) end - ---- GetRandomRace --- @realm shared --- @tparam RandSync randSync --- @treturn Race -function GetRandomRace(randSync) end - ---- GetRandomHeadID --- @realm shared --- @tparam RandSync randSync --- @treturn number -function GetRandomHeadID(randSync) end - ---- GetIdentifier --- @realm shared --- @treturn number -function GetIdentifier() end - ---- GetIdentifierUsingOriginalName --- @realm shared --- @treturn number -function GetIdentifierUsingOriginalName() end - ---- FilterByTypeAndHeadID --- @realm shared --- @tparam IEnumerable`1 elements --- @tparam WearableType targetType --- @tparam number headSpriteId --- @treturn IEnumerable`1 -function FilterByTypeAndHeadID(elements, targetType, headSpriteId) end - ---- FilterElementsByGenderAndRace --- @realm shared --- @tparam IEnumerable`1 elements --- @tparam Gender gender --- @tparam Race race --- @treturn IEnumerable`1 -function FilterElementsByGenderAndRace(elements, gender, race) end - ---- RecreateHead --- @realm shared --- @tparam number headID --- @tparam Race race --- @tparam Gender gender --- @tparam number hairIndex --- @tparam number beardIndex --- @tparam number moustacheIndex --- @tparam number faceAttachmentIndex -function RecreateHead(headID, race, gender, hairIndex, beardIndex, moustacheIndex, faceAttachmentIndex) end - ---- LoadHeadSprite --- @realm shared -function LoadHeadSprite() end +function RefreshHead() end --- LoadHeadAttachments -- @realm shared function LoadHeadAttachments() end +--- AddEmpty +-- @realm shared +-- @tparam IEnumerable`1 elements +-- @tparam WearableType type +-- @tparam number commonness +-- @treturn table +function CharacterInfo.AddEmpty(elements, type, commonness) end + +--- GetRandomElement +-- @realm shared +-- @tparam IEnumerable`1 elements +-- @treturn XElement +function GetRandomElement(elements) end + +--- IsValidIndex +-- @realm shared +-- @tparam number index +-- @tparam table list +-- @treturn bool +function CharacterInfo.IsValidIndex(index, list) end + --- IncreaseSkillLevel -- @realm shared -- @tparam string skillIdentifier -- @tparam number increase --- @tparam Vector2 pos -function IncreaseSkillLevel(skillIdentifier, increase, pos) end +-- @tparam bool gainedFromApprenticeship +function IncreaseSkillLevel(skillIdentifier, increase, gainedFromApprenticeship) end --- SetSkillLevel -- @realm shared -- @tparam string skillIdentifier -- @tparam number level --- @tparam Vector2 pos -function SetSkillLevel(skillIdentifier, level, pos) end +function SetSkillLevel(skillIdentifier, level) end + +--- GiveExperience +-- @realm shared +-- @tparam number amount +-- @tparam bool isMissionExperience +function GiveExperience(amount, isMissionExperience) end + +--- SetExperience +-- @realm shared +-- @tparam number newExperience +function SetExperience(newExperience) end + +--- GetTotalTalentPoints +-- @realm shared +-- @treturn number +function GetTotalTalentPoints() end + +--- GetAvailableTalentPoints +-- @realm shared +-- @treturn number +function GetAvailableTalentPoints() end + +--- GetProgressTowardsNextLevel +-- @realm shared +-- @treturn number +function GetProgressTowardsNextLevel() end + +--- GetExperienceRequiredForCurrentLevel +-- @realm shared +-- @treturn number +function GetExperienceRequiredForCurrentLevel() end + +--- GetExperienceRequiredToLevelUp +-- @realm shared +-- @treturn number +function GetExperienceRequiredToLevelUp() end + +--- GetCurrentLevel +-- @realm shared +-- @treturn number +function GetCurrentLevel() end --- Rename -- @realm shared @@ -183,6 +140,177 @@ function ApplyOrderData() end -- @treturn table function CharacterInfo.LoadOrders(ordersElement) end +--- ApplyHealthData +-- @realm shared +-- @tparam Character character +-- @tparam XElement healthData +function CharacterInfo.ApplyHealthData(character, healthData) end + +--- ClearCurrentOrders +-- @realm shared +function ClearCurrentOrders() end + +--- Remove +-- @realm shared +function Remove() end + +--- ClearSavedStatValues +-- @realm shared +function ClearSavedStatValues() end + +--- ClearSavedStatValues +-- @realm shared +-- @tparam StatTypes statType +function ClearSavedStatValues(statType) end + +--- ResetSavedStatValue +-- @realm shared +-- @tparam string statIdentifier +function ResetSavedStatValue(statIdentifier) end + +--- GetSavedStatValue +-- @realm shared +-- @tparam StatTypes statType +-- @treturn number +function GetSavedStatValue(statType) end + +--- GetSavedStatValue +-- @realm shared +-- @tparam StatTypes statType +-- @tparam string statIdentifier +-- @treturn number +function GetSavedStatValue(statType, statIdentifier) end + +--- ChangeSavedStatValue +-- @realm shared +-- @tparam StatTypes statType +-- @tparam number value +-- @tparam string statIdentifier +-- @tparam bool removeOnDeath +-- @tparam bool removeAfterRound +-- @tparam number maxValue +-- @tparam bool setValue +function ChangeSavedStatValue(statType, value, statIdentifier, removeOnDeath, removeAfterRound, maxValue, setValue) end + +--- Create +-- @realm shared +-- @tparam string speciesName +-- @tparam string name +-- @tparam JobPrefab jobPrefab +-- @tparam string ragdollFileName +-- @tparam number variant +-- @tparam RandSync randSync +-- @tparam string npcIdentifier +-- @treturn CharacterInfo +function CharacterInfo.Create(speciesName, name, jobPrefab, ragdollFileName, variant, randSync, npcIdentifier) end + +--- ServerWrite +-- @realm shared +-- @tparam IWriteMessage msg +function ServerWrite(msg) end + +--- GetUnlockedTalentsInTree +-- @realm shared +-- @treturn IEnumerable`1 +function GetUnlockedTalentsInTree() end + +--- GetEndocrineTalents +-- @realm shared +-- @treturn IEnumerable`1 +function GetEndocrineTalents() end + +--- CheckDisguiseStatus +-- @realm shared +-- @tparam bool handleBuff +-- @tparam IdCard idCard +function CheckDisguiseStatus(handleBuff, idCard) end + +--- GetRandomName +-- @realm shared +-- @tparam RandSync randSync +-- @treturn string +function GetRandomName(randSync) end + +--- SelectRandomColor +-- @realm shared +-- @tparam ImmutableArray`1& array +-- @treturn Color +function CharacterInfo.SelectRandomColor(array) end + +--- GetRandomGender +-- @realm shared +-- @tparam RandSync randSync +-- @treturn Gender +function GetRandomGender(randSync) end + +--- GetRandomRace +-- @realm shared +-- @tparam RandSync randSync +-- @treturn Race +function GetRandomRace(randSync) end + +--- GetRandomHeadID +-- @realm shared +-- @tparam RandSync randSync +-- @treturn number +function GetRandomHeadID(randSync) end + +--- GetIdentifier +-- @realm shared +-- @treturn number +function GetIdentifier() end + +--- GetIdentifierUsingOriginalName +-- @realm shared +-- @treturn number +function GetIdentifierUsingOriginalName() end + +--- FilterByTypeAndHeadID +-- @realm shared +-- @tparam IEnumerable`1 elements +-- @tparam WearableType targetType +-- @tparam number headSpriteId +-- @treturn IEnumerable`1 +function FilterByTypeAndHeadID(elements, targetType, headSpriteId) end + +--- FilterElementsByGenderAndRace +-- @realm shared +-- @tparam IEnumerable`1 elements +-- @tparam Gender gender +-- @tparam Race race +-- @treturn IEnumerable`1 +function FilterElementsByGenderAndRace(elements, gender, race) end + +--- IsMatchingGender +-- @realm shared +-- @tparam Gender gender +-- @tparam Gender myGender +-- @treturn bool +function CharacterInfo.IsMatchingGender(gender, myGender) end + +--- IsMatchingRace +-- @realm shared +-- @tparam Race race +-- @tparam Race myRace +-- @treturn bool +function CharacterInfo.IsMatchingRace(race, myRace) end + +--- RecreateHead +-- @realm shared +-- @tparam HeadInfo headInfo +function RecreateHead(headInfo) end + +--- RecreateHead +-- @realm shared +-- @tparam number headID +-- @tparam Race race +-- @tparam Gender gender +-- @tparam number hairIndex +-- @tparam number beardIndex +-- @tparam number moustacheIndex +-- @tparam number faceAttachmentIndex +function RecreateHead(headID, race, gender, hairIndex, beardIndex, moustacheIndex, faceAttachmentIndex) end + --- GetType -- @realm shared -- @treturn Type @@ -234,6 +362,21 @@ function GetHashCode() end -- @realm shared -- @string SpeciesName +--- +-- ExperiencePoints, Field of type number +-- @realm shared +-- @number ExperiencePoints + +--- +-- UnlockedTalents, Field of type HashSet`1 +-- @realm shared +-- @HashSet`1 UnlockedTalents + +--- +-- AdditionalTalentPoints, Field of type number +-- @realm shared +-- @number AdditionalTalentPoints + --- -- HeadSprite, Field of type Sprite -- @realm shared @@ -309,6 +452,21 @@ function GetHashCode() end -- @realm shared -- @number FaceAttachmentIndex +--- +-- HairColor, Field of type Color +-- @realm shared +-- @Color HairColor + +--- +-- FacialHairColor, Field of type Color +-- @realm shared +-- @Color FacialHairColor + +--- +-- SkinColor, Field of type Color +-- @realm shared +-- @Color SkinColor + --- -- HairElement, Field of type XElement -- @realm shared @@ -429,6 +587,36 @@ function GetHashCode() end -- @realm shared -- @bool HasGenders +--- +-- HasRaces, Field of type bool +-- @realm shared +-- @bool HasRaces + +--- +-- HairColors, Field of type ImmutableArray`1 +-- @realm shared +-- @ImmutableArray`1 HairColors + +--- +-- FacialHairColors, Field of type ImmutableArray`1 +-- @realm shared +-- @ImmutableArray`1 FacialHairColors + +--- +-- SkinColors, Field of type ImmutableArray`1 +-- @realm shared +-- @ImmutableArray`1 SkinColors + +--- +-- MissionsCompletedSinceDeath, Field of type number +-- @realm shared +-- @number MissionsCompletedSinceDeath + +--- +-- SavedStatValues, Field of type table +-- @realm shared +-- @table SavedStatValues + --- -- CharacterInfo.MaxCurrentOrders, Field of type number -- @realm shared diff --git a/docs/lua/Client.lua b/docs/lua/generated/Client.lua similarity index 92% rename from docs/lua/Client.lua rename to docs/lua/generated/Client.lua index ef5226bf1..a4b67603d 100644 --- a/docs/lua/Client.lua +++ b/docs/lua/generated/Client.lua @@ -31,24 +31,37 @@ function CheckPermission(permissions) end function Client.Unban(player, endpoint) end - ---- --- List of all connected clients. +--- SetClientCharacter -- @realm shared --- @Character Client.ClientList Table containing characters +-- @tparam Character character +function SetClientCharacter(character) end ---- --- Character that the client is currently controlling. +--- Kick -- @realm shared --- @Character Character +-- @tparam string reason +function Kick(reason) end +--- Ban +-- @realm shared +-- @tparam string reason +-- @tparam bool range +-- @tparam number seconds +function Ban(reason, range, seconds) end ------------ AUTODOCS -------------- +--- Unban +-- @realm shared +-- @tparam string player +-- @tparam string endpoint +function Client.Unban(player, endpoint) end +--- CheckPermission +-- @realm shared +-- @tparam ClientPermissions permissions +-- @treturn bool +function CheckPermission(permissions) end --- InitClientSync -- @realm shared - function InitClientSync() end --- IsValidName @@ -68,19 +81,16 @@ function EndpointMatches(endPoint) end -- @realm shared -- @tparam ClientPermissions permissions -- @tparam table permittedConsoleCommands - function SetPermissions(permissions, permittedConsoleCommands) end --- GivePermission -- @realm shared -- @tparam ClientPermissions permission - function GivePermission(permission) end --- RemovePermission -- @realm shared -- @tparam ClientPermissions permission - function RemovePermission(permission) end --- HasPermission @@ -99,24 +109,20 @@ function GetVote(voteType) end -- @realm shared -- @tparam VoteType voteType -- @tparam Object value - function SetVote(voteType, value) end --- ResetVotes -- @realm shared - function ResetVotes() end --- AddKickVote -- @realm shared -- @tparam Client voter - function AddKickVote(voter) end --- RemoveKickVote -- @realm shared -- @tparam Client voter - function RemoveKickVote(voter) end --- HasKickVoteFrom @@ -134,13 +140,11 @@ function HasKickVoteFromID(id) end --- UpdateKickVotes -- @realm shared -- @tparam table connectedClients - function Client.UpdateKickVotes(connectedClients) end --- WritePermissions -- @realm shared -- @tparam IWriteMessage msg - function WritePermissions(msg) end --- ReadPermissions @@ -148,13 +152,11 @@ function WritePermissions(msg) end -- @tparam IReadMessage inc -- @tparam ClientPermissions& permissions -- @tparam List`1& permittedCommands - function Client.ReadPermissions(inc, permissions, permittedCommands) end --- ReadPermissions -- @realm shared -- @tparam IReadMessage inc - function ReadPermissions(inc) end --- SanitizeName @@ -165,7 +167,6 @@ function Client.SanitizeName(name) end --- Dispose -- @realm shared - function Dispose() end --- GetType @@ -204,6 +205,16 @@ function GetHashCode() end -- @realm shared -- @number Karma +--- +-- Client.ClientList, Field of type table +-- @realm shared +-- @table Client.ClientList + +--- +-- Character, Field of type Character +-- @realm shared +-- @Character Character + --- -- SpectatePos, Field of type Nullable`1 -- @realm shared diff --git a/docs/lua/Entity.Spawner.lua b/docs/lua/generated/Entity.Spawner.lua similarity index 61% rename from docs/lua/Entity.Spawner.lua rename to docs/lua/generated/Entity.Spawner.lua index 59fd86b88..1309f6b7b 100644 --- a/docs/lua/Entity.Spawner.lua +++ b/docs/lua/generated/Entity.Spawner.lua @@ -8,6 +8,7 @@ Barotrauma source code: [EntitySpawner.cs](https://github.com/evilfactory/Barotr -- @code Entity.Spawner -- @pragma nostrip + --- CreateNetworkEvent -- @realm shared -- @tparam Entity entity @@ -21,13 +22,19 @@ function CreateNetworkEvent(entity, remove) end -- @tparam Object[] extraData function ServerWrite(message, client, extraData) end +--- ToString +-- @realm shared +-- @treturn string +function ToString() end + --- AddToSpawnQueue -- @realm shared -- @tparam ItemPrefab itemPrefab -- @tparam Vector2 worldPosition -- @tparam Nullable`1 condition +-- @tparam Nullable`1 quality -- @tparam function onSpawned -function AddToSpawnQueue(itemPrefab, worldPosition, condition, onSpawned) end +function AddToSpawnQueue(itemPrefab, worldPosition, condition, quality, onSpawned) end --- AddToSpawnQueue -- @realm shared @@ -35,18 +42,21 @@ function AddToSpawnQueue(itemPrefab, worldPosition, condition, onSpawned) end -- @tparam Vector2 position -- @tparam Submarine sub -- @tparam Nullable`1 condition +-- @tparam Nullable`1 quality -- @tparam function onSpawned -function AddToSpawnQueue(itemPrefab, position, sub, condition, onSpawned) end +function AddToSpawnQueue(itemPrefab, position, sub, condition, quality, onSpawned) end --- AddToSpawnQueue -- @realm shared -- @tparam ItemPrefab itemPrefab -- @tparam Inventory inventory -- @tparam Nullable`1 condition +-- @tparam Nullable`1 quality -- @tparam function onSpawned -- @tparam bool spawnIfInventoryFull -- @tparam bool ignoreLimbSlots -function AddToSpawnQueue(itemPrefab, inventory, condition, onSpawned, spawnIfInventoryFull, ignoreLimbSlots) end +-- @tparam InvSlotType slot +function AddToSpawnQueue(itemPrefab, inventory, condition, quality, onSpawned, spawnIfInventoryFull, ignoreLimbSlots, slot) end --- AddToSpawnQueue -- @realm shared @@ -104,10 +114,86 @@ function IsInRemoveQueue(entity) end -- @tparam bool createNetworkEvents function Update(createNetworkEvents) end +--- Reset +-- @realm shared +function Reset() end +--- FreeID +-- @realm shared +function FreeID() end + +--- Remove +-- @realm shared +function Remove() end + +--- GetType +-- @realm shared +-- @treturn Type +function GetType() end + +--- Equals +-- @realm shared +-- @tparam Object obj +-- @treturn bool +function Equals(obj) end + +--- GetHashCode +-- @realm shared +-- @treturn number +function GetHashCode() end + +--- +-- Removed, Field of type bool +-- @realm shared +-- @bool Removed + +--- +-- IdFreed, Field of type bool +-- @realm shared +-- @bool IdFreed + +--- +-- SimPosition, Field of type Vector2 +-- @realm shared +-- @Vector2 SimPosition + +--- +-- Position, Field of type Vector2 +-- @realm shared +-- @Vector2 Position + +--- +-- WorldPosition, Field of type Vector2 +-- @realm shared +-- @Vector2 WorldPosition + +--- +-- DrawPosition, Field of type Vector2 +-- @realm shared +-- @Vector2 DrawPosition + +--- +-- Submarine, Field of type Submarine +-- @realm shared +-- @Submarine Submarine + +--- +-- AiTarget, Field of type AITarget +-- @realm shared +-- @AITarget AiTarget + +--- +-- InDetectable, Field of type bool +-- @realm shared +-- @bool InDetectable --- -- SpawnTime, Field of type number -- @realm shared -- @number SpawnTime +--- +-- ID, Field of type number +-- @realm shared +-- @number ID + diff --git a/docs/lua/Entity.lua b/docs/lua/generated/Entity.lua similarity index 97% rename from docs/lua/Entity.lua rename to docs/lua/generated/Entity.lua index a598baefe..745fc512c 100644 --- a/docs/lua/Entity.lua +++ b/docs/lua/generated/Entity.lua @@ -8,15 +8,6 @@ Barotrauma source code: [Entity.cs](https://github.com/evilfactory/Barotrauma-lu -- @code Entity -- @pragma nostrip ---- Remove --- @realm shared -function Remove() end - ---- ToString --- @realm shared --- @treturn string -function ToString() end - --- GetEntities -- @realm shared -- @treturn IEnumerable`1 @@ -42,6 +33,10 @@ function Entity.RemoveAll() end -- @realm shared function FreeID() end +--- Remove +-- @realm shared +function Remove() end + --- DumpIds -- @realm shared -- @tparam number count @@ -53,6 +48,11 @@ function Entity.DumpIds(count, filename) end -- @treturn Type function GetType() end +--- ToString +-- @realm shared +-- @treturn string +function ToString() end + --- Equals -- @realm shared -- @tparam Object obj @@ -109,6 +109,11 @@ function GetHashCode() end -- @realm shared -- @AITarget AiTarget +--- +-- InDetectable, Field of type bool +-- @realm shared +-- @bool InDetectable + --- -- SpawnTime, Field of type number -- @realm shared diff --git a/docs/lua/generated/GameScreen.lua b/docs/lua/generated/GameScreen.lua new file mode 100644 index 000000000..233f769e2 --- /dev/null +++ b/docs/lua/generated/GameScreen.lua @@ -0,0 +1,53 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma.GameScreen +]] +-- @code Game.GameScreen +-- @pragma nostrip +local GameScreen = {} + +--- Select +-- @realm shared +function Select() end + +--- Deselect +-- @realm shared +function Deselect() end + +--- Update +-- @realm shared +-- @tparam number deltaTime +function Update(deltaTime) end + +--- GetType +-- @realm shared +-- @treturn Type +function GetType() end + +--- ToString +-- @realm shared +-- @treturn string +function ToString() end + +--- Equals +-- @realm shared +-- @tparam Object obj +-- @treturn bool +function Equals(obj) end + +--- GetHashCode +-- @realm shared +-- @treturn number +function GetHashCode() end + +--- +-- Cam, Field of type Camera +-- @realm shared +-- @Camera Cam + +--- +-- GameTime, Field of type number +-- @realm shared +-- @number GameTime + diff --git a/docs/lua/generated/GameSession.lua b/docs/lua/generated/GameSession.lua new file mode 100644 index 000000000..2ccb927d7 --- /dev/null +++ b/docs/lua/generated/GameSession.lua @@ -0,0 +1,227 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma.GameSession +]] +-- @code Game.GameSession +-- @pragma nostrip +local GameSession = {} + +--- LoadPreviousSave +-- @realm shared +function LoadPreviousSave() end + +--- SwitchSubmarine +-- @realm shared +-- @tparam SubmarineInfo newSubmarine +-- @tparam number cost +-- @treturn SubmarineInfo +function SwitchSubmarine(newSubmarine, cost) end + +--- PurchaseSubmarine +-- @realm shared +-- @tparam SubmarineInfo newSubmarine +function PurchaseSubmarine(newSubmarine) end + +--- IsSubmarineOwned +-- @realm shared +-- @tparam SubmarineInfo query +-- @treturn bool +function IsSubmarineOwned(query) end + +--- IsCurrentLocationRadiated +-- @realm shared +-- @treturn bool +function IsCurrentLocationRadiated() end + +--- StartRound +-- @realm shared +-- @tparam string levelSeed +-- @tparam Nullable`1 difficulty +function StartRound(levelSeed, difficulty) end + +--- StartRound +-- @realm shared +-- @tparam LevelData levelData +-- @tparam bool mirrorLevel +-- @tparam SubmarineInfo startOutpost +-- @tparam SubmarineInfo endOutpost +function StartRound(levelData, mirrorLevel, startOutpost, endOutpost) end + +--- PlaceSubAtStart +-- @realm shared +-- @tparam Level level +function PlaceSubAtStart(level) end + +--- Update +-- @realm shared +-- @tparam number deltaTime +function Update(deltaTime) end + +--- GetMission +-- @realm shared +-- @tparam number index +-- @treturn Mission +function GetMission(index) end + +--- GetMissionIndex +-- @realm shared +-- @tparam Mission mission +-- @treturn number +function GetMissionIndex(mission) end + +--- EnforceMissionOrder +-- @realm shared +-- @tparam table missionIdentifiers +function EnforceMissionOrder(missionIdentifiers) end + +--- GetSessionCrewCharacters +-- @realm shared +-- @treturn IEnumerable`1 +function GameSession.GetSessionCrewCharacters() end + +--- EndRound +-- @realm shared +-- @tparam string endMessage +-- @tparam table traitorResults +-- @tparam TransitionType transitionType +function EndRound(endMessage, traitorResults, transitionType) end + +--- KillCharacter +-- @realm shared +-- @tparam Character character +function KillCharacter(character) end + +--- ReviveCharacter +-- @realm shared +-- @tparam Character character +function ReviveCharacter(character) end + +--- IsCompatibleWithEnabledContentPackages +-- @realm shared +-- @tparam IList`1 contentPackagePaths +-- @tparam String& errorMsg +-- @treturn bool +function GameSession.IsCompatibleWithEnabledContentPackages(contentPackagePaths, errorMsg) end + +--- Save +-- @realm shared +-- @tparam string filePath +function Save(filePath) end + +--- GetType +-- @realm shared +-- @treturn Type +function GetType() end + +--- ToString +-- @realm shared +-- @treturn string +function ToString() end + +--- Equals +-- @realm shared +-- @tparam Object obj +-- @treturn bool +function Equals(obj) end + +--- GetHashCode +-- @realm shared +-- @treturn number +function GetHashCode() end + +--- +-- Missions, Field of type IEnumerable`1 +-- @realm shared +-- @IEnumerable`1 Missions + +--- +-- IsRunning, Field of type bool +-- @realm shared +-- @bool IsRunning + +--- +-- RoundEnding, Field of type bool +-- @realm shared +-- @bool RoundEnding + +--- +-- Level, Field of type Level +-- @realm shared +-- @Level Level + +--- +-- LevelData, Field of type LevelData +-- @realm shared +-- @LevelData LevelData + +--- +-- MirrorLevel, Field of type bool +-- @realm shared +-- @bool MirrorLevel + +--- +-- Map, Field of type Map +-- @realm shared +-- @Map Map + +--- +-- Campaign, Field of type CampaignMode +-- @realm shared +-- @CampaignMode Campaign + +--- +-- StartLocation, Field of type Location +-- @realm shared +-- @Location StartLocation + +--- +-- EndLocation, Field of type Location +-- @realm shared +-- @Location EndLocation + +--- +-- SubmarineInfo, Field of type SubmarineInfo +-- @realm shared +-- @SubmarineInfo SubmarineInfo + +--- +-- Submarine, Field of type Submarine +-- @realm shared +-- @Submarine Submarine + +--- +-- SavePath, Field of type string +-- @realm shared +-- @string SavePath + +--- +-- EventManager, Field of type EventManager +-- @realm shared +-- @EventManager EventManager + +--- +-- GameMode, Field of type GameMode +-- @realm shared +-- @GameMode GameMode + +--- +-- CrewManager, Field of type CrewManager +-- @realm shared +-- @CrewManager CrewManager + +--- +-- RoundStartTime, Field of type number +-- @realm shared +-- @number RoundStartTime + +--- +-- WinningTeam, Field of type Nullable`1 +-- @realm shared +-- @Nullable`1 WinningTeam + +--- +-- OwnedSubmarines, Field of type table +-- @realm shared +-- @table OwnedSubmarines + diff --git a/docs/lua/Item.lua b/docs/lua/generated/Item.lua similarity index 92% rename from docs/lua/Item.lua rename to docs/lua/generated/Item.lua index b85093300..bdc96c9b3 100644 --- a/docs/lua/Item.lua +++ b/docs/lua/generated/Item.lua @@ -46,7 +46,42 @@ function SendSignal(signalOrString, connectionOrConnectionName) end -- @Vector2 WorldPosition ------ AUTO DOCS ------ +--- GetConnectedComponentsRecursive +-- @realm shared +-- @tparam Connection c +-- @treturn table +function GetConnectedComponentsRecursive(c) end + +--- FindController +-- @realm shared +-- @tparam String[] tags +-- @treturn Controller +function FindController(tags) end + +--- TryFindController +-- @realm shared +-- @tparam Controller& controller +-- @tparam String[] tags +-- @treturn bool +function TryFindController(controller, tags) end + +--- SendSignal +-- @realm shared +-- @tparam string signal +-- @tparam string connectionName +function SendSignal(signal, connectionName) end + +--- SendSignal +-- @realm shared +-- @tparam Signal signal +-- @tparam string connectionName +function SendSignal(signal, connectionName) end + +--- SendSignal +-- @realm shared +-- @tparam Signal signal +-- @tparam Connection connection +function SendSignal(signal, connection) end --- IsInsideTrigger -- @realm shared @@ -173,6 +208,11 @@ function Remove() end -- @tparam ItemPrefab prefab function Item.RemoveByPrefab(prefab) end +--- AddToRemoveQueue +-- @realm shared +-- @tparam Item item +function Item.AddToRemoveQueue(item) end + --- GetComponentString -- @realm shared -- @tparam string component @@ -234,6 +274,12 @@ function GetComponent() end -- @treturn IEnumerable`1 function GetComponents() end +--- GetQualityModifier +-- @realm shared +-- @tparam StatType statType +-- @treturn number +function GetQualityModifier(statType) end + --- RemoveContained -- @realm shared -- @tparam Item contained @@ -308,7 +354,7 @@ function GetRootInventoryOwner() end --- FindParentInventory -- @realm shared --- @tparam Func`2 predicate +-- @tparam function predicate -- @treturn Inventory function FindParentInventory(predicate) end @@ -346,7 +392,7 @@ function HasTag(allowedTags) end --- ApplyStatusEffects -- @realm shared --- @tparam ActionType type +-- @tparam function type -- @tparam number deltaTime -- @tparam Character character -- @tparam Limb limb @@ -358,7 +404,7 @@ function ApplyStatusEffects(type, deltaTime, character, limb, useTarget, isNetwo --- ApplyStatusEffect -- @realm shared -- @tparam StatusEffect effect --- @tparam ActionType type +-- @tparam function type -- @tparam number deltaTime -- @tparam Character character -- @tparam Limb limb @@ -408,23 +454,6 @@ function FlipY(relativeToSub) end -- @treturn table function GetConnectedComponents(recursive) end ---- GetConnectedComponentsRecursive --- @realm shared --- @tparam Connection c --- @treturn table -function GetConnectedComponentsRecursive(c) end - ---- FindController --- @realm shared --- @treturn Controller -function FindController() end - ---- TryFindController --- @realm shared --- @tparam Controller& controller --- @treturn bool -function TryFindController(controller) end - --- ServerWrite -- @realm shared -- @tparam IWriteMessage msg @@ -540,7 +569,7 @@ function RemoveLinked(e) end -- @realm shared -- @tparam HashSet`1 list -- @tparam Nullable`1 maxDepth --- @tparam Func`2 filter +-- @tparam function filter -- @treturn HashSet`1 function GetLinkedEntities(list, maxDepth, filter) end @@ -569,6 +598,11 @@ function GetHashCode() end -- @realm shared -- @Sprite Sprite +--- +-- Prefab, Field of type ItemPrefab +-- @realm shared +-- @ItemPrefab Prefab + --- -- CurrentHull, Field of type Hull -- @realm shared @@ -764,6 +798,11 @@ function GetHashCode() end -- @realm shared -- @number HealthMultiplier +--- +-- MaxRepairConditionMultiplier, Field of type number +-- @realm shared +-- @number MaxRepairConditionMultiplier + --- -- Condition, Field of type number -- @realm shared @@ -779,6 +818,11 @@ function GetHashCode() end -- @realm shared -- @bool Indestructible +--- +-- AllowDeconstruct, Field of type bool +-- @realm shared +-- @bool AllowDeconstruct + --- -- InvulnerableToDamage, Field of type bool -- @realm shared @@ -814,6 +858,11 @@ function GetHashCode() end -- @realm shared -- @bool UseInHealthInterface +--- +-- Quality, Field of type number +-- @realm shared +-- @number Quality + --- -- InWater, Field of type bool -- @realm shared @@ -984,11 +1033,6 @@ function GetHashCode() end -- @realm shared -- @bool HiddenInGame ---- --- ParentRuin, Field of type Ruin --- @realm shared --- @Ruin ParentRuin - --- -- RemoveIfLinkedOutpostDoorInUse, Field of type bool -- @realm shared @@ -1004,6 +1048,11 @@ function GetHashCode() end -- @realm shared -- @bool IdFreed +--- +-- WorldPosition, Field of type Vector2 +-- @realm shared +-- @Vector2 WorldPosition + --- -- DrawPosition, Field of type Vector2 -- @realm shared @@ -1019,6 +1068,11 @@ function GetHashCode() end -- @realm shared -- @AITarget AiTarget +--- +-- InDetectable, Field of type bool +-- @realm shared +-- @bool InDetectable + --- -- SpawnTime, Field of type number -- @realm shared @@ -1034,6 +1088,11 @@ function GetHashCode() end -- @realm shared -- @bool Visible +--- +-- body, Field of type PhysicsBody +-- @realm shared +-- @PhysicsBody body + --- -- StaticBodyConfig, Field of type XElement -- @realm shared @@ -1059,15 +1118,20 @@ function GetHashCode() end -- @realm shared -- @HashSet`1 AvailableSwaps +--- +-- Item.ItemList, Field of type table +-- @realm shared +-- @table Item.ItemList + --- -- Item.ShowLinks, Field of type bool -- @realm shared -- @bool Item.ShowLinks --- --- Item.connectionPairs, Field of type Pair`2[] +-- Item.connectionPairs, Field of type ValueTuple`2[] -- @realm shared --- @Pair`2[] Item.connectionPairs +-- @ValueTuple`2[] Item.connectionPairs --- -- prefab, Field of type MapEntityPrefab @@ -1085,9 +1149,9 @@ function GetHashCode() end -- @HashSet`1 disallowedUpgrades --- --- linkedTo, Field of type ObservableCollection`1 +-- linkedTo, Field of type table -- @realm shared --- @ObservableCollection`1 linkedTo +-- @table linkedTo --- -- ShouldBeSaved, Field of type bool diff --git a/docs/lua/ItemPrefab.lua b/docs/lua/generated/ItemPrefab.lua similarity index 92% rename from docs/lua/ItemPrefab.lua rename to docs/lua/generated/ItemPrefab.lua index 069505ba7..4b256812b 100644 --- a/docs/lua/ItemPrefab.lua +++ b/docs/lua/generated/ItemPrefab.lua @@ -36,10 +36,6 @@ function ItemPrefab.GetItemPrefab(itemNameOrId) end -- @string Identifier - ------- AUTO DOCS -------- - - --- RemoveByFile -- @realm shared -- @tparam string filePath @@ -141,6 +137,26 @@ function ItemPrefab.IsContainerPreferred(preferences, c) end -- @treturn bool function ItemPrefab.IsContainerPreferred(preferences, ids) end +--- GetItemPrefab +-- @realm shared +-- @tparam string itemNameOrId +-- @treturn ItemPrefab +function ItemPrefab.GetItemPrefab(itemNameOrId) end + +--- AddToSpawnQueue +-- @realm shared +-- @tparam ItemPrefab itemPrefab +-- @tparam Vector2 position +-- @tparam Object spawned +function ItemPrefab.AddToSpawnQueue(itemPrefab, position, spawned) end + +--- AddToSpawnQueue +-- @realm shared +-- @tparam ItemPrefab itemPrefab +-- @tparam Inventory inventory +-- @tparam Object spawned +function ItemPrefab.AddToSpawnQueue(itemPrefab, inventory, spawned) end + --- Dispose -- @realm shared function Dispose() end @@ -261,6 +277,11 @@ function GetHashCode() end -- @realm shared -- @bool HideConditionBar +--- +-- HideConditionInTooltip, Field of type bool +-- @realm shared +-- @bool HideConditionInTooltip + --- -- RequireBodyInsideTrigger, Field of type bool -- @realm shared @@ -376,6 +397,16 @@ function GetHashCode() end -- @realm shared -- @bool UseContainedInventoryIconColor +--- +-- AddedRepairSpeedMultiplier, Field of type number +-- @realm shared +-- @number AddedRepairSpeedMultiplier + +--- +-- CannotRepairFail, Field of type bool +-- @realm shared +-- @bool CannotRepairFail + --- -- EquipConfirmationText, Field of type string -- @realm shared @@ -581,6 +612,11 @@ function GetHashCode() end -- @realm shared -- @bool IsOverride +--- +-- VariantOf, Field of type ItemPrefab +-- @realm shared +-- @ItemPrefab VariantOf + --- -- AllowAsExtraCargo, Field of type Nullable`1 -- @realm shared diff --git a/docs/lua/Job.lua b/docs/lua/generated/Job.lua similarity index 93% rename from docs/lua/Job.lua rename to docs/lua/generated/Job.lua index dea1e3d4a..a2bf13fe2 100644 --- a/docs/lua/Job.lua +++ b/docs/lua/generated/Job.lua @@ -10,6 +10,7 @@ Barotrauma source code: [Job.cs](https://github.com/evilfactory/Barotrauma-lua-a local Job = {} + --- Random -- @realm shared -- @tparam RandSync randSync @@ -26,7 +27,8 @@ function GetSkillLevel(skillIdentifier) end -- @realm shared -- @tparam string skillIdentifier -- @tparam number increase -function IncreaseSkillLevel(skillIdentifier, increase) end +-- @tparam bool increasePastMax +function IncreaseSkillLevel(skillIdentifier, increase, increasePastMax) end --- GiveJobItems -- @realm shared diff --git a/docs/lua/JobPrefab.lua b/docs/lua/generated/JobPrefab.lua similarity index 96% rename from docs/lua/JobPrefab.lua rename to docs/lua/generated/JobPrefab.lua index fd9328148..a850ac963 100644 --- a/docs/lua/JobPrefab.lua +++ b/docs/lua/generated/JobPrefab.lua @@ -183,14 +183,9 @@ function GetHashCode() end -- @table ItemSets --- --- ItemIdentifiers, Field of type table +-- PreviewItems, Field of type table -- @realm shared --- @table ItemIdentifiers - ---- --- ShowItemPreview, Field of type table --- @realm shared --- @table ShowItemPreview +-- @table PreviewItems --- -- Skills, Field of type table diff --git a/docs/lua/generated/NetLobbyScreen.lua b/docs/lua/generated/NetLobbyScreen.lua new file mode 100644 index 000000000..f55c81116 --- /dev/null +++ b/docs/lua/generated/NetLobbyScreen.lua @@ -0,0 +1,197 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma.NetLobbyScreen +]] +-- @code Game.NetLobbyScreen +-- @pragma nostrip +local NetLobbyScreen = {} + +--- AddCampaignSubmarine +-- @realm shared +-- @tparam SubmarineInfo sub +function AddCampaignSubmarine(sub) end + +--- RemoveCampaignSubmarine +-- @realm shared +-- @tparam SubmarineInfo sub +function RemoveCampaignSubmarine(sub) end + +--- ChangeServerName +-- @realm shared +-- @tparam string n +function ChangeServerName(n) end + +--- ChangeServerMessage +-- @realm shared +-- @tparam string m +function ChangeServerMessage(m) end + +--- GetSubList +-- @realm shared +-- @treturn table +function GetSubList() end + +--- AddSub +-- @realm shared +-- @tparam SubmarineInfo sub +function AddSub(sub) end + +--- ToggleCampaignMode +-- @realm shared +-- @tparam bool enabled +function ToggleCampaignMode(enabled) end + +--- Select +-- @realm shared +function Select() end + +--- RandomizeSettings +-- @realm shared +function RandomizeSettings() end + +--- SetLevelDifficulty +-- @realm shared +-- @tparam number difficulty +function SetLevelDifficulty(difficulty) end + +--- SetRadiationEnabled +-- @realm shared +-- @tparam bool enabled +function SetRadiationEnabled(enabled) end + +--- IsRadiationEnabled +-- @realm shared +-- @treturn bool +function IsRadiationEnabled() end + +--- SetMaxMissionCount +-- @realm shared +-- @tparam number maxMissionCount +function SetMaxMissionCount(maxMissionCount) end + +--- GetMaxMissionCount +-- @realm shared +-- @treturn number +function GetMaxMissionCount() end + +--- ToggleTraitorsEnabled +-- @realm shared +-- @tparam number dir +function ToggleTraitorsEnabled(dir) end + +--- SetBotCount +-- @realm shared +-- @tparam number botCount +function SetBotCount(botCount) end + +--- SetBotSpawnMode +-- @realm shared +-- @tparam BotSpawnMode botSpawnMode +function SetBotSpawnMode(botSpawnMode) end + +--- SetTraitorsEnabled +-- @realm shared +-- @tparam YesNoMaybe enabled +function SetTraitorsEnabled(enabled) end + +--- Deselect +-- @realm shared +function Deselect() end + +--- Update +-- @realm shared +-- @tparam number deltaTime +function Update(deltaTime) end + +--- GetType +-- @realm shared +-- @treturn Type +function GetType() end + +--- ToString +-- @realm shared +-- @treturn string +function ToString() end + +--- Equals +-- @realm shared +-- @tparam Object obj +-- @treturn bool +function Equals(obj) end + +--- GetHashCode +-- @realm shared +-- @treturn number +function GetHashCode() end + +--- +-- SelectedSub, Field of type SubmarineInfo +-- @realm shared +-- @SubmarineInfo SelectedSub + +--- +-- SelectedShuttle, Field of type SubmarineInfo +-- @realm shared +-- @SubmarineInfo SelectedShuttle + +--- +-- CampaignSubmarines, Field of type table +-- @realm shared +-- @table CampaignSubmarines + +--- +-- GameModes, Field of type GameModePreset[] +-- @realm shared +-- @GameModePreset[] GameModes + +--- +-- SelectedModeIndex, Field of type number +-- @realm shared +-- @number SelectedModeIndex + +--- +-- SelectedModeIdentifier, Field of type string +-- @realm shared +-- @string SelectedModeIdentifier + +--- +-- SelectedMode, Field of type GameModePreset +-- @realm shared +-- @GameModePreset SelectedMode + +--- +-- MissionType, Field of type MissionType +-- @realm shared +-- @MissionType MissionType + +--- +-- MissionTypeName, Field of type string +-- @realm shared +-- @string MissionTypeName + +--- +-- JobPreferences, Field of type table +-- @realm shared +-- @table JobPreferences + +--- +-- LevelSeed, Field of type string +-- @realm shared +-- @string LevelSeed + +--- +-- LastUpdateID, Field of type number +-- @realm shared +-- @number LastUpdateID + +--- +-- Cam, Field of type Camera +-- @realm shared +-- @Camera Cam + +--- +-- RadiationEnabled, Field of type bool +-- @realm shared +-- @bool RadiationEnabled + diff --git a/docs/lua/Submarine.lua b/docs/lua/generated/Submarine.lua similarity index 98% rename from docs/lua/Submarine.lua rename to docs/lua/generated/Submarine.lua index e44957442..23a94cbdc 100644 --- a/docs/lua/Submarine.lua +++ b/docs/lua/generated/Submarine.lua @@ -12,6 +12,12 @@ Not all fields and methods will work, this doc was autogenerated. local Submarine = {} +--- FindContaining +-- @realm shared +-- @tparam Vector2 position +-- @treturn Submarine +function Submarine.FindContaining(position) end + --- GetBorders -- @realm shared -- @tparam XElement submarineElement @@ -338,12 +344,6 @@ function GetEntities(includingConnectedSubs, list) end -- @treturn bool function IsEntityFoundOnThisSub(entity, includingConnectedSubs, allowDifferentTeam, allowDifferentType) end ---- FindContaining --- @realm shared --- @tparam Vector2 position --- @treturn Submarine -function Submarine.FindContaining(position) end - --- FreeID -- @realm shared function FreeID() end @@ -494,6 +494,11 @@ function GetHashCode() end -- @realm shared -- @table HullVertices +--- +-- SubmarineSpecificIDTag, Field of type number +-- @realm shared +-- @number SubmarineSpecificIDTag + --- -- AtDamageDepth, Field of type bool -- @realm shared @@ -539,6 +544,11 @@ function GetHashCode() end -- @realm shared -- @AITarget AiTarget +--- +-- InDetectable, Field of type bool +-- @realm shared +-- @bool InDetectable + --- -- SpawnTime, Field of type number -- @realm shared diff --git a/docs/lua/generated/World.lua b/docs/lua/generated/World.lua new file mode 100644 index 000000000..d930c88cf --- /dev/null +++ b/docs/lua/generated/World.lua @@ -0,0 +1,478 @@ +-- luacheck: ignore 111 + +--[[-- +FarseerPhysics.Dynamics.World +]] +-- @code Game.World +-- @pragma nostrip +local World = {} + +--- Add +-- @realm shared +-- @tparam Body body +function Add(body) end + +--- Remove +-- @realm shared +-- @tparam Body body +function Remove(body) end + +--- Add +-- @realm shared +-- @tparam Joint joint +function Add(joint) end + +--- Remove +-- @realm shared +-- @tparam Joint joint +function Remove(joint) end + +--- AddAsync +-- @realm shared +-- @tparam Body body +function AddAsync(body) end + +--- RemoveAsync +-- @realm shared +-- @tparam Body body +function RemoveAsync(body) end + +--- AddAsync +-- @realm shared +-- @tparam Joint joint +function AddAsync(joint) end + +--- RemoveAsync +-- @realm shared +-- @tparam Joint joint +function RemoveAsync(joint) end + +--- ProcessChanges +-- @realm shared +function ProcessChanges() end + +--- Step +-- @realm shared +-- @tparam TimeSpan dt +function Step(dt) end + +--- Step +-- @realm shared +-- @tparam TimeSpan dt +-- @tparam SolverIterations& iterations +function Step(dt, iterations) end + +--- Step +-- @realm shared +-- @tparam number dt +function Step(dt) end + +--- Step +-- @realm shared +-- @tparam number dt +-- @tparam SolverIterations& iterations +function Step(dt, iterations) end + +--- ClearForces +-- @realm shared +function ClearForces() end + +--- QueryAABB +-- @realm shared +-- @tparam function callback +-- @tparam AABB& aabb +function QueryAABB(callback, aabb) end + +--- QueryAABB +-- @realm shared +-- @tparam AABB& aabb +-- @treturn table +function QueryAABB(aabb) end + +--- RayCast +-- @realm shared +-- @tparam function callback +-- @tparam Vector2 point1 +-- @tparam Vector2 point2 +-- @tparam Category collisionCategory +function RayCast(callback, point1, point2, collisionCategory) end + +--- RayCast +-- @realm shared +-- @tparam Vector2 point1 +-- @tparam Vector2 point2 +-- @treturn table +function RayCast(point1, point2) end + +--- Add +-- @realm shared +-- @tparam Controller controller +function Add(controller) end + +--- Remove +-- @realm shared +-- @tparam Controller controller +function Remove(controller) end + +--- TestPoint +-- @realm shared +-- @tparam Vector2 point +-- @treturn Fixture +function TestPoint(point) end + +--- TestPointAll +-- @realm shared +-- @tparam Vector2 point +-- @treturn table +function TestPointAll(point) end + +--- ShiftOrigin +-- @realm shared +-- @tparam Vector2 newOrigin +function ShiftOrigin(newOrigin) end + +--- Clear +-- @realm shared +function Clear() end + +--- CreateBody +-- @realm shared +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateBody(position, rotation, bodyType) end + +--- CreateEdge +-- @realm shared +-- @tparam Vector2 start +-- @tparam Vector2 endparam +-- @treturn Body +function CreateEdge(start, endparam) end + +--- CreateChainShape +-- @realm shared +-- @tparam Vertices vertices +-- @tparam Vector2 position +-- @treturn Body +function CreateChainShape(vertices, position) end + +--- CreateLoopShape +-- @realm shared +-- @tparam Vertices vertices +-- @tparam Vector2 position +-- @treturn Body +function CreateLoopShape(vertices, position) end + +--- CreateRectangle +-- @realm shared +-- @tparam number width +-- @tparam number height +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateRectangle(width, height, density, position, rotation, bodyType) end + +--- CreateCircle +-- @realm shared +-- @tparam number radius +-- @tparam number density +-- @tparam Vector2 position +-- @tparam BodyType bodyType +-- @treturn Body +function CreateCircle(radius, density, position, bodyType) end + +--- CreateEllipse +-- @realm shared +-- @tparam number xRadius +-- @tparam number yRadius +-- @tparam number edges +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateEllipse(xRadius, yRadius, edges, density, position, rotation, bodyType) end + +--- CreatePolygon +-- @realm shared +-- @tparam Vertices vertices +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreatePolygon(vertices, density, position, rotation, bodyType) end + +--- CreateCompoundPolygon +-- @realm shared +-- @tparam table list +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateCompoundPolygon(list, density, position, rotation, bodyType) end + +--- CreateGear +-- @realm shared +-- @tparam number radius +-- @tparam number numberOfTeeth +-- @tparam number tipPercentage +-- @tparam number toothHeight +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateGear(radius, numberOfTeeth, tipPercentage, toothHeight, density, position, rotation, bodyType) end + +--- CreateCapsule +-- @realm shared +-- @tparam number height +-- @tparam number topRadius +-- @tparam number topEdges +-- @tparam number bottomRadius +-- @tparam number bottomEdges +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateCapsule(height, topRadius, topEdges, bottomRadius, bottomEdges, density, position, rotation, bodyType) end + +--- CreateCapsuleHorizontal +-- @realm shared +-- @tparam number width +-- @tparam number endRadius +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateCapsuleHorizontal(width, endRadius, density, position, rotation, bodyType) end + +--- CreateCapsule +-- @realm shared +-- @tparam number height +-- @tparam number endRadius +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateCapsule(height, endRadius, density, position, rotation, bodyType) end + +--- CreateRoundedRectangle +-- @realm shared +-- @tparam number width +-- @tparam number height +-- @tparam number xRadius +-- @tparam number yRadius +-- @tparam number segments +-- @tparam number density +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateRoundedRectangle(width, height, xRadius, yRadius, segments, density, position, rotation, bodyType) end + +--- CreateLineArc +-- @realm shared +-- @tparam number radians +-- @tparam number sides +-- @tparam number radius +-- @tparam bool closed +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateLineArc(radians, sides, radius, closed, position, rotation, bodyType) end + +--- CreateSolidArc +-- @realm shared +-- @tparam number density +-- @tparam number radians +-- @tparam number sides +-- @tparam number radius +-- @tparam Vector2 position +-- @tparam number rotation +-- @tparam BodyType bodyType +-- @treturn Body +function CreateSolidArc(density, radians, sides, radius, position, rotation, bodyType) end + +--- CreateChain +-- @realm shared +-- @tparam Vector2 start +-- @tparam Vector2 endparam +-- @tparam number linkWidth +-- @tparam number linkHeight +-- @tparam number numberOfLinks +-- @tparam number linkDensity +-- @tparam bool attachRopeJoint +-- @treturn Path +function CreateChain(start, endparam, linkWidth, linkHeight, numberOfLinks, linkDensity, attachRopeJoint) end + +--- GetType +-- @realm shared +-- @treturn Type +function GetType() end + +--- ToString +-- @realm shared +-- @treturn string +function ToString() end + +--- Equals +-- @realm shared +-- @tparam Object obj +-- @treturn bool +function Equals(obj) end + +--- GetHashCode +-- @realm shared +-- @treturn number +function GetHashCode() end + +--- +-- Fluid, Field of type FluidSystem2 +-- @realm shared +-- @FluidSystem2 Fluid + +--- +-- UpdateTime, Field of type TimeSpan +-- @realm shared +-- @TimeSpan UpdateTime + +--- +-- ContinuousPhysicsTime, Field of type TimeSpan +-- @realm shared +-- @TimeSpan ContinuousPhysicsTime + +--- +-- ControllersUpdateTime, Field of type TimeSpan +-- @realm shared +-- @TimeSpan ControllersUpdateTime + +--- +-- AddRemoveTime, Field of type TimeSpan +-- @realm shared +-- @TimeSpan AddRemoveTime + +--- +-- NewContactsTime, Field of type TimeSpan +-- @realm shared +-- @TimeSpan NewContactsTime + +--- +-- ContactsUpdateTime, Field of type TimeSpan +-- @realm shared +-- @TimeSpan ContactsUpdateTime + +--- +-- SolveUpdateTime, Field of type TimeSpan +-- @realm shared +-- @TimeSpan SolveUpdateTime + +--- +-- ProxyCount, Field of type number +-- @realm shared +-- @number ProxyCount + +--- +-- ContactCount, Field of type number +-- @realm shared +-- @number ContactCount + +--- +-- IsLocked, Field of type bool +-- @realm shared +-- @bool IsLocked + +--- +-- ContactList, Field of type ContactListHead +-- @realm shared +-- @ContactListHead ContactList + +--- +-- Enabled, Field of type bool +-- @realm shared +-- @bool Enabled + +--- +-- Island, Field of type Island +-- @realm shared +-- @Island Island + +--- +-- Tag, Field of type Object +-- @realm shared +-- @Object Tag + +--- +-- BodyAdded, Field of type BodyDelegate +-- @realm shared +-- @BodyDelegate BodyAdded + +--- +-- BodyRemoved, Field of type BodyDelegate +-- @realm shared +-- @BodyDelegate BodyRemoved + +--- +-- FixtureAdded, Field of type FixtureDelegate +-- @realm shared +-- @FixtureDelegate FixtureAdded + +--- +-- FixtureRemoved, Field of type FixtureDelegate +-- @realm shared +-- @FixtureDelegate FixtureRemoved + +--- +-- JointAdded, Field of type JointDelegate +-- @realm shared +-- @JointDelegate JointAdded + +--- +-- JointRemoved, Field of type JointDelegate +-- @realm shared +-- @JointDelegate JointRemoved + +--- +-- ControllerAdded, Field of type ControllerDelegate +-- @realm shared +-- @ControllerDelegate ControllerAdded + +--- +-- ControllerRemoved, Field of type ControllerDelegate +-- @realm shared +-- @ControllerDelegate ControllerRemoved + +--- +-- ControllerList, Field of type table +-- @realm shared +-- @table ControllerList + +--- +-- Gravity, Field of type Vector2 +-- @realm shared +-- @Vector2 Gravity + +--- +-- ContactManager, Field of type ContactManager +-- @realm shared +-- @ContactManager ContactManager + +--- +-- BodyList, Field of type table +-- @realm shared +-- @table BodyList + +--- +-- JointList, Field of type table +-- @realm shared +-- @table JointList + diff --git a/docs/manual/common-questions.md b/docs/manual/common-questions.md new file mode 100644 index 000000000..f047127d3 --- /dev/null +++ b/docs/manual/common-questions.md @@ -0,0 +1,55 @@ +# Common Questions + +## What does attempt to index a nil value mean!? +It means you tried to access a field of something that doesn't exist, for example: +```lua +local thisIsNil = nil +print(thisIsNil.what) +print(thisIsNil.something()) +``` + +## Why i'm getting "cannot access field test of userdata" errors? +Because you are trying to access a field in a C# class that doesn't exist. +```lua +print(Item.thisDoesntExist) +``` + +## I'm getting a super big error with things related to the C# side +It usually happens when you call something on the C# side and you provide nil inputs, you can get a better idea of it by analyzing the error message and trying to link it your lua code, for example: +```lua +Game.SendMessage(nil) +``` + +This will result in +``` +[LUA ERROR] System.NullReferenceException: Object reference not set to an instance of an object. +at Barotrauma.Networking.ChatMessage.GetChatMessageCommand(String message, String& messageWithoutCommand) +at Barotrauma.Networking.GameServer.SendChatMessage(String message, Nullable`1 type, Client senderClient, +Character senderCharacter, PlayerConnectionChangeType changeType) +``` +You can easily tell that the error has something to do with chat messages, and by looking back at your Lua code you can easily see whats causing it. + +## How do i list all clients, characters and items? +```lua +for _, client in pairs(Client.ClientList) do + +end + +for _, character in pairs(Character.CharacterList) do + +end + +for _, item in pairs(Item.ItemList) do + +end +``` + +## Running pairs() on an enumerator doesn't work! +pairs() Returns an enumerator that iterates through the entire table keys, if you already have an enumerator, you can just pass it in directly. +```lua +-- get first item ever created and loop through all the values +for item in Item.ItemList[1].OwnInventory.AllItems do + +end +``` + diff --git a/docs/manual/getting-started.md b/docs/manual/getting-started.md index dc437f16c..9830ebbb8 100644 --- a/docs/manual/getting-started.md +++ b/docs/manual/getting-started.md @@ -3,12 +3,12 @@ If you want to learn how Lua works and the syntax, you can check these websites: [https://www.lua.org/manual/5.2/](https://www.lua.org/manual/5.2/) [https://www.tutorialspoint.com/lua/lua_overview.htm](https://www.tutorialspoint.com/lua/lua_overview.htm) ## How mods are executed -When the server finishes loading everything, Lua For Barotrauma starts up and reads the file `Lua/MoonsharpSetup.lua` and executes it, this Lua script then looks for Mods in the Mods folder, and tries to execute Lua scripts inside the Lua/Autorun folder, so for example, if you have a Mod named TheTest, and inside this mod you have a file named Lua/Autorun/test.lua, the test.lua will be executed automatically. +When the server finishes loading everything, Lua For Barotrauma starts up and reads the file `Lua/LuaSetup.lua` and executes it, this Lua script registers classes to be available on the C# side, creates static references and puts them in the global space, and then executes the mod's autorun folder. By default it only executes mods enabled in the settings menu, you can bypass that by editing the file `LuaSetup.lua` and setting `local runDisabledMods = false` to `local runDisabledMods = true`. ## Creating your first mod -When creating a new Lua mod, you will need to create a new folder on the **Mods** folder, then inside this folder you will need to create a folder called **Lua**, and then inside the Lua folder you create a folder called **Autorun**, inside this folder you can add your lua scripts that will be executed automatically, it will look something like this `Mods/MyMod/Lua/Autorun/test.lua` +When creating a new Lua mod, you will need to create a new folder on the **Mods** folder, then inside this folder you will need to create a folder called **Lua**, and then inside the Lua folder you create a folder called **Autorun**, inside this folder you can add your lua scripts that will be executed automatically, it will look something like this `Mods/MyMod/Lua/Autorun/test.lua`, remember that if you are using the default LuaSetup settings, your mod will only be executed if its enabled in the game's settings, so you will need to create a `filelist.xml` as unusual. -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 yourscript` 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, 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 diff --git a/docs/templates/module.ltp b/docs/templates/module.ltp index 920d99aa3..6e9e76931 100644 --- a/docs/templates/module.ltp +++ b/docs/templates/module.ltp @@ -51,10 +51,6 @@ {% end %} - {% if (item.module and item.module.type ~= "hooks") then %} - View source » - {% end %} - {% if (ldoc.descript(item):len() == 0) then %}
Incomplete