diff --git a/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaSetup.cs b/Barotrauma/BarotraumaShared/SharedSource/Lua/LuaSetup.cs index 5a57e7930..9177bfd87 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.GenerateDocsAll(); + LuaDocs.GenerateDocsAll(); if (File.Exists("Lua/LuaSetup.lua")) // try the default loader DoFile("Lua/LuaSetup.lua"); diff --git a/docs/baseluadocs/Client.lua b/docs/baseluadocs/Client.lua index 39544ed37..c6d1d8ef3 100644 --- a/docs/baseluadocs/Client.lua +++ b/docs/baseluadocs/Client.lua @@ -10,6 +10,12 @@ Barotrauma source code: [Client.cs](https://github.com/evilfactory/Barotrauma-lu local Client = {} +-- @remove function SetClientCharacter(character) end +-- @remove function Kick(reason) end +-- @remove function Ban(reason, range, seconds) end +-- @remove function Client.Unban(player, endpoint) end +-- @remove function CheckPermission(permissions) end + --- Sets the client character. -- @realm server function SetClientCharacter(character) end diff --git a/docs/lua/generated/Character.lua b/docs/lua/generated/Character.lua index e0445c31b..dfdede1df 100644 --- a/docs/lua/generated/Character.lua +++ b/docs/lua/generated/Character.lua @@ -12,8 +12,7 @@ local Character = {} -- @remove function Character.Create(characterInfo, position, seed, id, isRemotePlayer, hasAi, ragdoll) end -- @remove function TeleportTo(worldPos) end - --- @remove function TeleportTo(worldPos) end +-- @remove Character.CharacterList --- Creates a Character using CharacterInfo. -- @realm server @@ -1611,11 +1610,6 @@ 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/generated/Client.lua b/docs/lua/generated/Client.lua index a4b67603d..42d023132 100644 --- a/docs/lua/generated/Client.lua +++ b/docs/lua/generated/Client.lua @@ -10,6 +10,12 @@ Barotrauma source code: [Client.cs](https://github.com/evilfactory/Barotrauma-lu local Client = {} +-- @remove function SetClientCharacter(character) end +-- @remove function Kick(reason) end +-- @remove function Ban(reason, range, seconds) end +-- @remove function Client.Unban(player, endpoint) end +-- @remove function CheckPermission(permissions) end + --- Sets the client character. -- @realm server function SetClientCharacter(character) end @@ -31,35 +37,6 @@ function CheckPermission(permissions) end function Client.Unban(player, endpoint) end ---- SetClientCharacter --- @realm shared --- @tparam Character character -function SetClientCharacter(character) end - ---- Kick --- @realm shared --- @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 - ---- 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 diff --git a/docs/manual/common-questions.md b/docs/manual/common-questions.md index f047127d3..62200f795 100644 --- a/docs/manual/common-questions.md +++ b/docs/manual/common-questions.md @@ -47,9 +47,25 @@ 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 +-- get first item ever created and loop through all the items stored inside it. for item in Item.ItemList[1].OwnInventory.AllItems do end ``` +## How do i spawn an item? +```lua +local prefab = ItemPrefab.GetItemPrefab("screwdriver") +local firstPlayerCharacter = Client.ClientList[1].Character + +-- Spawn on the world +Entity.Spawner.AddToSpawnQueue(prefab, firstPlayerCharacter.WorldPosition, nil, nil, function(item) + print(item .. " Has been spawned.") +end) + +-- Spawn inside an inventory +Entity.Spawner.AddToSpawnQueue(prefab, firstPlayerCharacter.Inventory, nil, nil, function(item) + print(item .. " Has been spawned.") +end) +``` +