Merge branch 'main' into release
Some checks failed
Restart server / restart (push) Failing after 1m35s
Some checks failed
Restart server / restart (push) Failing after 1m35s
# Conflicts: # .gitea/workflows/deploy.yml
This commit is contained in:
0
.gitattributes
vendored
Normal file
0
.gitattributes
vendored
Normal file
@@ -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 &)"
|
||||
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
LocalMods/
|
||||
LocalMods.tar.gz
|
||||
@@ -3,7 +3,7 @@
|
||||
<CampaignSettingDefinitions>
|
||||
<StartingBalanceAmount high="10000" medium="8500" low="6000" />
|
||||
<ExtraEventManagerDifficulty low="-15.0" medium="0.0" high="20.0" hellish="60.0" />
|
||||
<LevelDifficultyMultiplier low="0.6" medium="1.0" high="1.6" hellish="10.0" />
|
||||
<LevelDifficultyMultiplier low="0.6" medium="1.0" high="2.0" hellish="10.0" />
|
||||
<PatdownProbabilityMin off="0" low="0.2" medium="0.3" high="0.4" />
|
||||
<PatdownProbabilityMax off="0" low="0.9" medium="0.9" high="1.0" />
|
||||
</CampaignSettingDefinitions>
|
||||
|
||||
@@ -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
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Configuration>
|
||||
<Settings>
|
||||
<Setting Name="HideUserNamesInLogs" Type="bool" Value="true"/>
|
||||
<Setting Name="CsRunPolicy" Type="listString" Value="Prompt" AllowChangesWhileExecuting="false">
|
||||
<Values>
|
||||
<Value Value="Disabled"/>
|
||||
<Value Value="Prompt"/>
|
||||
<Value Value="Enabled"/>
|
||||
</Values>
|
||||
</Setting>
|
||||
<Setting Name="UseCaching" Type="bool" Value="true" AllowChangesWhileExecuting="false"/>
|
||||
<Setting Name="IsCsEnabledForSession" Type="bool" AllowChangesWhileExecuting="false" ShowInMenus="false" Value="false"/>
|
||||
</Settings>
|
||||
</Configuration>
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ModConfig>
|
||||
<Lua File="%ModDir%/Lua/LuaSetup.lua" IsAutorun="true" />
|
||||
<Config File="%ModDir%/Config/SettingsShared.xml"/>
|
||||
<Assembly File="%ModDir%/Publicized/BarotraumaCore.dll" IsReferenceModeOnly="true"/>
|
||||
<Assembly File="%ModDir%/Publicized/Barotrauma.dll" Target="Client" IsReferenceModeOnly="true" IsFileRequired="false"/>
|
||||
<Assembly File="%ModDir%/Publicized/DedicatedServer.dll" Target="Server" IsReferenceModeOnly="true"/>
|
||||
</ModConfig>
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<style>
|
||||
<SettingsMenuTab.LuaCsSettings color="169,212,187,255" hovercolor="220,220,220,255" selectedcolor="255,255,255,255" pressedcolor="100,100,100,255" disabledcolor="125,125,125,125">
|
||||
<Sprite name="LuaCsSettings" texture="%ModDir%/LuaCsSettingsIcon.png" sourcerect="0,0,64,64" tile="false" maintainaspectratio="true" origin="0.5,0.5"/>
|
||||
</SettingsMenuTab.LuaCsSettings>
|
||||
</style>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<infotexts language="English" nowhitespace="false" translatedname="English">
|
||||
<LuaCsForBarotrauma.SettingsMenu.ModControlsButton>Mod Controls Settings</LuaCsForBarotrauma.SettingsMenu.ModControlsButton>
|
||||
<LuaCsForBarotrauma.SettingsMenu.ModGameplayButton>Mod Gameplay Settings</LuaCsForBarotrauma.SettingsMenu.ModGameplayButton>
|
||||
<LuaCsForBarotrauma.SettingsMenu.ResetVisibleSettings>Reset Displayed Settings</LuaCsForBarotrauma.SettingsMenu.ResetVisibleSettings>
|
||||
<LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Title>Reset Visible Settings</LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Title>
|
||||
<LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Message>Are you sure you want to reset the values for currently displayed settings?</LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Message>
|
||||
<LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Yes>Yes</LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Yes>
|
||||
<LuaCsForBarotrauma.SettingsMenu.ResetPrompt.No>No</LuaCsForBarotrauma.SettingsMenu.ResetPrompt.No>
|
||||
<!-- Settings -->
|
||||
<!-- Is Cs Enabled-->
|
||||
<LuaCsForBarotrauma.CsRunPolicy.DisplayName>Are C# Mods Allowed</LuaCsForBarotrauma.CsRunPolicy.DisplayName>
|
||||
<LuaCsForBarotrauma.CsRunPolicy.Tooltip>Should unsandboxed scripts and dlls be allowed to run.</LuaCsForBarotrauma.CsRunPolicy.Tooltip>
|
||||
<LuaCsForBarotrauma.CsRunPolicy.DisplayCategory>General</LuaCsForBarotrauma.CsRunPolicy.DisplayCategory>
|
||||
<!-- Use Caching -->
|
||||
<LuaCsForBarotrauma.UseCaching.DisplayName>Use Pre-Caching</LuaCsForBarotrauma.UseCaching.DisplayName>
|
||||
<LuaCsForBarotrauma.UseCaching.Tooltip>Should mod files be preloaded to speed up loading. Should only be turned off if you have mods that have issues with this.</LuaCsForBarotrauma.UseCaching.Tooltip>
|
||||
<LuaCsForBarotrauma.UseCaching.DisplayCategory>General</LuaCsForBarotrauma.UseCaching.DisplayCategory>
|
||||
<!-- Hide Usernames In Logs-->
|
||||
<LuaCsForBarotrauma.HideUserNamesInLogs.DisplayName>Hide Local OS Account Name In Logs</LuaCsForBarotrauma.HideUserNamesInLogs.DisplayName>
|
||||
<LuaCsForBarotrauma.HideUserNamesInLogs.Tooltip>If true, will replace your OS account name with 'USERNAME' in log files' paths.</LuaCsForBarotrauma.HideUserNamesInLogs.Tooltip>
|
||||
<LuaCsForBarotrauma.HideUserNamesInLogs.DisplayCategory>General</LuaCsForBarotrauma.HideUserNamesInLogs.DisplayCategory>
|
||||
</infotexts>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<infotexts language="Portuguese" nowhitespace="false" translatedname="Portuguese">
|
||||
</infotexts>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<contentpackage name="LuaCsForBarotrauma">
|
||||
<Text file="%ModDir%/Texts/English.xml"/>
|
||||
<UIStyle file="%ModDir%/Style.xml" />
|
||||
<!--<Text file="%ModDir%/Texts/Portuguese.xml"/>-->
|
||||
</contentpackage>
|
||||
@@ -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.
|
||||
@@ -3,7 +3,51 @@
|
||||
<contentpackages>
|
||||
<corepackage path="Content/ContentPackages/Vanilla.xml" />
|
||||
<regularpackages>
|
||||
<package path="LocalMods/LuaCsForBarotrauma/filelist.xml" />
|
||||
<package path="LocalMods/NT Informative Descriptions/filelist.xml" />
|
||||
<package path="LocalMods/LuaCsClientSideEnforced/filelist.xml" />
|
||||
<package path="LocalMods/Total Russian Translation (TRT)/filelist.xml" />
|
||||
<package path="LocalMods/Endgame Reforged/filelist.xml" />
|
||||
<package path="LocalMods/Dont Open Debug Console On Errors/filelist.xml" />
|
||||
<package path="LocalMods/Enhanced Loading/filelist.xml" />
|
||||
<package path="LocalMods/MicroLua/filelist.xml" />
|
||||
<package path="LocalMods/Lua Linker/filelist.xml" />
|
||||
<package path="LocalMods/Immersive Sonar UI - A Real Sonar Add-On/filelist.xml" />
|
||||
<package path="LocalMods/Real Sonar + Neurotrauma Item Patch (Forked)/filelist.xml" />
|
||||
<package path="LocalMods/Wifi Camera/filelist.xml" />
|
||||
<package path="LocalMods/Real Sonar - EK Dockyard Remastered Patch/filelist.xml" />
|
||||
<package path="LocalMods/Real Sonar/filelist.xml" />
|
||||
<package path="LocalMods/Neurotrauma/filelist.xml" />
|
||||
<package path="LocalMods/EK modern/filelist.xml" />
|
||||
<package path="LocalMods/AA Dangerous Meltdown - EK Compatible/filelist.xml" />
|
||||
<package path="LocalMods/Barotraumatic/filelist.xml" />
|
||||
<package path="LocalMods/DynamicEuropa/filelist.xml" />
|
||||
<package path="LocalMods/Complete Global Darkness Reboot/filelist.xml" />
|
||||
<package path="LocalMods/More Level Content/filelist.xml" />
|
||||
<package path="LocalMods/Soundproof Walls 2.0/filelist.xml" />
|
||||
<package path="LocalMods/The Avali's Audio Overhaul/filelist.xml" />
|
||||
<package path="LocalMods/Immersive Ignitables (Fun ver)/filelist.xml" />
|
||||
<package path="LocalMods/Room FX/filelist.xml" />
|
||||
<package path="LocalMods/Cat Propaganda Banner Override/filelist.xml" />
|
||||
<package path="LocalMods/All Jobs See Reports (Lua)/filelist.xml" />
|
||||
<package path="LocalMods/Bigger Deconstructor/filelist.xml" />
|
||||
<package path="LocalMods/NT Medical Exosuit 醫療外骨骼/filelist.xml" />
|
||||
<package path="LocalMods/Decon pls/filelist.xml" />
|
||||
<package path="LocalMods/Bigger Deconstructor Barocraftables+ (No Limits)/filelist.xml" />
|
||||
<package path="LocalMods/Visual Variety Pack Modified/filelist.xml" />
|
||||
<package path="LocalMods/Enhanced Immersion (NO ITEMS OVERRIDE)/filelist.xml" />
|
||||
<package path="LocalMods/Epic accordion/filelist.xml" />
|
||||
<package path="LocalMods/Press-R-to-Reload/filelist.xml" />
|
||||
<package path="LocalMods/Better Genes/filelist.xml" />
|
||||
<package path="LocalMods/More Content for Europa/filelist.xml" />
|
||||
<package path="LocalMods/Thalassophobia Restored/filelist.xml" />
|
||||
<package path="LocalMods/Blueprints/filelist.xml" />
|
||||
<package path="LocalMods/Monospaced Text Display/filelist.xml" />
|
||||
<package path="LocalMods/Sunken Tapes/filelist.xml" />
|
||||
<package path="LocalMods/TSFX/filelist.xml" />
|
||||
<package path="LocalMods/Fourth Empire Posters/filelist.xml" />
|
||||
<package path="LocalMods/NCT-Spike Mod. 2/filelist.xml" />
|
||||
<package path="LocalMods/VT-MOFS Mod. 4/filelist.xml" />
|
||||
<package path="LocalMods/ADX-Atlas IV/filelist.xml" />
|
||||
</regularpackages>
|
||||
</contentpackages>
|
||||
</Barotrauma>
|
||||
64
prep
Executable file
64
prep
Executable file
@@ -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()
|
||||
161
prepare_local
Executable file
161
prepare_local
Executable file
@@ -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 <Workshop> 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()
|
||||
BIN
scripts/__pycache__/autogen_config.cpython-314.pyc
Normal file
BIN
scripts/__pycache__/autogen_config.cpython-314.pyc
Normal file
Binary file not shown.
@@ -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()
|
||||
|
||||
128
serversettings.xml
Normal file
128
serversettings.xml
Normal file
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<serversettings
|
||||
port="27015"
|
||||
queryport="27016"
|
||||
password="315219"
|
||||
enableupnp="false"
|
||||
HiddenSubs=""
|
||||
AllowedRandomMissionTypes="AbandonedOutpost,AbandonedOutpostAssassinate,AbandonedOutpostMonsters,Beacon,Cargo,ClearAlienRuins,EliminateTargets,EliminateThalamus,Escort,KingOfTheHull,Mineral,Monster,OutpostCombat,OutpostDestroy,OutpostRescue,Pirate,Salvage,SalvageCave,SalvageRuin,SalvageWreck,ScanAlienRuins,SubVsSubCombat,jailbreak,nest"
|
||||
AllowedClientNameChars="32-33,38-46,48-57,65-90,91-91,93-93,95-122,192-255,384-591,1024-1279,4352-4607,44032-55215,19968-21327,21329-40959,13312-19903,131072-173791,173824-178207,178208-183983,63744-64255,194560-195103"
|
||||
ServerName="JuneGoida"
|
||||
ServerMessageText=""
|
||||
IsPublic="True"
|
||||
TickRate="20"
|
||||
MaxLagCompensation="150"
|
||||
RequireAuthentication="True"
|
||||
RandomizeSeed="True"
|
||||
UseRespawnShuttle="True"
|
||||
RespawnInterval="30"
|
||||
MaxTransportTime="180"
|
||||
MinRespawnRatio="0.2"
|
||||
SkillLossPercentageOnDeath="25"
|
||||
SkillLossPercentageOnImmediateRespawn="10"
|
||||
ReplaceCostPercentage="100"
|
||||
AllowBotTakeoverOnPermadeath="True"
|
||||
IronmanMode="False"
|
||||
AutoRestartInterval="60"
|
||||
StartWhenClientsReady="False"
|
||||
PvpTeamSelectionMode="PlayerPreference"
|
||||
PvpAutoBalanceThreshold="1"
|
||||
StartWhenClientsReadyRatio="0.8"
|
||||
PvPStunResist="0"
|
||||
PvPSpawnMonsters="False"
|
||||
PvPSpawnWrecks="True"
|
||||
Biome="Random"
|
||||
SelectedOutpostName="Random"
|
||||
AllowSpectating="True"
|
||||
AllowAFK="True"
|
||||
SaveServerLogs="True"
|
||||
AllowModDownloads="True"
|
||||
AllowFileTransfers="True"
|
||||
AllowRemoteCampaignInteractions="False"
|
||||
VoiceChatEnabled="True"
|
||||
PlayStyle="SomethingDifferent"
|
||||
LosMode="Transparent"
|
||||
ShowEnemyHealthBars="ShowAll"
|
||||
LinesPerLogFile="800"
|
||||
AutoRestart="False"
|
||||
AllowVoteKick="True"
|
||||
AllowEndVoting="True"
|
||||
RespawnMode="BetweenRounds"
|
||||
BotCount="0"
|
||||
MaxBotCount="16"
|
||||
BotSpawnMode="Normal"
|
||||
DisableBotConversations="False"
|
||||
SelectedLevelDifficulty="0"
|
||||
AllowDisguises="True"
|
||||
AllowRewiring="True"
|
||||
AllowImmediateItemDelivery="True"
|
||||
LockAllDefaultWires="False"
|
||||
AllowLinkingWifiToChat="False"
|
||||
AllowFriendlyFire="True"
|
||||
AllowDragAndDropGive="True"
|
||||
DestructibleOutposts="False"
|
||||
KillableNPCs="True"
|
||||
BanAfterWrongPassword="True"
|
||||
MaxPasswordRetriesBeforeBan="3"
|
||||
EnableDoSProtection="True"
|
||||
MaxPacketAmount="4000"
|
||||
SelectedSubmarine="NCT-Spike Mod.1"
|
||||
SelectedShuttle="Ambulance_Mongolian"
|
||||
TraitorProbability="0.29999998"
|
||||
TraitorDangerLevel="3"
|
||||
TraitorsMinPlayerCount="5"
|
||||
MinPercentageOfPlayersForTraitorAccusation="50"
|
||||
Language="Russian"
|
||||
SubSelectionMode="Manual"
|
||||
ModeSelectionMode="Manual"
|
||||
EndVoteRequiredRatio="0.6"
|
||||
VoteRequiredRatio="0.6"
|
||||
VoteTimeout="30"
|
||||
KickVoteRequiredRatio="0.6"
|
||||
DisallowKickVoteTime="120"
|
||||
KillDisconnectedTime="300"
|
||||
DespawnDisconnectedPermadeathTime="10"
|
||||
KickAFKTime="600"
|
||||
MinimumMidRoundSyncTimeout="30"
|
||||
RoundStartSyncDuration="120"
|
||||
EventRemovalTime="15"
|
||||
OldReceivedEventKickTime="20"
|
||||
OldEventKickTime="40"
|
||||
TimeoutThresholdNotInGame="60"
|
||||
TimeoutThresholdInGame="10"
|
||||
KarmaEnabled="False"
|
||||
KarmaPreset="default"
|
||||
GameModeIdentifier="multiplayercampaign"
|
||||
MissionTypes="AbandonedOutpost,AbandonedOutpostAssassinate,AbandonedOutpostMonsters,Beacon,Cargo,ClearAlienRuins,EliminateTargets,EliminateThalamus,Escort,KingOfTheHull,Mineral,Monster,OutpostCombat,OutpostDestroy,OutpostRescue,Pirate,Salvage,SalvageCave,SalvageRuin,SalvageWreck,ScanAlienRuins,SubVsSubCombat,jailbreak,nest"
|
||||
MaxPlayers="8"
|
||||
AutoBanTime="3600"
|
||||
MaxAutoBanTime="86400"
|
||||
LootedMoneyDestination="Bank"
|
||||
MaximumMoneyTransferRequest="999999"
|
||||
NewCampaignDefaultSalary="0"
|
||||
TrackOpponentInPvP="True"
|
||||
DisembarkPointAllowance="7"
|
||||
SelectedCoalitionPerks="hullupgradesteel;airlockbasic;armorysmall;medbayfirstaid;engineeringshiprepair"
|
||||
WinScorePvP="200"
|
||||
SelectedSeparatistsPerks="hullupgradesteel;airlockbasic;armorysmall;medbayfirstaid;engineeringshiprepair"
|
||||
DisabledMonsters="">
|
||||
<campaignsettings
|
||||
PresetName=""
|
||||
TutorialEnabled="False"
|
||||
RadiationEnabled="False"
|
||||
MaxMissionCount="10"
|
||||
WorldHostility="High"
|
||||
StartItemSet="normal"
|
||||
StartingBalanceAmount="Low"
|
||||
CrewVitalityMultiplier="0.79999995"
|
||||
NonCrewVitalityMultiplier="1"
|
||||
OxygenMultiplier="0.59999996"
|
||||
FuelMultiplier="0.9"
|
||||
MissionRewardMultiplier="1"
|
||||
ExperienceRewardMultiplier="1"
|
||||
ShopPriceMultiplier="1.5"
|
||||
ShipyardPriceMultiplier="1.5"
|
||||
RepairFailMultiplier="1.5"
|
||||
ShowHuskWarning="False"
|
||||
PatdownProbability="High" />
|
||||
</serversettings>
|
||||
Reference in New Issue
Block a user