diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82d7320 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +LocalMods/ diff --git a/LocalMods/LuaCsForBarotrauma/Config/SettingsShared.xml b/LocalMods/LuaCsForBarotrauma/Config/SettingsShared.xml deleted file mode 100644 index 99fdf1f..0000000 --- a/LocalMods/LuaCsForBarotrauma/Config/SettingsShared.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/LocalMods/LuaCsForBarotrauma/Lua/CompatibilityLib.lua b/LocalMods/LuaCsForBarotrauma/Lua/CompatibilityLib.lua deleted file mode 100644 index 6ca382f..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/CompatibilityLib.lua +++ /dev/null @@ -1,81 +0,0 @@ --- Contains things to be removed later, they exist only for compatibility reasons. - -local compatibilityLib = {} - --- local networking = LuaUserData.RegisterType("Barotrauma.LuaCsNetworking") - --- LuaUserData.AddMethod(networking, "RequestGetHTTP", Networking.HttpGet) - --- LuaUserData.AddMethod(networking, "RequestPostHTTP", Networking.HttpPost) - -compatibilityLib.CreateVector2 = Vector2.__new -compatibilityLib.CreateVector3 = Vector3.__new -compatibilityLib.CreateVector4 = Vector4.__new - -local luaRandom = {} - -luaRandom.Range = function (min, max) - return math.random(min, max - 1) -end - -luaRandom.RangeFloat = function (min, max) - return math.random() + math.random(min, max) -end - -compatibilityLib["Random"] = luaRandom - -local luaPlayer = {} - -luaPlayer.GetAllCharacters = function () - return Character.CharacterList -end - -luaPlayer.GetAllClients = function () - return Client.ClientList -end - -luaPlayer.SetClientCharacter = function (client, character) - client.SetClientCharacter(character) -end - -luaPlayer.SetCharacterTeam = function (character, team) - character.TeamID = team -end - -luaPlayer.SetClientTeam = function (client, team) - client.TeamID = team -end - -luaPlayer.Kick = function (client, reason) - client.Kick(reason) -end - -luaPlayer.Ban = function (client, reason, range, seconds) - client.Ban(reason, range, seconds) -end - -luaPlayer.UnbanPlayer = function (player, endpoint) - Client.Unban(player, endpoint) -end - -luaPlayer.SetSpectatorPos = function () - -end - -luaPlayer.SetRadioRange = function (character, range) - if (character.Inventory == nil) then return end - - for item in character.Inventory.AllItems do - if item ~= nil and item.Prefab.Identifier == "headset" then - item.GetComponentString("WifiComponent").Range = range; - end - end -end - -luaPlayer.CheckPermission = function (client, permissions) - return client.CheckPermission(permissions) -end - -compatibilityLib["Player"] = luaPlayer - -return compatibilityLib \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Lua/DefaultHook.lua b/LocalMods/LuaCsForBarotrauma/Lua/DefaultHook.lua deleted file mode 100644 index 520e884..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/DefaultHook.lua +++ /dev/null @@ -1,68 +0,0 @@ -Hook.Patch("Barotrauma.Item", "TryInteract", -{ - "Barotrauma.Character", - "System.Boolean", - "System.Boolean", - "System.Boolean" -}, -function(instance, p) - if Hook.Call("item.interact", instance, p["user"], p["ignoreRequiredItems"], p["forceSelectKey"], p["forceUseKey"]) == true then - p.PreventExecution = true - return false - end -end, Hook.HookMethodType.Before) - -Hook.Patch("Barotrauma.Item", "ApplyTreatment", -{ - "Barotrauma.Character", - "Barotrauma.Character", - "Barotrauma.Limb" -}, -function(instance, p) - if Hook.Call("item.applyTreatment", instance, p["user"], p["character"], p["targetLimb"]) then - p.PreventExecution = true - return false - end -end, Hook.HookMethodType.Before) - -Hook.Patch("Barotrauma.Item", "Combine", -{ - "Barotrauma.Item", - "Barotrauma.Character" -}, -function(instance, p) - if Hook.Call("item.combine", instance, p["item"], p["user"]) == true then - p.PreventExecution = true - return false - end -end, Hook.HookMethodType.Before) - -Hook.Patch("Barotrauma.Item", "Drop", -function(instance, p) - if Hook.Call("item.drop", instance, p["dropper"]) == true then - p.PreventExecution = true - return false - end -end, Hook.HookMethodType.Before) - -Hook.Patch("Barotrauma.Item", "Equip", -{ - "Barotrauma.Character" -}, -function(instance, p) - if Hook.Call("item.equip", instance, p["character"]) == true then - p.PreventExecution = true - return false - end -end, Hook.HookMethodType.Before) - -Hook.Patch("Barotrauma.Item", "Unequip", -{ - "Barotrauma.Character" -}, -function(instance, p) - if Hook.Call("item.unequip", instance, p["character"]) == true then - p.PreventExecution = true - return false - end -end, Hook.HookMethodType.Before) \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibClient.lua b/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibClient.lua deleted file mode 100644 index a6a6a15..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibClient.lua +++ /dev/null @@ -1,90 +0,0 @@ -local defaultLib = {} - -local CreateStatic = LuaUserData.CreateStatic -local CreateEnum = LuaUserData.CreateEnumTable -local AddCallMetaTable = LuaUserData.AddCallMetaTable - -local localizedStrings = { - "LocalizedString", "LimitLString", "WrappedLString", "AddedPunctuationLString", "CapitalizeLString", "ConcatLString", "FallbackLString", "FormattedLString", "InputTypeLString", "JoinLString", "LowerLString", "RawLString", "ReplaceLString", "ServerMsgLString", "SplitLString", "TagLString", "TrimLString", "UpperLString", "StripRichTagsLString", -} - -for key, value in pairs(localizedStrings) do - defaultLib[value] = CreateStatic("Barotrauma." .. value, true) -end - -local sounds = {} -sounds.LowpassFilter = CreateStatic("Barotrauma.Sounds.LowpassFilter") -sounds.HighpassFilter = CreateStatic("Barotrauma.Sounds.HighpassFilter") -sounds.BandpassFilter = CreateStatic("Barotrauma.Sounds.BandpassFilter") -sounds.NotchFilter = CreateStatic("Barotrauma.Sounds.NotchFilter") -sounds.LowShelfFilter = CreateStatic("Barotrauma.Sounds.LowShelfFilter") -sounds.HighShelfFilter = CreateStatic("Barotrauma.Sounds.HighShelfFilter") -sounds.PeakFilter = CreateStatic("Barotrauma.Sounds.PeakFilter") -defaultLib["Sounds"] = sounds - -defaultLib["SpriteEffects"] = CreateStatic("Microsoft.Xna.Framework.Graphics.SpriteEffects") - -defaultLib["SoundPlayer"] = CreateStatic("Barotrauma.SoundPlayer") -defaultLib["SoundPrefab"] = CreateStatic("Barotrauma.SoundPrefab", true) -defaultLib["BackgroundMusic"] = CreateStatic("Barotrauma.BackgroundMusic", true) -defaultLib["GUISound"] = CreateStatic("Barotrauma.GUISound", true) -defaultLib["DamageSound"] = CreateStatic("Barotrauma.DamageSound", true) -defaultLib["WaterRenderer"] = CreateStatic("Barotrauma.WaterRenderer", true) - -defaultLib["TextureLoader"] = CreateStatic("Barotrauma.TextureLoader") -defaultLib["Sprite"] = CreateStatic("Barotrauma.Sprite", true) -defaultLib["PlayerInput"] = CreateStatic("Barotrauma.PlayerInput", true) - -defaultLib["Keys"] = CreateStatic("Microsoft.Xna.Framework.Input.Keys", true) - -defaultLib["GUI"] = { - GUI = CreateStatic("Barotrauma.GUI", true), - Style = CreateStatic("Barotrauma.GUIStyle", true), - Component = CreateStatic("Barotrauma.GUIComponent"), - RectTransform = CreateStatic("Barotrauma.RectTransform", true), - LayoutGroup = CreateStatic("Barotrauma.GUILayoutGroup", true), - Button = CreateStatic("Barotrauma.GUIButton", true), - TextBox = CreateStatic("Barotrauma.GUITextBox", true), - Canvas = CreateStatic("Barotrauma.GUICanvas", true), - Frame = CreateStatic("Barotrauma.GUIFrame", true), - TextBlock = CreateStatic("Barotrauma.GUITextBlock", true), - TickBox = CreateStatic("Barotrauma.GUITickBox", true), - Image = CreateStatic("Barotrauma.GUIImage", true), - ListBox = CreateStatic("Barotrauma.GUIListBox", true), - ScrollBar = CreateStatic("Barotrauma.GUIScrollBar", true), - DropDown = CreateStatic("Barotrauma.GUIDropDown", true), - NumberInput = CreateStatic("Barotrauma.GUINumberInput", true), - MessageBox = CreateStatic("Barotrauma.GUIMessageBox", true), - ColorPicker = CreateStatic("Barotrauma.GUIColorPicker", true), - ProgressBar = CreateStatic("Barotrauma.GUIProgressBar", true), - CustomComponent = CreateStatic("Barotrauma.GUICustomComponent", true), - ScissorComponent = CreateStatic("Barotrauma.GUIScissorComponent", true), - VideoPlayer = CreateStatic("Barotrauma.VideoPlayer", true), - Graph = CreateStatic("Barotrauma.Graph", true), - SerializableEntityEditor = CreateStatic("Barotrauma.SerializableEntityEditor", true), - SlideshowPlayer = CreateStatic("Barotrauma.SlideshowPlayer", true), - CreditsPlayer = CreateStatic("Barotrauma.CreditsPlayer", true), - DragHandle = CreateStatic("Barotrauma.GUIDragHandle", true), - ContextMenu = CreateStatic("Barotrauma.GUIContextMenu", true), - ContextMenuOption = CreateStatic("Barotrauma.ContextMenuOption", true), - - Screen = CreateStatic("Barotrauma.Screen"), - - Anchor = CreateStatic("Barotrauma.Anchor"), - Alignment = CreateStatic("Barotrauma.Alignment"), - Pivot = CreateStatic("Barotrauma.Pivot"), - SoundType = CreateEnum("Barotrauma.GUISoundType"), - CursorState = CreateEnum("Barotrauma.CursorState"), - - GUIStyle = CreateStatic("Barotrauma.GUIStyle", true), -} - -local guiFallback = defaultLib["GUI"].GUI - -setmetatable(defaultLib["GUI"], { - __index = function(_, key) - return guiFallback[key] - end -}) - -return defaultLib \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibServer.lua b/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibServer.lua deleted file mode 100644 index 1076e90..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibServer.lua +++ /dev/null @@ -1,14 +0,0 @@ -local defaultLib = {} - -local CreateStatic = LuaUserData.CreateStatic -local CreateEnum = LuaUserData.CreateEnumTable - -local localizedStrings = { - "LocalizedString", "AddedPunctuationLString", "CapitalizeLString", "ConcatLString", "FallbackLString", "FormattedLString", "InputTypeLString", "JoinLString", "LowerLString", "RawLString", "ReplaceLString", "ServerMsgLString", "SplitLString", "TagLString", "TrimLString", "UpperLString", "StripRichTagsLString", -} - -for key, value in pairs(localizedStrings) do - defaultLib[value] = CreateStatic("Barotrauma." .. value, true) -end - -return defaultLib \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibShared.lua b/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibShared.lua deleted file mode 100644 index db84691..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/LibShared.lua +++ /dev/null @@ -1,195 +0,0 @@ -local defaultLib = {} - -local AddCallMetaTable = LuaUserData.AddCallMetaTable -local CreateStatic = LuaUserData.CreateStatic -local CreateEnum = LuaUserData.CreateEnumTable - -defaultLib["SByte"] = CreateStatic("Barotrauma.LuaSByte", true) -defaultLib["Byte"] = CreateStatic("Barotrauma.LuaByte", true) -defaultLib["Int16"] = CreateStatic("Barotrauma.LuaInt16", true) -defaultLib["UInt16"] = CreateStatic("Barotrauma.LuaUInt16", true) -defaultLib["Int32"] = CreateStatic("Barotrauma.LuaInt32", true) -defaultLib["UInt32"] = CreateStatic("Barotrauma.LuaUInt32", true) -defaultLib["Int64"] = CreateStatic("Barotrauma.LuaInt64", true) -defaultLib["UInt64"] = CreateStatic("Barotrauma.LuaUInt64", true) -defaultLib["Single"] = CreateStatic("Barotrauma.LuaSingle", true) -defaultLib["Double"] = CreateStatic("Barotrauma.LuaDouble", true) - --- Backward compatibility -defaultLib["Float"] = CreateStatic("Barotrauma.LuaSingle", true) -defaultLib["Short"] = CreateStatic("Barotrauma.LuaInt16", true) -defaultLib["UShort"] = CreateStatic("Barotrauma.LuaUInt16", true) - -defaultLib["SpawnType"] = CreateEnum("Barotrauma.SpawnType") -defaultLib["ChatMessageType"] = CreateEnum("Barotrauma.Networking.ChatMessageType") -defaultLib["ServerLog_MessageType"] = CreateEnum("Barotrauma.Networking.ServerLog+MessageType") -defaultLib["ServerLogMessageType"] = CreateEnum("Barotrauma.Networking.ServerLog+MessageType") -defaultLib["PositionType"] = CreateEnum("Barotrauma.Level+PositionType") -defaultLib["InvSlotType"] = CreateEnum("Barotrauma.InvSlotType") -defaultLib["LimbType"] = CreateEnum("Barotrauma.LimbType") -defaultLib["ActionType"] = CreateEnum("Barotrauma.ActionType") -defaultLib["AbilityEffectType"] = CreateEnum("Barotrauma.AbilityEffectType") -defaultLib["StatTypes"] = CreateEnum("Barotrauma.StatTypes") -defaultLib["AbilityFlags"] = CreateEnum("Barotrauma.AbilityFlags") -defaultLib["DeliveryMethod"] = CreateEnum("Barotrauma.Networking.DeliveryMethod") -defaultLib["ClientPacketHeader"] = CreateEnum("Barotrauma.Networking.ClientPacketHeader") -defaultLib["ServerPacketHeader"] = CreateEnum("Barotrauma.Networking.ServerPacketHeader") -defaultLib["RandSync"] = CreateEnum("Barotrauma.Rand+RandSync") -defaultLib["DisconnectReason"] = CreateEnum("Barotrauma.Networking.DisconnectReason") -defaultLib["CombatMode"] = CreateEnum("Barotrauma.AIObjectiveCombat+CombatMode") -defaultLib["CauseOfDeathType"] = CreateEnum("Barotrauma.CauseOfDeathType") -defaultLib["CharacterTeamType"] = CreateEnum("Barotrauma.CharacterTeamType") -defaultLib["ClientPermissions"] = CreateEnum("Barotrauma.Networking.ClientPermissions") -defaultLib["OrderCategory"] = CreateEnum("Barotrauma.OrderCategory") -defaultLib["WearableType"] = CreateEnum("Barotrauma.WearableType") -defaultLib["NumberType"] = CreateEnum("Barotrauma.NumberType") -defaultLib["ChatMode"] = CreateEnum("Barotrauma.ChatMode") -defaultLib["CharacterType"] = CreateEnum("Barotrauma.CharacterType") -defaultLib["VoteType"] = CreateEnum("Barotrauma.Networking.VoteType") -defaultLib["CanEnterSubmarine"] = CreateEnum("Barotrauma.CanEnterSubmarine") -defaultLib["InputType"] = CreateStatic("Barotrauma.InputType") - -defaultLib["EventPrefab"] = CreateStatic("Barotrauma.EventPrefab", true) -defaultLib["TraitorEventPrefab"] = CreateStatic("Barotrauma.TraitorEventPrefab", true) -defaultLib["TraitorEvent"] = CreateStatic("Barotrauma.TraitorEvent", true) -defaultLib["EventSet"] = CreateStatic("Barotrauma.EventSet", true) -defaultLib["EventManagerSettings"] = CreateStatic("Barotrauma.EventManagerSettings", true) - -defaultLib["NetConfig"] = CreateStatic("Barotrauma.Networking.NetConfig") -defaultLib["NetworkConnection"] = CreateStatic("Barotrauma.Networking.NetworkConnection") -defaultLib["Inventory"] = CreateStatic("Barotrauma.Inventory", true) -defaultLib["CharacterInventory"] = CreateStatic("Barotrauma.CharacterInventory", true) -defaultLib["ItemInventory"] = CreateStatic("Barotrauma.ItemInventory", true) -defaultLib["ContentPackageManager"] = CreateStatic("Barotrauma.ContentPackageManager") -defaultLib["GameSettings"] = CreateStatic("Barotrauma.GameSettings") -defaultLib["RichString"] = CreateStatic("Barotrauma.RichString", true) -defaultLib["Identifier"] = CreateStatic("Barotrauma.Identifier", true) -defaultLib["LanguageIdentifier"] = CreateStatic("Barotrauma.LanguageIdentifier", true) -defaultLib["ContentPackage"] = CreateStatic("Barotrauma.ContentPackage", true) -defaultLib["WayPoint"] = CreateStatic("Barotrauma.WayPoint", true) -defaultLib["Submarine"] = CreateStatic("Barotrauma.Submarine", true) -defaultLib["Client"] = CreateStatic("Barotrauma.Networking.Client", true) -defaultLib["Character"] = CreateStatic("Barotrauma.Character") -defaultLib["CharacterHealth"] = CreateStatic("Barotrauma.CharacterHealth", true) -defaultLib["CharacterPrefab"] = CreateStatic("Barotrauma.CharacterPrefab", true) -defaultLib["CharacterInfo"] = CreateStatic("Barotrauma.CharacterInfo", true) -AddCallMetaTable(defaultLib["CharacterInfo"].HeadPreset) -AddCallMetaTable(defaultLib["CharacterInfo"].HeadInfo) -defaultLib["CharacterInfoPrefab"] = CreateStatic("Barotrauma.CharacterInfoPrefab") -defaultLib["Item"] = CreateStatic("Barotrauma.Item", true) -AddCallMetaTable(defaultLib["Item"].ChangePropertyEventData) -defaultLib["MapEntityPrefab"] = CreateStatic("Barotrauma.MapEntityPrefab") -defaultLib["ItemPrefab"] = CreateStatic("Barotrauma.ItemPrefab", true) -defaultLib["TalentTree"] = CreateStatic("Barotrauma.TalentTree", true) -defaultLib["TalentPrefab"] = CreateStatic("Barotrauma.TalentPrefab", true) -defaultLib["FactionPrefab"] = CreateStatic("Barotrauma.FactionPrefab", true) -defaultLib["MissionPrefab"] = CreateStatic("Barotrauma.MissionPrefab", true) -defaultLib["Mission"] = CreateStatic("Barotrauma.Mission", true) -defaultLib["Level"] = CreateStatic("Barotrauma.Level") -defaultLib["LevelGenerationParams"] = CreateStatic("Barotrauma.LevelGenerationParams", true) -defaultLib["OutpostGenerationParams"] = CreateStatic("Barotrauma.OutpostGenerationParams", true) -defaultLib["RuinGenerationParams"] = CreateStatic("Barotrauma.RuinGeneration.RuinGenerationParams", true) -defaultLib["Job"] = CreateStatic("Barotrauma.Job", true) -defaultLib["JobPrefab"] = CreateStatic("Barotrauma.JobPrefab", true) -defaultLib["JobVariant"] = CreateStatic("Barotrauma.JobVariant", true) -defaultLib["AfflictionPrefab"] = CreateStatic("Barotrauma.AfflictionPrefab", true) -defaultLib["SkillSettings"] = CreateStatic("Barotrauma.SkillSettings", true) -defaultLib["ChatMessage"] = CreateStatic("Barotrauma.Networking.ChatMessage") -defaultLib["Structure"] = CreateStatic("Barotrauma.Structure", true) -defaultLib["Hull"] = CreateStatic("Barotrauma.Hull", true) -defaultLib["Gap"] = CreateStatic("Barotrauma.Gap", true) -defaultLib["Signal"] = CreateStatic("Barotrauma.Items.Components.Signal", true) -defaultLib["SubmarineInfo"] = CreateStatic("Barotrauma.SubmarineInfo", true) -defaultLib["Entity"] = CreateStatic("Barotrauma.Entity", true) -defaultLib["MapEntity"] = CreateStatic("Barotrauma.MapEntity", true) -defaultLib["Physics"] = CreateStatic("Barotrauma.Physics") -defaultLib["FireSource"] = CreateStatic("Barotrauma.FireSource", true) -defaultLib["TextManager"] = CreateStatic("Barotrauma.TextManager") -defaultLib["NetEntityEvent"] = CreateStatic("Barotrauma.Networking.NetEntityEvent") -defaultLib["Screen"] = CreateStatic("Barotrauma.Screen") -defaultLib["AttackResult"] = CreateStatic("Barotrauma.AttackResult", true) -defaultLib["TempClient"] = CreateStatic("Barotrauma.Networking.TempClient", true) -defaultLib["DecalManager"] = CreateStatic("Barotrauma.DecalManager", true) -defaultLib["AutoItemPlacer"] = CreateStatic("Barotrauma.AutoItemPlacer") -defaultLib["PropertyConditional"] = CreateStatic("Barotrauma.PropertyConditional", true) -defaultLib["StatusEffect"] = CreateStatic("Barotrauma.StatusEffect", true) -defaultLib["OutpostGenerator"] = CreateStatic("Barotrauma.OutpostGenerator") -defaultLib["DamageModifier"] = CreateStatic("Barotrauma.DamageModifier", true) -defaultLib["TraitorManager"] = CreateStatic("Barotrauma.TraitorManager", true) -AddCallMetaTable(defaultLib["TraitorManager"].TraitorResults) - -defaultLib["Md5Hash"] = CreateStatic("Barotrauma.Md5Hash", true) -defaultLib["ContentXElement"] = CreateStatic("Barotrauma.ContentXElement", true) -defaultLib["ContentPath"] = CreateStatic("Barotrauma.ContentPath", true) -defaultLib["XElement"] = CreateStatic("System.Xml.Linq.XElement", true) -defaultLib["XName"] = CreateStatic("System.Xml.Linq.XName", true) -defaultLib["XAttribute"] = CreateStatic("System.Xml.Linq.XAttribute", true) -defaultLib["XContainer"] = CreateStatic("System.Xml.Linq.XContainer", true) -defaultLib["XDocument"] = CreateStatic("System.Xml.Linq.XDocument", true) -defaultLib["XNode"] = CreateStatic("System.Xml.Linq.XNode", true) -defaultLib["SoundsFile"] = CreateStatic("Barotrauma.SoundsFile", true) - -defaultLib["Voting"] = CreateStatic("Barotrauma.Voting") -defaultLib["TimeSpan"] = CreateStatic("System.TimeSpan") -defaultLib["IPAddress"] = CreateStatic("System.Net.IPAddress") -defaultLib["ContentPackageId"] = CreateStatic("Barotrauma.ContentPackageId") -defaultLib["Address"] = CreateStatic("Barotrauma.Networking.Address") -defaultLib["AccountId"] = CreateStatic("Barotrauma.Networking.AccountId") -defaultLib["Endpoint"] = CreateStatic("Barotrauma.Networking.Endpoint") - -defaultLib["Explosion"] = CreateStatic("Barotrauma.Explosion", true) - -defaultLib["ConvertUnits"] = CreateStatic("FarseerPhysics.ConvertUnits") -defaultLib["ToolBox"] = CreateStatic("Barotrauma.ToolBox") - -defaultLib["AIObjective"] = CreateStatic("Barotrauma.AIObjective", true) -defaultLib["AIObjectiveChargeBatteries"] = CreateStatic("Barotrauma.AIObjectiveChargeBatteries", true) -defaultLib["AIObjectiveCleanupItem"] = CreateStatic("Barotrauma.AIObjectiveCleanupItem", true) -defaultLib["AIObjectiveCleanupItems"] = CreateStatic("Barotrauma.AIObjectiveCleanupItems", true) -defaultLib["AIObjectiveCombat"] = CreateStatic("Barotrauma.AIObjectiveCombat", true) -defaultLib["AIObjectiveContainItem"] = CreateStatic("Barotrauma.AIObjectiveContainItem", true) -defaultLib["AIObjectiveDeconstructItem"] = CreateStatic("Barotrauma.AIObjectiveDeconstructItem", true) -defaultLib["AIObjectiveDeconstructItems"] = CreateStatic("Barotrauma.AIObjectiveDeconstructItems", true) -defaultLib["AIObjectiveEscapeHandcuffs"] = CreateStatic("Barotrauma.AIObjectiveEscapeHandcuffs", true) -defaultLib["AIObjectiveExtinguishFire"] = CreateStatic("Barotrauma.AIObjectiveExtinguishFire", true) -defaultLib["AIObjectiveExtinguishFires"] = CreateStatic("Barotrauma.AIObjectiveExtinguishFires", true) -defaultLib["AIObjectiveFightIntruders"] = CreateStatic("Barotrauma.AIObjectiveFightIntruders", true) -defaultLib["AIObjectiveFindDivingGear"] = CreateStatic("Barotrauma.AIObjectiveFindDivingGear", true) -defaultLib["AIObjectiveFindSafety"] = CreateStatic("Barotrauma.AIObjectiveFindSafety", true) -defaultLib["AIObjectiveFixLeak"] = CreateStatic("Barotrauma.AIObjectiveFixLeak", true) -defaultLib["AIObjectiveFixLeaks"] = CreateStatic("Barotrauma.AIObjectiveFixLeaks", true) -defaultLib["AIObjectiveGetItem"] = CreateStatic("Barotrauma.AIObjectiveGetItem", true) -defaultLib["AIObjectiveGoTo"] = CreateStatic("Barotrauma.AIObjectiveGoTo", true) -defaultLib["AIObjectiveIdle"] = CreateStatic("Barotrauma.AIObjectiveIdle", true) -defaultLib["AIObjectiveOperateItem"] = CreateStatic("Barotrauma.AIObjectiveOperateItem", true) -defaultLib["AIObjectiveOperateItem"] = CreateStatic("Barotrauma.AIObjectiveOperateItem", true) -defaultLib["AIObjectivePumpWater"] = CreateStatic("Barotrauma.AIObjectivePumpWater", true) -defaultLib["AIObjectiveRepairItem"] = CreateStatic("Barotrauma.AIObjectiveRepairItem", true) -defaultLib["AIObjectiveRepairItems"] = CreateStatic("Barotrauma.AIObjectiveRepairItems", true) -defaultLib["AIObjectiveRescue"] = CreateStatic("Barotrauma.AIObjectiveRescue", true) -defaultLib["AIObjectiveRescueAll"] = CreateStatic("Barotrauma.AIObjectiveRescueAll", true) -defaultLib["AIObjectiveReturn"] = CreateStatic("Barotrauma.AIObjectiveReturn", true) -defaultLib["AITarget"] = CreateStatic("Barotrauma.AITarget", true) - -defaultLib["Order"] = CreateStatic("Barotrauma.Order", true) -defaultLib["OrderPrefab"] = CreateStatic("Barotrauma.OrderPrefab", true) -defaultLib["OrderTarget"] = CreateStatic("Barotrauma.OrderTarget", true) - -local componentsToReference = { "DockingPort", "Door", "GeneticMaterial", "Growable", "Holdable", "LevelResource", "ItemComponent", "ItemLabel", "LightComponent", "Controller", "Deconstructor", "Engine", "Fabricator", "OutpostTerminal", "Pump", "Reactor", "Steering", "PowerContainer", "Projectile", "Repairable", "Rope", "Scanner", "ButtonTerminal", "ConnectionPanel", "CustomInterface", "MemoryComponent", "Terminal", "WifiComponent", "Wire", "TriggerComponent", "ElectricalDischarger", "EntitySpawnerComponent", "ProducedItem", "VineTile", "GrowthSideExtension", "IdCard", "MeleeWeapon", "Pickable", "Propulsion", "RangedWeapon", "RepairTool", "Sprayer", "Throwable", "ItemContainer", "Ladder", "LimbPos", "MiniMap", "OxygenGenerator", "Sonar", "SonarTransducer", "Vent", "NameTag", "Planter", "Powered", "PowerTransfer", "Quality", "RemoteController", "AdderComponent", "AndComponent", "ArithmeticComponent", "ColorComponent", "ConcatComponent", "Connection", "DelayComponent", "DivideComponent", "EqualsComponent", "ExponentiationComponent", "FunctionComponent", "GreaterComponent", "ModuloComponent", "MotionSensor", "MultiplyComponent", "NotComponent", "OrComponent", "OscillatorComponent", "OxygenDetector", "RegExFindComponent", "RelayComponent", "SignalCheckComponent", "SmokeDetector", "StringComponent", "SubtractComponent", "TrigonometricFunctionComponent", "WaterDetector", "XorComponent", "StatusHUD", "Turret", "Wearable", "CustomInterface" -} - -defaultLib["Components"] = {} - -for key, value in pairs(componentsToReference) do - defaultLib["Components"][value] = CreateStatic("Barotrauma.Items.Components." .. value, true) -end - -defaultLib["Vector2"] = CreateStatic("Microsoft.Xna.Framework.Vector2", true) -defaultLib["Vector3"] = CreateStatic("Microsoft.Xna.Framework.Vector3", true) -defaultLib["Vector4"] = CreateStatic("Microsoft.Xna.Framework.Vector4", true) -defaultLib["Color"] = CreateStatic("Microsoft.Xna.Framework.Color", true) -defaultLib["Point"] = CreateStatic("Microsoft.Xna.Framework.Point", true) -defaultLib["Rectangle"] = CreateStatic("Microsoft.Xna.Framework.Rectangle", true) -defaultLib["Matrix"] = CreateStatic("Microsoft.Xna.Framework.Matrix", true) - -return defaultLib diff --git a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/Math.lua b/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/Math.lua deleted file mode 100644 index 84698a5..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/Math.lua +++ /dev/null @@ -1,40 +0,0 @@ -math.lerp = function (a, b, t) - if type(a) ~= "number" then error(string.format("bad argument #1 to 'lerp' (number expected, got %s)", type(a)), 2) end - if type(b) ~= "number" then error(string.format("bad argument #2 to 'lerp' (number expected, got %s)", type(b)), 2) end - if type(t) ~= "number" then error(string.format("bad argument #3 to 'lerp' (number expected, got %s)", type(t)), 2) end - - return a * (1 - t) + b * t -end - -math.clamp = function (value, min, max) - if type(value) ~= "number" then error(string.format("bad argument #1 to 'clamp' (number expected, got %s)", type(value)), 2) end - if type(min) ~= "number" then error(string.format("bad argument #2 to 'clamp' (number expected, got %s)", type(min)), 2) end - if type(max) ~= "number" then error(string.format("bad argument #3 to 'clamp' (number expected, got %s)", type(max)), 2) end - - return math.max(min, math.min(max, value)) -end - -math.round = function (value, decimals) - if type(value) ~= "number" then error(string.format("bad argument #1 to 'round' (number expected, got %s)", type(value)), 2) end - if type(decimals) ~= "number" then error(string.format("bad argument #2 to 'round' (number expected, got %s)", type(decimals)), 2) end - - decimals = decimals or 0 - local mult = 10 ^ decimals - return math.floor(value * mult + 0.5) / mult -end - -math.sign = function (value) - if type(value) ~= "number" then error(string.format("bad argument #1 to 'sign' (number expected, got %s)", type(value)), 2) end - - return value >= 0 and 1 or -1 -end - -math.remap = function (value, inMin, inMax, outMin, outMax) - if type(value) ~= "number" then error(string.format("bad argument #1 to 'remap' (number expected, got %s)", type(value)), 2) end - if type(inMin) ~= "number" then error(string.format("bad argument #2 to 'remap' (number expected, got %s)", type(inMin)), 2) end - if type(inMax) ~= "number" then error(string.format("bad argument #3 to 'remap' (number expected, got %s)", type(inMax)), 2) end - if type(outMin) ~= "number" then error(string.format("bad argument #4 to 'remap' (number expected, got %s)", type(outMin)), 2) end - if type(outMax) ~= "number" then error(string.format("bad argument #5 to 'remap' (number expected, got %s)", type(outMax)), 2) end - - return outMin + (outMax - outMin) * ((value - inMin) / (inMax - inMin)) -end \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/SteamApi.lua b/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/SteamApi.lua deleted file mode 100644 index 564d39b..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/SteamApi.lua +++ /dev/null @@ -1,28 +0,0 @@ -if true then return end - -local descriptor = LuaUserData.RegisterType("Barotrauma.LuaCsSteam") - -LuaUserData.AddMethod(descriptor, "GetWorkshopCollection", function (id, callback) - id = tostring(id) - - Networking.RequestPostHTTP("https://api.steampowered.com/ISteamRemoteStorage/GetCollectionDetails/v1/", function (result) - local data = json.parse(result) - - if data.response.collectiondetails[1].children == nil then - callback() - return - end - - local workshopItems = {} - - for key, value in pairs(data.response.collectiondetails[1].children) do - table.insert(workshopItems, value.publishedfileid) - end - - if callback then - callback(workshopItems) - end - end, - "collectioncount=1&publishedfileids[0]=" .. id, - "application/x-www-form-urlencoded") -end) \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/String.lua b/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/String.lua deleted file mode 100644 index 3a79448..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/String.lua +++ /dev/null @@ -1,13 +0,0 @@ -string.startsWith = function(str, start) - if type(str) ~= "string" then error(string.format("bad argument #1 to 'startsWith' (string expected, got %s)", type(str)), 2) end - if type(start) ~= "string" then error(string.format("bad argument #2 to 'startsWith' (string expected, got %s)", type(start)), 2) end - - return string.sub(str, 1, string.len(start)) == start -end - -string.endsWith = function(str, ending) - if type(str) ~= "string" then error(string.format("bad argument #1 to 'endsWith' (string expected, got %s)", type(str)), 2) end - if type(ending) ~= "string" then error(string.format("bad argument #2 to 'endsWith' (string expected, got %s)", type(ending)), 2) end - - return ending == "" or string.sub(str, -string.len(ending)) == ending -end \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/Util.lua b/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/Util.lua deleted file mode 100644 index d4372ef..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/DefaultLib/Utils/Util.lua +++ /dev/null @@ -1,86 +0,0 @@ -Util = {} - -local itemDictionary = {} -local itemGroups = {} - -local function AddItem(item) - for _, itemGroup in pairs(itemGroups) do - if itemGroup.func(item) then - table.insert(itemGroup.items, item) - end - end - - local id = item.Prefab.Identifier.Value - if itemDictionary[id] == nil then - itemDictionary[id] = {} - end - - table.insert(itemDictionary[id], item) -end - -Hook.Add("item.created", "luaSetup.util.itemDictionary", function (item) - AddItem(item) -end) - -Hook.Add("roundEnd", "luaSetup.util.itemDictionary", function (item) - itemDictionary = {} - for _, itemGroup in pairs(itemGroups) do - itemGroup.items = {} - end -end) - -for _, item in pairs(Item.ItemList) do - AddItem(item) -end - -Util.RegisterItemGroup = function(groupName, func) - if type(groupName) ~= "string" then - error(string.format("bad argument #1 to 'RegisterItemGroup' (string expected, got %s)", type(groupName)), 2) - end - - if type(func) ~= "function" then - error(string.format("bad argument #2 to 'RegisterItemGroup' (function expected, got %s)", type(func)), 2) - end - - local items = {} - for _, item in pairs(Item.ItemList) do - if func(item) then - table.insert(items, item) - end - end - - itemGroups[groupName] = { - func = func, - items = items - } -end - -Util.GetItemGroup = function(groupName) - if type(groupName) ~= "string" then - error(string.format("bad argument #1 to 'GetItemGroup' (string expected, got %s)", type(groupName)), 2) - end - - if not itemGroups[groupName] then - error("bad argument #1 to 'GetItemGroup' couldn't find the specified groupName", 2) - end - - return itemGroups[groupName].items or {} -end - -Util.GetItemsById = function(id) - if id == nil then - error(string.format("bad argument #1 to 'GetItemsById' (string expected, got %s)", type(id)), 2) - end - - return itemDictionary[id] -end - -Util.FindClientCharacter = function(character) - if CLIENT and Game.IsSingleplayer then return nil end - - for _, client in pairs(Client.ClientList) do - if client.Character == character then - return client - end - end -end \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Lua/LuaSetup.lua b/LocalMods/LuaCsForBarotrauma/Lua/LuaSetup.lua deleted file mode 100644 index 08e1391..0000000 --- a/LocalMods/LuaCsForBarotrauma/Lua/LuaSetup.lua +++ /dev/null @@ -1,38 +0,0 @@ -LuaSetup = {} - -local path = ... - -local function AddTableToGlobal(tbl) - for k, v in pairs(tbl) do - _G[k] = v - end -end - -if SERVER then - AddTableToGlobal(dofile(path .. "/Lua/DefaultLib/LibServer.lua")) -else - AddTableToGlobal(dofile(path .. "/Lua/DefaultLib/LibClient.lua")) -end - -AddTableToGlobal(dofile(path .. "/Lua/DefaultLib/LibShared.lua")) - -AddTableToGlobal(dofile(path .. "/Lua/CompatibilityLib.lua")) - -dofile(path .. "/Lua/DefaultHook.lua") - -Descriptors = LuaUserData - -dofile(path .. "/Lua/DefaultLib/Utils/Math.lua") -dofile(path .. "/Lua/DefaultLib/Utils/String.lua") -dofile(path .. "/Lua/DefaultLib/Utils/Util.lua") -dofile(path .. "/Lua/DefaultLib/Utils/SteamApi.lua") - -if not CSActive then - for k, v in pairs(debug) do - if k ~= "getmetatable" and k ~= "setmetatable" and k ~= "traceback" then - debug[k] = nil - end - end -end - -LuaSetup = nil \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/ModConfig.xml b/LocalMods/LuaCsForBarotrauma/ModConfig.xml deleted file mode 100644 index 25afd73..0000000 --- a/LocalMods/LuaCsForBarotrauma/ModConfig.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/LocalMods/LuaCsForBarotrauma/Publicized/BarotraumaCore.dll b/LocalMods/LuaCsForBarotrauma/Publicized/BarotraumaCore.dll deleted file mode 100644 index 7640126..0000000 Binary files a/LocalMods/LuaCsForBarotrauma/Publicized/BarotraumaCore.dll and /dev/null differ diff --git a/LocalMods/LuaCsForBarotrauma/Publicized/DedicatedServer.dll b/LocalMods/LuaCsForBarotrauma/Publicized/DedicatedServer.dll deleted file mode 100644 index db618e8..0000000 Binary files a/LocalMods/LuaCsForBarotrauma/Publicized/DedicatedServer.dll and /dev/null differ diff --git a/LocalMods/LuaCsForBarotrauma/Style.xml b/LocalMods/LuaCsForBarotrauma/Style.xml deleted file mode 100644 index a364a50..0000000 --- a/LocalMods/LuaCsForBarotrauma/Style.xml +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/LocalMods/LuaCsForBarotrauma/Texts/English.xml b/LocalMods/LuaCsForBarotrauma/Texts/English.xml deleted file mode 100644 index 2108b69..0000000 --- a/LocalMods/LuaCsForBarotrauma/Texts/English.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - Mod Controls Settings - Mod Gameplay Settings - Reset Displayed Settings - Reset Visible Settings - Are you sure you want to reset the values for currently displayed settings? - Yes - No - - - Are C# Mods Allowed - Should unsandboxed scripts and dlls be allowed to run. - General - - Use Pre-Caching - Should mod files be preloaded to speed up loading. Should only be turned off if you have mods that have issues with this. - General - - Hide Local OS Account Name In Logs - If true, will replace your OS account name with 'USERNAME' in log files' paths. - General - diff --git a/LocalMods/LuaCsForBarotrauma/Texts/Portuguese.xml b/LocalMods/LuaCsForBarotrauma/Texts/Portuguese.xml deleted file mode 100644 index 4b149c0..0000000 --- a/LocalMods/LuaCsForBarotrauma/Texts/Portuguese.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/LocalMods/LuaCsForBarotrauma/filelist.xml b/LocalMods/LuaCsForBarotrauma/filelist.xml deleted file mode 100644 index 679f8d4..0000000 --- a/LocalMods/LuaCsForBarotrauma/filelist.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/LocalMods/info.txt b/LocalMods/info.txt deleted file mode 100644 index cf60013..0000000 --- a/LocalMods/info.txt +++ /dev/null @@ -1,6 +0,0 @@ - -This folder is the place where your own mods go. -Mods installed via the Workshop go elsewhere; if -you've published a mod and you don't have a copy -in this folder, go into the Publish tab and the -game should be able to create a copy for you. diff --git a/prepare_local b/prepare_local new file mode 100755 index 0000000..a7e08fa --- /dev/null +++ b/prepare_local @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 +"""Copy workshop mods from ACTUAL_SERVER.xml into LocalMods/ with readable names.""" + +import shutil +import sys +import os +import xml.etree.ElementTree as ET + +WORKSHOP_DIR = "/mnt/nvme/B/SteamLibrary/steamapps/workshop/content/602960" +MODLIST_PATH = "/mnt/nvme/B/SteamLibrary/steamapps/common/Barotrauma/ModLists/ACTUAL_SERVER.xml" +LOCALMODS_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LocalMods") + + +def log_ok(msg: str, indent: int = 0): + prefix = " " * indent + "✓" + print(f"\033[92m{prefix}\033[0m {msg}") + + +def log_info(msg: str, indent: int = 0): + prefix = " " * indent + "•" + print(f"{prefix} {msg}") + + +def log_warn(msg: str, indent: int = 0): + prefix = " " * indent + "⚠" + print(f"\033[93m{prefix}\033[0m {msg}") + + +def log_err(msg: str, indent: int = 0): + prefix = " " * indent + "✗" + print(f"\033[91m{prefix}\033[0m {msg}", file=sys.stderr) + + +def sanitize_folder_name(name: str) -> str: + forbidden = '/\\:*?"<>|' + for ch in forbidden: + name = name.replace(ch, "_") + return name.strip() + + +def get_mod_name_from_filelist(folder_path: str) -> str | None: + fl_path = os.path.join(folder_path, "filelist.xml") + if not os.path.isfile(fl_path): + return None + try: + root = ET.parse(fl_path).getroot() + return root.get("name") + except Exception as e: + log_warn(f"Failed to parse filelist.xml: {e}", indent=2) + return None + + +def copy_mod(src: str, dst: str) -> bool: + if os.path.exists(dst): + log_info(f"Removing existing folder: {dst}", indent=2) + shutil.rmtree(dst) + log_info(f"Copying: {src} → {dst}", indent=2) + shutil.copytree(src, dst, symlinks=True) + return True + + +def main(): + print() + print("╔══════════════════════════════════════════╗") + print("║ Prepare Local Mods from ACTUAL_SERVER ║") + print("╚══════════════════════════════════════════╝") + print() + + if not os.path.isfile(MODLIST_PATH): + log_err(f"Mod list not found: {MODLIST_PATH}") + sys.exit(1) + + log_info(f"Reading mod list: {MODLIST_PATH}") + try: + tree = ET.parse(MODLIST_PATH) + root = tree.getroot() + except Exception as e: + log_err(f"Failed to parse mod list: {e}") + sys.exit(1) + + mods = root.findall("Workshop") + if not mods: + log_warn("No entries found in mod list") + sys.exit(0) + + log_info(f"Found {len(mods)} workshop mod(s)") + print() + + copied = 0 + skipped = 0 + errors = 0 + + for mod in mods: + mod_id = mod.get("id", "").strip() + mod_name = mod.get("name", "").strip() + + if not mod_id: + log_warn(f"Skipping entry with no id: name='{mod_name}'", indent=1) + skipped += 1 + continue + + print(f"[{mod_id}] {mod_name}") + log_info(f"Processing mod: {mod_name}", indent=1) + + src_dir = os.path.join(WORKSHOP_DIR, mod_id) + if not os.path.isdir(src_dir): + log_err(f"Workshop folder not found: {src_dir}", indent=2) + errors += 1 + continue + + display_name = get_mod_name_from_filelist(src_dir) + if not display_name: + log_warn("No name found in filelist.xml, using Steam name", indent=2) + display_name = mod_name + + safe_name = sanitize_folder_name(display_name) + if not safe_name: + log_warn("Sanitized name is empty, using mod ID as fallback", indent=2) + safe_name = mod_id + + dst_dir = os.path.join(LOCALMODS_DIR, safe_name) + + try: + copy_mod(src_dir, dst_dir) + log_ok(f"Copied as: {safe_name}", indent=2) + copied += 1 + except Exception as e: + log_err(f"Copy failed: {e}", indent=2) + errors += 1 + + print() + + print("─" * 50) + log_ok(f"Copied: {copied}") + log_info(f"Skipped: {skipped}") + if errors: + log_err(f"Errors: {errors}") + + local_mods = root.findall("Local") + if local_mods: + print() + log_info(f"Checking {len(local_mods)} local mod reference(s)…") + for lm in local_mods: + lm_name = lm.get("name", "").strip() + if not lm_name: + continue + lm_path = os.path.join(LOCALMODS_DIR, sanitize_folder_name(lm_name)) + if os.path.isdir(lm_path): + log_ok(f"Local mod present: {lm_name}", indent=1) + else: + log_warn(f"Local mod NOT found: {lm_name}", indent=1) + print() + + if not errors and skipped == 0: + print() + log_ok("All mods prepared successfully!") + print() + + +if __name__ == "__main__": + main()