diff --git a/docs/lua/Hooks.lua b/docs/lua/Hooks.lua index 9df1738e0..765cedcdb 100644 --- a/docs/lua/Hooks.lua +++ b/docs/lua/Hooks.lua @@ -18,7 +18,7 @@ local Hook = {} -- Hook.Add("characterDeath", "characterDeathExample", function(character) -- print(character) -- end) -function Hook.Add(eventname, hookname, func) end +function Hook.Add(eventName, hookName, func) end --- Removes a hook. -- @tparam string eventname event name @@ -26,7 +26,7 @@ function Hook.Add(eventname, hookname, func) end -- @realm shared -- @usage -- Hook.Remove("characterDeath", "characterDeathExample") -function Hook.Remove(eventname, hookname) end +function Hook.Remove(eventName, hookName) end --- Calls a hook. -- @tparam string eventname event name @@ -36,7 +36,18 @@ function Hook.Remove(eventname, hookname) end -- Hook.Add("think", "happyDebuggingSuckers", function() -- Hook.Call("characterDead", {}) -- ruin someone's day -- end) -function Hook.Call(eventname, parameters) end +function Hook.Call(eventName, parameters) end + +--- Patches a method, the callback is called with an instance variable and a ptable variable, ptable contains dictionary of parameter name -> parameter +-- @tparam string className +-- @tparam string methodName +-- @tparam function callback +-- @realm shared +-- @usage +-- Hook.HookMethod("Barotrauma.CharacterInfo", "IncreaseSkillLevel", function (instance, ptable) +-- print(string.format("%s gained % xp", instance.Character.Name, ptable.increase)) +-- end, Hook.HookMethodType.After) +function Hook.HookMethod(className, methodName, callback) end --- Game's fixed update rate, gets called normally 60 times a second. -- @realm shared diff --git a/docs/lua/enums/Hook.HookMethodType.lua b/docs/lua/enums/Hook.HookMethodType.lua new file mode 100644 index 000000000..84d23c963 --- /dev/null +++ b/docs/lua/enums/Hook.HookMethodType.lua @@ -0,0 +1,14 @@ +--[[-- +Hook.HookMethodType enum. +]] +-- @enum Hook.HookMethodType + +--- +-- Hook.HookMethodType.Before = 0 +-- @realm shared +-- @number Hook.HookMethodType.Before + +--- +-- Hook.HookMethodType.After = 1 +-- @realm shared +-- @number Hook.HookMethodType.After \ No newline at end of file diff --git a/docs/lua/generated/AfflictionPrefab.lua b/docs/lua/generated/AfflictionPrefab.lua index b9f8ad93e..f685c422a 100644 --- a/docs/lua/generated/AfflictionPrefab.lua +++ b/docs/lua/generated/AfflictionPrefab.lua @@ -151,6 +151,21 @@ function GetHashCode() end -- @realm shared -- @bool IsBuff +--- +-- HealableInMedicalClinic, Field of type bool +-- @realm shared +-- @bool HealableInMedicalClinic + +--- +-- HealCostMultiplier, Field of type number +-- @realm shared +-- @number HealCostMultiplier + +--- +-- BaseHealCost, Field of type number +-- @realm shared +-- @number BaseHealCost + --- -- CauseOfDeathDescription, Field of type string -- @realm shared diff --git a/docs/lua/generated/AnimController.lua b/docs/lua/generated/AnimController.lua index 98244f41c..80a045faf 100644 --- a/docs/lua/generated/AnimController.lua +++ b/docs/lua/generated/AnimController.lua @@ -36,6 +36,11 @@ function GetCurrentSpeed(useMaxSpeed) end -- @treturn AnimationParams function GetAnimationParamsFromType(type) end +--- GetHeightFromFloor +-- @realm shared +-- @treturn number +function GetHeightFromFloor() end + --- UpdateUseItem -- @realm shared -- @tparam bool allowMovement @@ -394,6 +399,11 @@ function GetHashCode() end -- @realm shared -- @number WalkPos +--- +-- IsAboveFloor, Field of type bool +-- @realm shared +-- @bool IsAboveFloor + --- -- RagdollParams, Field of type RagdollParams -- @realm shared diff --git a/docs/lua/generated/Character.lua b/docs/lua/generated/Character.lua index aa9022bcc..9c955fc39 100644 --- a/docs/lua/generated/Character.lua +++ b/docs/lua/generated/Character.lua @@ -44,6 +44,12 @@ function TeleportTo(worldPos) end -- @table Character.CharacterList +--- ApplyStatusEffects +-- @realm shared +-- @tparam function actionType +-- @tparam number deltaTime +function ApplyStatusEffects(actionType, deltaTime) end + --- BreakJoints -- @realm shared function BreakJoints() end @@ -140,6 +146,11 @@ function GiveTalent(talentPrefab, addingFirstTime) end -- @treturn bool function HasTalent(identifier) end +--- HasUnlockedAllTalents +-- @realm shared +-- @treturn bool +function HasUnlockedAllTalents() end + --- GetFriendlyCrew -- @realm shared -- @tparam Character character @@ -573,7 +584,8 @@ function ApplyAttack(attacker, worldPosition, attack, deltaTime, playSound, targ -- @tparam number severLimbsProbability -- @tparam number damage -- @tparam bool allowBeheading -function TrySeverLimbJoints(targetLimb, severLimbsProbability, damage, allowBeheading) end +-- @tparam Character attacker +function TrySeverLimbJoints(targetLimb, severLimbsProbability, damage, allowBeheading, attacker) end --- AddDamage -- @realm shared @@ -639,12 +651,6 @@ function TryAdjustAttackerSkill(attacker, healthChange) end -- @tparam bool isNetworkMessage function SetStun(newStun, allowStunDecrease, isNetworkMessage) end ---- ApplyStatusEffects --- @realm shared --- @tparam function actionType --- @tparam number deltaTime -function ApplyStatusEffects(actionType, deltaTime) end - --- Create -- @realm shared -- @tparam string speciesName @@ -882,6 +888,11 @@ function GetHashCode() end -- @realm shared -- @Character SecondLastOrderedCharacter +--- +-- ItemSelectedDurations, Field of type table +-- @realm shared +-- @table ItemSelectedDurations + --- -- SpeciesName, Field of type string -- @realm shared diff --git a/docs/lua/generated/CharacterHealth.lua b/docs/lua/generated/CharacterHealth.lua index 10d921d95..a046a34b3 100644 --- a/docs/lua/generated/CharacterHealth.lua +++ b/docs/lua/generated/CharacterHealth.lua @@ -243,6 +243,11 @@ function GetHashCode() end -- @realm shared -- @number CrushDepth +--- +-- BloodlossAffliction, Field of type Affliction +-- @realm shared +-- @Affliction BloodlossAffliction + --- -- IsUnconscious, Field of type bool -- @realm shared @@ -308,11 +313,6 @@ function GetHashCode() end -- @realm shared -- @Affliction PressureAffliction ---- --- Character, Field of type Character --- @realm shared --- @Character Character - --- -- Unkillable, Field of type bool -- @realm shared @@ -323,6 +323,11 @@ function GetHashCode() end -- @realm shared -- @Color DefaultFaceTint +--- +-- Character, Field of type Character +-- @realm shared +-- @Character Character + --- -- CharacterHealth.InsufficientOxygenThreshold, Field of type number -- @realm shared diff --git a/docs/lua/generated/CharacterInfo.lua b/docs/lua/generated/CharacterInfo.lua index 39e5ddff5..01963e526 100644 --- a/docs/lua/generated/CharacterInfo.lua +++ b/docs/lua/generated/CharacterInfo.lua @@ -10,6 +10,11 @@ Barotrauma source code: [CharacterInfo.cs](https://github.com/evilfactory/Barotr local CharacterInfo = {} +--- RecreateHead +-- @realm shared +-- @tparam HeadInfo headInfo +function RecreateHead(headInfo) end + --- RecreateHead -- @realm shared -- @tparam number headID @@ -315,11 +320,6 @@ function CharacterInfo.IsMatchingGender(gender, myGender) end -- @treturn bool function CharacterInfo.IsMatchingRace(race, myRace) end ---- RecreateHead --- @realm shared --- @tparam HeadInfo headInfo -function RecreateHead(headInfo) end - --- GetType -- @realm shared -- @treturn Type diff --git a/docs/lua/generated/GameSession.lua b/docs/lua/generated/GameSession.lua index 8abd75d08..2ea84874f 100644 --- a/docs/lua/generated/GameSession.lua +++ b/docs/lua/generated/GameSession.lua @@ -88,6 +88,11 @@ function GameSession.GetSessionCrewCharacters() end -- @tparam TransitionType transitionType function EndRound(endMessage, traitorResults, transitionType) end +--- LogEndRoundStats +-- @realm shared +-- @tparam string eventId +function LogEndRoundStats(eventId) end + --- KillCharacter -- @realm shared -- @tparam Character character @@ -216,6 +221,16 @@ function GetHashCode() end -- @realm shared -- @number RoundStartTime +--- +-- TimeSpentCleaning, Field of type number +-- @realm shared +-- @number TimeSpentCleaning + +--- +-- TimeSpentPainting, Field of type number +-- @realm shared +-- @number TimeSpentPainting + --- -- WinningTeam, Field of type Nullable`1 -- @realm shared diff --git a/docs/lua/generated/GameSettings.lua b/docs/lua/generated/GameSettings.lua new file mode 100644 index 000000000..f7d1796bc --- /dev/null +++ b/docs/lua/generated/GameSettings.lua @@ -0,0 +1,539 @@ +-- luacheck: ignore 111 + +--[[-- +Barotrauma.GameSettings +]] +-- @code Game.GameSettings +-- @pragma nostrip +local GameSettings = {} + +--- SelectCorePackage +-- @realm shared +-- @tparam ContentPackage contentPackage +-- @tparam bool forceReloadAll +function SelectCorePackage(contentPackage, forceReloadAll) end + +--- AutoSelectCorePackage +-- @realm shared +-- @tparam Enumerable toRemove +function AutoSelectCorePackage(toRemove) end + +--- BackUpModOrder +-- @realm shared +function BackUpModOrder() end + +--- SwapPackages +-- @realm shared +-- @tparam ContentPackage corePackage +-- @tparam table regularPackages +function SwapPackages(corePackage, regularPackages) end + +--- RestoreBackupPackages +-- @realm shared +function RestoreBackupPackages() end + +--- EnableRegularPackage +-- @realm shared +-- @tparam ContentPackage contentPackage +function EnableRegularPackage(contentPackage) end + +--- DisableRegularPackage +-- @realm shared +-- @tparam ContentPackage contentPackage +function DisableRegularPackage(contentPackage) end + +--- SortContentPackages +-- @realm shared +-- @tparam bool refreshAll +function SortContentPackages(refreshAll) end + +--- EnableContentPackageItems +-- @realm shared +-- @tparam Enumerable unorderedFiles +function EnableContentPackageItems(unorderedFiles) end + +--- DisableContentPackageItems +-- @realm shared +-- @tparam Enumerable unorderedFiles +function DisableContentPackageItems(unorderedFiles) end + +--- RefreshContentPackageItems +-- @realm shared +-- @tparam Enumerable files +function RefreshContentPackageItems(files) end + +--- LoadPlayerConfig +-- @realm shared +function LoadPlayerConfig() end + +--- SaveNewPlayerConfig +-- @realm shared +-- @treturn bool +function SaveNewPlayerConfig() end + +--- ResetToDefault +-- @realm shared +function ResetToDefault() end + +--- AreJobPreferencesEqual +-- @realm shared +-- @tparam table compareTo +-- @treturn bool +function AreJobPreferencesEqual(compareTo) 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 + +--- +-- GraphicsWidth, Field of type number +-- @realm shared +-- @number GraphicsWidth + +--- +-- GraphicsHeight, Field of type number +-- @realm shared +-- @number GraphicsHeight + +--- +-- VSyncEnabled, Field of type bool +-- @realm shared +-- @bool VSyncEnabled + +--- +-- TextureCompressionEnabled, Field of type bool +-- @realm shared +-- @bool TextureCompressionEnabled + +--- +-- EnableSplashScreen, Field of type bool +-- @realm shared +-- @bool EnableSplashScreen + +--- +-- ParticleLimit, Field of type number +-- @realm shared +-- @number ParticleLimit + +--- +-- LightMapScale, Field of type number +-- @realm shared +-- @number LightMapScale + +--- +-- ChromaticAberrationEnabled, Field of type bool +-- @realm shared +-- @bool ChromaticAberrationEnabled + +--- +-- PauseOnFocusLost, Field of type bool +-- @realm shared +-- @bool PauseOnFocusLost + +--- +-- MuteOnFocusLost, Field of type bool +-- @realm shared +-- @bool MuteOnFocusLost + +--- +-- DynamicRangeCompressionEnabled, Field of type bool +-- @realm shared +-- @bool DynamicRangeCompressionEnabled + +--- +-- VoipAttenuationEnabled, Field of type bool +-- @realm shared +-- @bool VoipAttenuationEnabled + +--- +-- UseDirectionalVoiceChat, Field of type bool +-- @realm shared +-- @bool UseDirectionalVoiceChat + +--- +-- DisableVoiceChatFilters, Field of type bool +-- @realm shared +-- @bool DisableVoiceChatFilters + +--- +-- AudioOutputDevice, Field of type string +-- @realm shared +-- @string AudioOutputDevice + +--- +-- VoiceSetting, Field of type VoiceMode +-- @realm shared +-- @VoiceMode VoiceSetting + +--- +-- VoiceCaptureDevice, Field of type string +-- @realm shared +-- @string VoiceCaptureDevice + +--- +-- NoiseGateThreshold, Field of type number +-- @realm shared +-- @number NoiseGateThreshold + +--- +-- UseLocalVoiceByDefault, Field of type bool +-- @realm shared +-- @bool UseLocalVoiceByDefault + +--- +-- RequireSteamAuthentication, Field of type bool +-- @realm shared +-- @bool RequireSteamAuthentication + +--- +-- UseSteamMatchmaking, Field of type bool +-- @realm shared +-- @bool UseSteamMatchmaking + +--- +-- UseDualModeSockets, Field of type bool +-- @realm shared +-- @bool UseDualModeSockets + +--- +-- WindowMode, Field of type WindowMode +-- @realm shared +-- @WindowMode WindowMode + +--- +-- JobPreferences, Field of type table +-- @realm shared +-- @table JobPreferences + +--- +-- TeamPreference, Field of type CharacterTeamType +-- @realm shared +-- @CharacterTeamType TeamPreference + +--- +-- AimAssistAmount, Field of type number +-- @realm shared +-- @number AimAssistAmount + +--- +-- EnableMouseLook, Field of type bool +-- @realm shared +-- @bool EnableMouseLook + +--- +-- EnableRadialDistortion, Field of type bool +-- @realm shared +-- @bool EnableRadialDistortion + +--- +-- CrewMenuOpen, Field of type bool +-- @realm shared +-- @bool CrewMenuOpen + +--- +-- ChatOpen, Field of type bool +-- @realm shared +-- @bool ChatOpen + +--- +-- CorpseDespawnDelay, Field of type number +-- @realm shared +-- @number CorpseDespawnDelay + +--- +-- CorpsesPerSubDespawnThreshold, Field of type number +-- @realm shared +-- @number CorpsesPerSubDespawnThreshold + +--- +-- UnsavedSettings, Field of type bool +-- @realm shared +-- @bool UnsavedSettings + +--- +-- SoundVolume, Field of type number +-- @realm shared +-- @number SoundVolume + +--- +-- MusicVolume, Field of type number +-- @realm shared +-- @number MusicVolume + +--- +-- VoiceChatVolume, Field of type number +-- @realm shared +-- @number VoiceChatVolume + +--- +-- VoiceChatCutoffPrevention, Field of type number +-- @realm shared +-- @number VoiceChatCutoffPrevention + +--- +-- MicrophoneVolume, Field of type number +-- @realm shared +-- @number MicrophoneVolume + +--- +-- Language, Field of type string +-- @realm shared +-- @string Language + +--- +-- CurrentCorePackage, Field of type ContentPackage +-- @realm shared +-- @ContentPackage CurrentCorePackage + +--- +-- EnabledRegularPackages, Field of type IReadOnlyList`1 +-- @realm shared +-- @IReadOnlyList`1 EnabledRegularPackages + +--- +-- AllEnabledPackages, Field of type Enumerable +-- @realm shared +-- @Enumerable AllEnabledPackages + +--- +-- ContentPackageSelectionDirtyNotification, Field of type bool +-- @realm shared +-- @bool ContentPackageSelectionDirtyNotification + +--- +-- ContentPackageSelectionDirty, Field of type bool +-- @realm shared +-- @bool ContentPackageSelectionDirty + +--- +-- ServerFilterElement, Field of type XElement +-- @realm shared +-- @XElement ServerFilterElement + +--- +-- DisableInGameHints, Field of type bool +-- @realm shared +-- @bool DisableInGameHints + +--- +-- AutomaticQuickStartEnabled, Field of type bool +-- @realm shared +-- @bool AutomaticQuickStartEnabled + +--- +-- AutomaticCampaignLoadEnabled, Field of type bool +-- @realm shared +-- @bool AutomaticCampaignLoadEnabled + +--- +-- TextManagerDebugModeEnabled, Field of type bool +-- @realm shared +-- @bool TextManagerDebugModeEnabled + +--- +-- TestScreenEnabled, Field of type bool +-- @realm shared +-- @bool TestScreenEnabled + +--- +-- ModBreakerMode, Field of type bool +-- @realm shared +-- @bool ModBreakerMode + +--- +-- MasterServerUrl, Field of type string +-- @realm shared +-- @string MasterServerUrl + +--- +-- RemoteContentUrl, Field of type string +-- @realm shared +-- @string RemoteContentUrl + +--- +-- AutoCheckUpdates, Field of type bool +-- @realm shared +-- @bool AutoCheckUpdates + +--- +-- PlayerName, Field of type string +-- @realm shared +-- @string PlayerName + +--- +-- LosMode, Field of type LosMode +-- @realm shared +-- @LosMode LosMode + +--- +-- GameSettings.HUDScale, Field of type number +-- @realm shared +-- @number GameSettings.HUDScale + +--- +-- GameSettings.InventoryScale, Field of type number +-- @realm shared +-- @number GameSettings.InventoryScale + +--- +-- GameSettings.TextScale, Field of type number +-- @realm shared +-- @number GameSettings.TextScale + +--- +-- CompletedTutorialNames, Field of type table +-- @realm shared +-- @table CompletedTutorialNames + +--- +-- IgnoredHints, Field of type HashSet`1 +-- @realm shared +-- @HashSet`1 IgnoredHints + +--- +-- EncounteredCreatures, Field of type HashSet`1 +-- @realm shared +-- @HashSet`1 EncounteredCreatures + +--- +-- KilledCreatures, Field of type HashSet`1 +-- @realm shared +-- @HashSet`1 KilledCreatures + +--- +-- GameSettings.VerboseLogging, Field of type bool +-- @realm shared +-- @bool GameSettings.VerboseLogging + +--- +-- GameSettings.SaveDebugConsoleLogs, Field of type bool +-- @realm shared +-- @bool GameSettings.SaveDebugConsoleLogs + +--- +-- ShowLanguageSelectionPrompt, Field of type bool +-- @realm shared +-- @bool ShowLanguageSelectionPrompt + +--- +-- GameSettings.ShowOffensiveServerPrompt, Field of type bool +-- @realm shared +-- @bool GameSettings.ShowOffensiveServerPrompt + +--- +-- GameSettings.EnableSubmarineAutoSave, Field of type bool +-- @realm shared +-- @bool GameSettings.EnableSubmarineAutoSave + +--- +-- GameSettings.MaximumAutoSaves, Field of type number +-- @realm shared +-- @number GameSettings.MaximumAutoSaves + +--- +-- GameSettings.AutoSaveIntervalSeconds, Field of type number +-- @realm shared +-- @number GameSettings.AutoSaveIntervalSeconds + +--- +-- GameSettings.SubEditorBackgroundColor, Field of type Color +-- @realm shared +-- @Color GameSettings.SubEditorBackgroundColor + +--- +-- GameSettings.SubEditorMaxUndoBuffer, Field of type number +-- @realm shared +-- @number GameSettings.SubEditorMaxUndoBuffer + +--- +-- ShowTutorialSkipWarning, Field of type bool +-- @realm shared +-- @bool ShowTutorialSkipWarning + +--- +-- AudioDeviceNames, Field of type IList`1 +-- @realm shared +-- @IList`1 AudioDeviceNames + +--- +-- CaptureDeviceNames, Field of type IList`1 +-- @realm shared +-- @IList`1 CaptureDeviceNames + +--- +-- jobPreferences, Field of type table +-- @realm shared +-- @table jobPreferences + +--- +-- QuickStartSubmarineName, Field of type string +-- @realm shared +-- @string QuickStartSubmarineName + +--- +-- AutoUpdateWorkshopItems, Field of type bool +-- @realm shared +-- @bool AutoUpdateWorkshopItems + +--- +-- SuppressModFolderWatcher, Field of type bool +-- @realm shared +-- @bool SuppressModFolderWatcher + +--- +-- WaitingForAutoUpdate, Field of type bool +-- @realm shared +-- @bool WaitingForAutoUpdate + +--- +-- RecentlyEncounteredCreatures, Field of type HashSet`1 +-- @realm shared +-- @HashSet`1 RecentlyEncounteredCreatures + +--- +-- CampaignDisclaimerShown, Field of type bool +-- @realm shared +-- @bool CampaignDisclaimerShown + +--- +-- EditorDisclaimerShown, Field of type bool +-- @realm shared +-- @bool EditorDisclaimerShown + +--- +-- GameSettings.SavePath, Field of type string +-- @realm shared +-- @string GameSettings.SavePath + +--- +-- GameSettings.PlayerSavePath, Field of type string +-- @realm shared +-- @string GameSettings.PlayerSavePath + +--- +-- GameSettings.VanillaContentPackagePath, Field of type string +-- @realm shared +-- @string GameSettings.VanillaContentPackagePath + +--- +-- GameSettings.MaxMicrophoneVolume, Field of type number +-- @realm shared +-- @number GameSettings.MaxMicrophoneVolume + diff --git a/docs/lua/generated/Hull.lua b/docs/lua/generated/Hull.lua index 7f2aa2d16..6af7ffd8f 100644 --- a/docs/lua/generated/Hull.lua +++ b/docs/lua/generated/Hull.lua @@ -7,22 +7,6 @@ Barotrauma.Hull -- @pragma nostrip local Hull = {} ---- IncreaseSectionColorOrStrength --- @realm shared --- @tparam BackgroundSection section --- @tparam Nullable`1 color --- @tparam Nullable`1 strength --- @tparam bool requiresUpdate --- @tparam bool isCleaning -function IncreaseSectionColorOrStrength(section, color, strength, requiresUpdate, isCleaning) end - ---- SetSectionColorOrStrength --- @realm shared --- @tparam BackgroundSection section --- @tparam Nullable`1 color --- @tparam Nullable`1 strength -function SetSectionColorOrStrength(section, color, strength) end - --- DirtySections -- @realm shared -- @tparam table sections @@ -269,6 +253,22 @@ function RefreshSubmergedSections(waterArea) end -- @treturn bool function DoesSectionMatch(index, row) end +--- IncreaseSectionColorOrStrength +-- @realm shared +-- @tparam BackgroundSection section +-- @tparam Nullable`1 color +-- @tparam Nullable`1 strength +-- @tparam bool requiresUpdate +-- @tparam bool isCleaning +function IncreaseSectionColorOrStrength(section, color, strength, requiresUpdate, isCleaning) end + +--- SetSectionColorOrStrength +-- @realm shared +-- @tparam BackgroundSection section +-- @tparam Nullable`1 color +-- @tparam Nullable`1 strength +function SetSectionColorOrStrength(section, color, strength) end + --- ResolveLinks -- @realm shared -- @tparam IdRemap childRemap @@ -417,11 +417,6 @@ function GetHashCode() end -- @realm shared -- @number Surface ---- --- DrawSurface, Field of type number --- @realm shared --- @number DrawSurface - --- -- WorldSurface, Field of type number -- @realm shared @@ -617,6 +612,11 @@ function GetHashCode() end -- @realm shared -- @bool RemoveIfLinkedOutpostDoorInUse +--- +-- Layer, Field of type string +-- @realm shared +-- @string Layer + --- -- Removed, Field of type bool -- @realm shared diff --git a/docs/lua/generated/Item.lua b/docs/lua/generated/Item.lua index 4323b0b6b..ce65e697e 100644 --- a/docs/lua/generated/Item.lua +++ b/docs/lua/generated/Item.lua @@ -46,6 +46,10 @@ function SendSignal(signalOrString, connectionOrConnectionName) end -- @Vector2 WorldPosition +--- UpdateTransform +-- @realm shared +function UpdateTransform() end + --- FlipX -- @realm shared -- @tparam bool relativeToSub @@ -65,8 +69,9 @@ function GetConnectedComponents(recursive) end --- GetConnectedComponentsRecursive -- @realm shared -- @tparam Connection c +-- @tparam bool ignoreInactiveRelays -- @treturn table -function GetConnectedComponentsRecursive(c) end +function GetConnectedComponentsRecursive(c, ignoreInactiveRelays) end --- FindController -- @realm shared @@ -451,10 +456,6 @@ function SendPendingNetworkUpdates() end -- @tparam Camera cam function Update(deltaTime, cam) end ---- UpdateTransform --- @realm shared -function UpdateTransform() end - --- ServerWrite -- @realm shared -- @tparam IWriteMessage msg @@ -619,6 +620,11 @@ function GetHashCode() end -- @realm shared -- @InteractionType CampaignInteractionType +--- +-- DefaultRect, Field of type Rectangle +-- @realm shared +-- @Rectangle DefaultRect + --- -- SerializableProperties, Field of type table -- @realm shared @@ -920,14 +926,14 @@ function GetHashCode() end -- @bool DisplaySideBySideWhenLinked --- --- Repairables, Field of type Enumerable +-- Repairables, Field of type table -- @realm shared --- @Enumerable Repairables +-- @table Repairables --- --- Components, Field of type Enumerable +-- Components, Field of type table -- @realm shared --- @Enumerable Components +-- @table Components --- -- Linkable, Field of type bool @@ -955,9 +961,9 @@ function GetHashCode() end -- @ItemPrefab PendingItemSwap --- --- AllPropertyObjects, Field of type Enumerable +-- AllPropertyObjects, Field of type IReadOnlyList`1 -- @realm shared --- @Enumerable AllPropertyObjects +-- @IReadOnlyList`1 AllPropertyObjects --- -- OrderedToBeIgnored, Field of type bool @@ -1054,6 +1060,11 @@ function GetHashCode() end -- @realm shared -- @bool RemoveIfLinkedOutpostDoorInUse +--- +-- Layer, Field of type string +-- @realm shared +-- @string Layer + --- -- Removed, Field of type bool -- @realm shared diff --git a/docs/lua/generated/ItemPrefab.lua b/docs/lua/generated/ItemPrefab.lua index fdf4072c9..1f91c7774 100644 --- a/docs/lua/generated/ItemPrefab.lua +++ b/docs/lua/generated/ItemPrefab.lua @@ -138,6 +138,11 @@ function ItemPrefab.IsContainerPreferred(preferences, c) end -- @treturn bool function ItemPrefab.IsContainerPreferred(preferences, ids) end +--- ToString +-- @realm shared +-- @treturn string +function ToString() end + --- GetItemPrefab -- @realm shared -- @tparam string itemNameOrId @@ -212,11 +217,6 @@ function IsLinkAllowed(target) end -- @treturn Type function GetType() end ---- ToString --- @realm shared --- @treturn string -function ToString() end - --- Equals -- @realm shared -- @tparam Object obj @@ -368,6 +368,11 @@ function GetHashCode() end -- @realm shared -- @number ImpactTolerance +--- +-- OnDamagedThreshold, Field of type number +-- @realm shared +-- @number OnDamagedThreshold + --- -- SonarSize, Field of type number -- @realm shared diff --git a/docs/lua/generated/Level.lua b/docs/lua/generated/Level.lua index 0479a8849..e849cbbea 100644 --- a/docs/lua/generated/Level.lua +++ b/docs/lua/generated/Level.lua @@ -89,13 +89,6 @@ function GetCells(worldPos, searchDepth) end -- @treturn VoronoiCell function GetClosestCell(worldPos) end ---- GetWreckIDTag --- @realm shared --- @tparam string originalTag --- @tparam Submarine wreck --- @treturn string -function GetWreckIDTag(originalTag, wreck) end - --- IsCloseToStart -- @realm shared -- @tparam Vector2 position diff --git a/docs/lua/generated/NetLobbyScreen.lua b/docs/lua/generated/NetLobbyScreen.lua index 751bd0c89..2ec0c1944 100644 --- a/docs/lua/generated/NetLobbyScreen.lua +++ b/docs/lua/generated/NetLobbyScreen.lua @@ -105,11 +105,6 @@ function GetHashCode() end -- @realm shared -- @SubmarineInfo SelectedShuttle ---- --- CampaignSubmarines, Field of type table --- @realm shared --- @table CampaignSubmarines - --- -- GameModes, Field of type GameModePreset[] -- @realm shared diff --git a/docs/lua/generated/Submarine.lua b/docs/lua/generated/Submarine.lua index 7558d4ca4..27b479da9 100644 --- a/docs/lua/generated/Submarine.lua +++ b/docs/lua/generated/Submarine.lua @@ -43,12 +43,12 @@ function Submarine.RepositionEntities(moveAmount, entities) end -- @tparam XElement element function SaveToXElement(element) end ---- SaveAs +--- TrySaveAs -- @realm shared -- @tparam string filePath -- @tparam MemoryStream previewImage -- @treturn bool -function SaveAs(filePath, previewImage) end +function TrySaveAs(filePath, previewImage) end --- Unload -- @realm shared diff --git a/docs/lua/generated/SubmarineInfo.lua b/docs/lua/generated/SubmarineInfo.lua index 43a919e25..1f1dc10d9 100644 --- a/docs/lua/generated/SubmarineInfo.lua +++ b/docs/lua/generated/SubmarineInfo.lua @@ -65,7 +65,6 @@ function GetRealWorldCrushDepthMultiplier() end -- @realm shared -- @tparam string filePath -- @tparam MemoryStream previewImage --- @treturn bool function SaveAs(filePath, previewImage) end --- AddToSavedSubs diff --git a/docs/lua/generated/WayPoint.lua b/docs/lua/generated/WayPoint.lua index 6aef4442a..0ee8b8492 100644 --- a/docs/lua/generated/WayPoint.lua +++ b/docs/lua/generated/WayPoint.lua @@ -350,6 +350,11 @@ function GetHashCode() end -- @realm shared -- @bool RemoveIfLinkedOutpostDoorInUse +--- +-- Layer, Field of type string +-- @realm shared +-- @string Layer + --- -- Removed, Field of type bool -- @realm shared diff --git a/docs/manual/how-to-use-hooks.md b/docs/manual/how-to-use-hooks.md new file mode 100644 index 000000000..17d8fd1f5 --- /dev/null +++ b/docs/manual/how-to-use-hooks.md @@ -0,0 +1,51 @@ +# How to use hooks + +Hooks are basically functions that get called when events happen in-game, like chat messages. They can be triggered either by Lua itself or the game code. + +## Adding hooks + +Hooks can be added like this: + +```lua +Hook.Add("chatMessage", "test", function(message, client) + print(client.Name .. " has sent " .. message) +end) +``` + +The event name (first argument), is case-insensitive, so you can call it chatMessage, cHaTmEsSaGe, chatmessage, etc. + +## Calling hooks + +You can also call hooks with the following code: + +```lua +Hook.Call("myCustomEvent", {"some", "arguments", 123}) +``` + +## XML Status Effect Hooks + +With Lua, a new XML tags is added, it can be used to call Lua hooks inside status effects: + +```xml + + + +``` + +```lua +Hook.Add("doSomething", "something", function (effect, deltaTime, item, targets, worldPosition) + print(effect, ' ', item) +end) +``` + +## Patching + +Patching allows you to hook into existing methods in the game code, notice that it can be a little unstable depending on the method that you are patching, so be aware. + +```lua +Hook.HookMethod("Barotrauma.CharacterInfo", "IncreaseSkillLevel", function (instance, ptable) + print(string.format("%s gained % xp", instance.Character.Name, ptable.increase)) +end, Hook.HookMethodType.After) +``` + +If you return anything other than nil, it will stop the execution of the method, if the method has a return type, it will also return what you returned in the Lua function. (Only in Hook.HookMethodType.After) \ No newline at end of file diff --git a/docs/manual/lua-examples.md b/docs/manual/lua-examples.md index bd5e7af1a..abf29470e 100644 --- a/docs/manual/lua-examples.md +++ b/docs/manual/lua-examples.md @@ -62,7 +62,7 @@ Hook.Add("chatMessage","controlhuskcommand",function(msg, client) local suitablechars = {} for i = 1, #chars, 1 do local charat = chars[i] - if not charat.IsDead and string.match(string.lower(charat.SpeciesName), "husk") and not charat IsRemotelyControlled then + if not charat.IsDead and string.match(string.lower(charat.SpeciesName), "husk") and not charat.IsRemotelyControlled then table.insert(suitablechars, charat) end end