diff --git a/config.ld b/config.ld index 27312d1ff..26e3bce6f 100644 --- a/config.ld +++ b/config.ld @@ -54,6 +54,13 @@ tparam_alias("Client", "client") tparam_alias("Character", "character") tparam_alias("Submarine", "submarine") tparam_alias("Item", "item") +tparam_alias("Vector2", "Vector2") +tparam_alias("Vector3", "Vector3") +tparam_alias("Vector4", "Vector4") +tparam_alias("CauseOfDeath", "CauseOfDeath") +tparam_alias("CharacterInventory", "CharacterInventory") +tparam_alias("PhysicsBody", "PhysicsBody") + tparam_alias("string", "string") tparam_alias("bool", "boolean") diff --git a/docs/CSharpUtils.lua b/docs/CSharpUtils.lua new file mode 100644 index 000000000..2dee42fca --- /dev/null +++ b/docs/CSharpUtils.lua @@ -0,0 +1,27 @@ + +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/input.txt b/docs/input.txt new file mode 100644 index 000000000..2177a281e --- /dev/null +++ b/docs/input.txt @@ -0,0 +1,50 @@ +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/Character.lua b/docs/lua/Character.lua index 4e431620e..b1b5cfa73 100644 --- a/docs/lua/Character.lua +++ b/docs/lua/Character.lua @@ -9,6 +9,8 @@ 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 @@ -20,7 +22,267 @@ local Character = {} function Character.Create(characterInfo, position, seed, id, isRemotePlayer, hasAi, ragdollParams) end ---- List of all characters. --- @treturn table --- @realm shared -Character.CharacterList = {} \ No newline at end of file +--- Teleports a character to a position. +-- @realm server +-- @tparam Vector2 position +-- @usage +-- Character.CharacterList[1].TeleportTo(CreateVector2(0, 0)) -- teleports first created characters to 0, 0 +function TeleportTo(position) end + + +--- +-- Character.CharacterList, List of all characters. +-- @realm shared +-- @table Character.CharacterList + + + +--- +-- IsRemotelyControlled, returns a bool. +-- @realm shared +-- @bool IsRemotelyControlled + +--- +-- IsObserving, returns a bool. +-- @realm shared +-- @bool IsObserving + +--- +-- IsBot, returns a bool. +-- @realm shared +-- @bool IsBot + +--- +-- IsDead, returns a bool. +-- @realm shared +-- @bool IsDead + +--- +-- IsHuman, returns a bool. +-- @realm shared +-- @bool IsHuman + +--- +-- IsMale, returns a bool. +-- @realm shared +-- @bool IsMale + +--- +-- IsFemale, returns a bool. +-- @realm shared +-- @bool IsFemale + +--- +-- CanSpeak, returns a bool. +-- @realm shared +-- @bool CanSpeak + +--- +-- NeedsAir, returns a bool. +-- @realm shared +-- @bool NeedsAir + +--- +-- NeedsWater, returns a bool. +-- @realm shared +-- @bool NeedsWater + +--- +-- NeedsOxygen, returns a bool. +-- @realm shared +-- @bool NeedsOxygen + +--- +-- IsTraitor, returns a bool. +-- @realm shared +-- @bool IsTraitor + +--- +-- HideFace, returns a bool. +-- @realm shared +-- @bool HideFace + +--- +-- LockHands, returns a bool. +-- @realm shared +-- @bool LockHands + +--- +-- CanMove, returns a bool. +-- @realm shared +-- @bool CanMove + +--- +-- CanInteract, returns a bool. +-- @realm shared +-- @bool CanInteract + +--- +-- ObstructVision, returns a bool. +-- @realm shared +-- @bool ObstructVision + +--- +-- IsRagdolled, returns a bool. +-- @realm shared +-- @bool IsRagdolled + +--- +-- IsIncapacitated, returns a bool. +-- @realm shared +-- @bool IsIncapacitated + +--- +-- IsUnconscious, returns a bool. +-- @realm shared +-- @bool IsUnconscious + +--- +-- IsPet, returns a bool. +-- @realm shared +-- @bool IsPet + +--- +-- UseHullOxygen, returns a bool. +-- @realm shared +-- @bool UseHullOxygen + +--- +-- CanBeSelected, returns a bool. +-- @realm shared +-- @bool CanBeSelected + +--- +-- CanBeDragged, returns a bool. +-- @realm shared +-- @bool CanBeDragged + +--- +-- CanInventoryBeAccessed, returns a bool. +-- @realm shared +-- @bool CanInventoryBeAccessed + +--- +-- GodMode, returns a bool. +-- @realm shared +-- @bool GodMode + +--- +-- IsInFriendlySub, returns a bool. +-- @realm shared +-- @bool IsInFriendlySub + +--- +-- Position, returns a Vector2. +-- @realm shared +-- @Vector2 Position + +--- +-- DrawPosition, returns a Vector2. +-- @realm shared +-- @Vector2 DrawPosition + +--- +-- CursorPosition, returns a Vector2. +-- @realm shared +-- @Vector2 CursorPosition + +--- +-- SmoothedCursorPosition, returns a Vector2. +-- @realm shared +-- @Vector2 SmoothedCursorPosition + +--- +-- CursorWorldPosition, returns a Vector2. +-- @realm shared +-- @Vector2 CursorWorldPosition + +--- +-- LowPassMultiplier, returns a number. +-- @realm shared +-- @number LowPassMultiplier + +--- +-- Oxygen, returns a number. +-- @realm shared +-- @number Oxygen + +--- +-- OxygenAvailable, returns a number. +-- @realm shared +-- @number OxygenAvailable + +--- +-- Stun, returns a number. +-- @realm shared +-- @number Stun + +--- +-- Vitality, returns a number. +-- @realm shared +-- @number Vitality + +--- +-- MaxVitality, returns a number. +-- @realm shared +-- @number MaxVitality + +--- +-- Health, returns a number. +-- @realm shared +-- @number Health + +--- +-- HealthPercentage, returns a number. +-- @realm shared +-- @number HealthPercentage + +--- +-- SpeechImpediment, returns a number. +-- @realm shared +-- @number SpeechImpediment + +--- +-- PressureTimer, returns a number. +-- @realm shared +-- @number PressureTimer + +--- +-- CurrentSpeed, returns a number. +-- @realm shared +-- @number CurrentSpeed + +--- +-- FocusedItem, returns a Item. +-- @realm shared +-- @Item FocusedItem + +--- +-- PickingItem, returns a Item. +-- @realm shared +-- @Item PickingItem + +--- +-- Name, returns a string. +-- @realm shared +-- @string Name + +--- +-- DisplayName, returns a string. +-- @realm shared +-- @string DisplayName + +--- +-- LogName, returns a string. +-- @realm shared +-- @string LogName + +--- +-- Inventory, returns a CharacterInventory. +-- @realm shared +-- @CharacterInventory Inventory + +--- +-- CauseOfDeath, returns a CauseOfDeath. +-- @realm shared +-- @CauseOfDeath CauseOfDeath \ No newline at end of file diff --git a/docs/lua/Client.lua b/docs/lua/Client.lua index 117924e54..1e56baea2 100644 --- a/docs/lua/Client.lua +++ b/docs/lua/Client.lua @@ -31,12 +31,15 @@ function Client:CheckPermission(permissions) end function Client.Unban(player, endpoint) end ---- List of all connected clients. --- @treturn table --- @realm shared -Client.ClientList = {} ---- The Character that the client is currently controlling. --- @treturn Character --- @realm shared -Character = {} \ No newline at end of file +--- +-- List of all connected clients. +-- @realm shared +-- @Character Client.ClientList Table containing characters + +--- +-- Character that the client is currently controlling. +-- @realm shared +-- @Character Character + + diff --git a/docs/lua/Item.lua b/docs/lua/Item.lua index b86175605..bc1008b3c 100644 --- a/docs/lua/Item.lua +++ b/docs/lua/Item.lua @@ -23,6 +23,13 @@ function Item:GetComponentString(componentName) end -- @realm server function Item: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 + --- List of all items. -- @treturn table -- @realm shared