diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e69de29 diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 7bc9707..6853b46 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,40 +1,25 @@ -name: Build & Deploy +name: Restart server on: push: branches: - - main - release jobs: - build: + restart: runs-on: [ ubuntu-22.04 ] steps: - uses: actions/checkout@v4 - - name: Build Docker image - run: docker build -t barotrauma-server:${{ github.sha }} . - - - name: Tag and push to local registry - if: github.ref_name == 'release' + - name: Setup SSH run: | - docker tag barotrauma-server:${{ github.sha }} \ - ${{ secrets.REGISTRY_ADDR }}/barotrauma-server:latest - docker push ${{ secrets.REGISTRY_ADDR }}/barotrauma-server:latest + mkdir -p ~/.ssh + echo "${{ secrets.SSH_KEY }}" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts 2>/dev/null - - name: Deploy via SSH - if: github.ref_name == 'release' - uses: appleboy/ssh-action@v1 - with: - host: ${{ secrets.SERVER_HOST }} - username: ${{ secrets.SERVER_USER }} - key: ${{ secrets.SSH_KEY }} - script: | - docker pull ${{ secrets.REGISTRY_ADDR }}/barotrauma-server:latest - docker stop barotrauma 2>/dev/null || true - docker rm barotrauma 2>/dev/null || true - docker run -d --name barotrauma \ - --restart unless-stopped \ - -p 27015:27015/udp \ - -p 27015:27015/tcp \ - ${{ secrets.REGISTRY_ADDR }}/barotrauma-server:latest - docker system prune -f + - name: Restart server + run: | + ssh -i ~/.ssh/deploy_key \ + ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} \ + "systemctl restart barotrauma 2>/dev/null || \ + (killall DedicatedServer 2>/dev/null; sleep 2; cd /opt/barotrauma && nohup ./DedicatedServer >/dev/null 2>&1 &)" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c3a5d6c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +LocalMods/ +LocalMods.tar.gz diff --git a/Data/campaignsettings.xml b/Data/campaignsettings.xml index f6424d1..243c4fd 100644 --- a/Data/campaignsettings.xml +++ b/Data/campaignsettings.xml @@ -3,7 +3,7 @@ - + diff --git a/Data/forbiddenwordlist.txt b/Data/forbiddenwordlist.txt index 81cbd5d..e69de29 100644 --- a/Data/forbiddenwordlist.txt +++ b/Data/forbiddenwordlist.txt @@ -1,427 +0,0 @@ -4r5e -5h1t -5hit -Dumbcunt -a$$ -a$$hole -a2m -a54 -a55 -a55hole -a_s_s -adolf -ahole - anal -anus -anuses -arrse -arse - ass -asses -asshat -asshole -assshole -b!tch -b17ch -b1tch -ballsack -beatch -bitch -bitchass -bitched -bitcher -bitchers -bitches -bitches -bitching -bitchy -blowjob -blowjobs -bulldyke -bullshit -bullshits -bullshitted -bullturds -bung -bunghole -buttfucker -butthole -buttmuch -buttmunch -c-0-c-k -c.0.c.k -c.o.c.k. -c.u.n.t -c0ck -carpetmuncher - chinc -chincs -chink -chinky -clitoris - cock -cock sucker -cock-sucker -cocks -cocksucker -cocksuckers -cocksucking -cocksucks -coochie -coochy - coon -coonnass - coons -cracker -crackwhore -crap -cumbubble -cumdump -cumdump -cumdumpster -cumguzzler -cumjockey -cummer -cummin -cumming - cums -cumshot -cumshots -cumslut -cumstain -cumtart -cunilingus -cunillingus -cunnie -cunnilingus - cunny -cunt -cuntass -cuntbag -cuntbag -cuntface -cunthole -cunthunter -cuntlick -cuntlick -cuntlicker -cuntlicker -cuntlicking -cuntlicking -cuntrag -cunts -cunts -cuntsicle -cuntsicle -cuntslut -d0uch3 -d0uche -d1ck -d1ld0 -d1ldo -deepthroat -dick -dick-ish -dick-sneeze -dickbag -dickbeaters -dickdipper -dickface -dickflipper -dickfuck -dickfucker -dickhead -dickheads -dickhole -dickish -dickjuice -dickmilk -dickmonger -dickripper -dicks -dicks -dicksipper -dickslap -dicksucker -dicksucking -dicktickler -dickwad -dickweasel -dickweed -dickwhipper -dickwod -dickzipper -diddle -dike -dildo -dildos -douche -douchebag -dumbass -dumbasses -dumbfuck -dumbshit -dyke -dykes -ejaculate -ejaculated -ejaculates -ejaculates -ejaculating -ejaculating -ejaculatings -ejaculation -ejakulate -erect -f u c k -f u c k e r -f.u.c.k -f4nny -f_u_c_k - fag -fagbag -fagfucker -fagg -fagged -fagging -faggit -faggitt -faggot -faggot* -faggotcock -faggots -faggots -faggs -fagot -fagots - fags -fagtard -fatass -fcuk -fcuker -fcuking -feck -fecker -fistfuck -fistfucked -fistfucked -fistfucker -fistfucker -fistfuckers -fistfuckers -fistfucking -fistfucking -fistfuckings -fistfuckings -fistfucks -fistfucks -fuck -fuck-ass -fuck ass -fuck-bitch -fuck bitch -fucktard -fuck tard -fucka -fuckass -fuckbag -fuckboy -fuckbrain -fuckbutt -fuckbutter -fucked -fuckedup -fucker -fuckers -fuckersucker -fuckface -fuckhead -fuckheads -fuckhole -fuckin -fucking -fuckings -fuckingshitmotherfucker -fuckme -fuckme -fuckmeat -fucknugget -fucknut -fucknutt -fuckoff -fucks -fuckstick -fucktard -fucktards -fucktart -fucktoy -fucktoy -fucktwat -fuckup -fuckwad -fuckwhit -fuckwit -fuckwitt -gay -gayass -gaybob -gaydo -gayfuck -gayfuckist -gaylord -gays -god-dam -god-damned -godamn -godamnit -goddam -goddammit -goddamn -goddamned -goddamnit -godsdamn -hitler -homo -homodumbshit -homoerotic -homoey -homos -honkey -honky -jack-off -jackass -jackass -jackasses -jackasses -jackhole -jackhole -jackoff -jackoff -jaggi -jagoff -jailbait -jailbait - jap -japs - jerk -jerk-off -jerkoff -jerk off -jerk0ff -jerkass -jerked -jerkoff -jew -jews -jism -jiz -jiz -jizm -jizm -jizz -jizzed -kike -kikes -knob - kum -kummer -kumming -kums -lesbian -lesbians -lesbo -lesbos -lez -lezzie -master-bate -master-bate -masterbat* -masterbat3 -masterbate -masterbating -masterbation -masterbations -masturbate -masturbating -masturbation -mothafuck -mothafucka -mothafuckas -mothafuckaz -mothafucked -mothafucked -mothafucker -mothafuckers -mothafuckin -mothafucking -mothafuckings -mothafucks -motherfuck -motherfucka -motherfucked -motherfucker -motherfucker -motherfuckers -motherfuckin -motherfucking -motherfuckings -motherfuckka -motherfucks -mudslime* -mudslimes* -nazi -nazis - nig -nig-nog -nigg3r -nigg4h -nigga -nigga -niggah -niggas -niggas -niggaz -nigger -nigger -niggers -niggle -niglet -negroid -negroids -penis -pigfucker - piss -piss-off -pissed -pisser -pissers -pisses -pisses -pissflaps -pissin -pissin -pissing -pissoff -pissoff -pussies -pussy -queaf -queaf -queef -queer -queers - rape -raped -raper -rapey -raping -rapist -slut -sluts -twat -twats -vagina -vaginas -white power -whore -whores \ No newline at end of file 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/config_player.xml b/config_player.xml index 684e113..068d88e 100644 --- a/config_player.xml +++ b/config_player.xml @@ -3,7 +3,51 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/prep b/prep new file mode 100755 index 0000000..6bfcea1 --- /dev/null +++ b/prep @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Prepare local mods, rsync to server, generate config, and commit.""" + +import os +import subprocess +import sys + +BASE = os.path.dirname(os.path.abspath(__file__)) +PREPARE_LOCAL = os.path.join(BASE, "prepare_local") +AUTOGEN = os.path.join(BASE, "scripts", "autogen_config.py") +LOCALMODS_DIR = os.path.join(BASE, "LocalMods") + +RSYNC_DEST = "root@homelabvm:/opt/barotrauma/LocalMods/" + + +def log_ok(msg): + print(f"\033[92m✓\033[0m {msg}") + +def log_info(msg): + print(f"• {msg}") + +def log_err(msg): + print(f"\033[91m✗\033[0m {msg}", file=sys.stderr) + + +def main(): + msg = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else "Update LocalMods" + + print() + print("╔═══════════════════════════════════════╗") + print("║ Prep: mods → rsync → config → commit║") + print("╚═══════════════════════════════════════╝") + print() + + log_info("Step 1/4: Copy mods from workshop...") + subprocess.run([sys.executable, PREPARE_LOCAL], check=True) + log_ok("LocalMods ready") + print() + + log_info("Step 2/4: Rsyncing LocalMods/ to server...") + subprocess.run([ + "rsync", "-avz", "--delete", + "-e", "ssh -p 22", + LOCALMODS_DIR + "/", RSYNC_DEST + ], check=True) + log_ok("LocalMods synced to homelabvm") + print() + + log_info("Step 3/4: Generating config_player.xml...") + subprocess.run([sys.executable, AUTOGEN], check=True) + log_ok("config_player.xml generated") + print() + + log_info("Step 4/4: Committing...") + subprocess.run(["git", "add", "-A"], cwd=BASE, check=True) + subprocess.run(["git", "commit", "-m", msg], cwd=BASE, check=True) + log_ok(f"Committed: {msg}") + print() + + log_ok("Done. Push manually when ready.") + + +if __name__ == "__main__": + main() diff --git a/prepare_local b/prepare_local new file mode 100755 index 0000000..7972d65 --- /dev/null +++ b/prepare_local @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 +"""Copy workshop mods from 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/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 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() diff --git a/scripts/__pycache__/autogen_config.cpython-314.pyc b/scripts/__pycache__/autogen_config.cpython-314.pyc new file mode 100644 index 0000000..c440514 Binary files /dev/null and b/scripts/__pycache__/autogen_config.cpython-314.pyc differ diff --git a/scripts/autogen_config.py b/scripts/autogen_config.py index e301c26..9d46a90 100755 --- a/scripts/autogen_config.py +++ b/scripts/autogen_config.py @@ -1,39 +1,145 @@ #!/usr/bin/env python3 -"""Scan LocalMods/ and generate config_player.xml with content packages.""" +"""Generate config_player.xml from SERVER.xml mod list preserving load order.""" import os import sys import xml.etree.ElementTree as ET -BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -MODS_DIR = os.path.join(BASE, "LocalMods") -OUTPUT = os.path.join(BASE, "config_player.xml") +MODLIST_PATH = "/mnt/nvme/B/SteamLibrary/steamapps/common/Barotrauma/ModLists/SERVER.xml" +LOCALMODS_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "LocalMods") +OUTPUT = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "config_player.xml") +WORKSHOP_DIR = "/mnt/nvme/B/SteamLibrary/steamapps/workshop/content/602960" -def find_mods(): - if not os.path.isdir(MODS_DIR): - return [] - return sorted( - d for d in os.listdir(MODS_DIR) - if os.path.isfile(os.path.join(MODS_DIR, d, "filelist.xml")) - ) +def log_ok(msg: str, indent: int = 0): + prefix = " " * indent + "\033[92m✓\033[0m" + print(f"{prefix} {msg}") -def build_config(mods): - root = ET.Element("Barotrauma") - cp = ET.SubElement(root, "contentpackages") - ET.SubElement(cp, "corepackage", path="Content/ContentPackages/Vanilla.xml") - reg = ET.SubElement(cp, "regularpackages") - for m in mods: - ET.SubElement(reg, "package", path=f"LocalMods/{m}/filelist.xml") - ET.indent(root) - return ET.tostring(root, encoding="unicode", xml_declaration=True) +def log_info(msg: str, indent: int = 0): + prefix = " " * indent + "•" + print(f"{prefix} {msg}") + + +def log_warn(msg: str, indent: int = 0): + prefix = " " * indent + "\033[93m⚠\033[0m" + print(f"{prefix} {msg}") + + +def log_err(msg: str, indent: int = 0): + prefix = " " * indent + "\033[91m✗\033[0m" + print(f"{prefix} {msg}", file=sys.stderr) + + +def get_workshop_name(mod_id: str) -> str | None: + fl_path = os.path.join(WORKSHOP_DIR, mod_id, "filelist.xml") + if os.path.isfile(fl_path): + try: + return ET.parse(fl_path).getroot().get("name") + except Exception: + return None + return None + + +def find_mod_folder(name: str) -> str | None: + name_lower = name.lower() + if not os.path.isdir(LOCALMODS_DIR): + return None + for d in os.listdir(LOCALMODS_DIR): + if d.lower() == name_lower: + return d + return None + + +def resolve_mod_path(name: str, mod_id: str | None = None) -> str: + folder = find_mod_folder(name) + if folder and os.path.isfile(os.path.join(LOCALMODS_DIR, folder, "filelist.xml")): + return f"LocalMods/{folder}/filelist.xml" + + if mod_id: + workshop_name = get_workshop_name(mod_id) + if workshop_name: + folder = find_mod_folder(workshop_name) + if folder and os.path.isfile(os.path.join(LOCALMODS_DIR, folder, "filelist.xml")): + return f"LocalMods/{folder}/filelist.xml" + + return f"LocalMods/{name}/filelist.xml" + + +def main(): + print() + print("╔══════════════════════════════════════════╗") + print("║ Autogen Config from SERVER.xml order ║") + 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: {MODLIST_PATH}") + try: + tree = ET.parse(MODLIST_PATH) + root = tree.getroot() + except Exception as e: + log_err(f"Parse error: {e}") + sys.exit(1) + + entries = list(root) + log_info(f"Total entries in mod list: {len(entries)}") + print() + + resolved = [] + missing = [] + + for el in entries: + tag = el.tag + if tag == "Vanilla": + continue + + name = el.get("name", "").strip() + mod_id = el.get("id", "").strip() if tag == "Workshop" else None + + if not name: + continue + + path = resolve_mod_path(name, mod_id) + resolved.append(path) + + full_path = os.path.join(os.path.dirname(OUTPUT), path) + if os.path.isfile(full_path): + log_ok(f"{name}", indent=1) + else: + missing.append(name) + log_warn(f"{name} — filelist.xml not found, adding anyway", indent=1) + + print() + log_info(f"Mods resolved: {len([r for r in resolved if r])}") + if missing: + log_warn(f"Missing from LocalMods: {len(missing)}") + for m in missing: + log_info(f" {m}", indent=1) + + print() + log_info("Generating config_player.xml...") + + barotrauma = ET.Element("Barotrauma") + cps = ET.SubElement(barotrauma, "contentpackages") + ET.SubElement(cps, "corepackage", path="Content/ContentPackages/Vanilla.xml") + reg = ET.SubElement(cps, "regularpackages") + + for r in resolved: + ET.SubElement(reg, "package", path=r) + + ET.indent(barotrauma) + xml_str = ET.tostring(barotrauma, encoding="unicode", xml_declaration=True) + + with open(OUTPUT, "w") as f: + f.write(xml_str) + + log_ok(f"Written {OUTPUT}") + print() if __name__ == "__main__": - mods = find_mods() - print(f"Found {len(mods)} mod(s): {mods}") - xml = build_config(mods) - with open(OUTPUT, "w") as f: - f.write(xml) - print(f"Generated {OUTPUT}") + main() diff --git a/serversettings.xml b/serversettings.xml new file mode 100644 index 0000000..e8c9533 --- /dev/null +++ b/serversettings.xml @@ -0,0 +1,128 @@ + + + + \ No newline at end of file