Merge fixes

This commit is contained in:
EvilFactory
2024-03-28 16:19:53 -03:00
parent a95ef7ac08
commit bf34934e9c
10 changed files with 90 additions and 46 deletions

View File

@@ -23,7 +23,7 @@ namespace Barotrauma
string[] filesToRemove = new string[]
{
"Barotrauma.dll", "Barotrauma.deps.json", "Barotrauma.pdb",
"Barotrauma.dll", "Barotrauma.deps.json", "Barotrauma.pdb", "BarotraumaCore.dll", "BarotraumaCore.pdb",
"System.Reflection.Metadata.dll", "System.Collections.Immutable.dll",
"System.Runtime.CompilerServices.Unsafe.dll"
};

View File

@@ -14,7 +14,7 @@ namespace Barotrauma
WriteOnlyMessage message = new WriteOnlyMessage();
message.WriteByte((byte)ClientPacketHeader.LUA_NET_MESSAGE);
message.WriteByte((byte)LuaCsClientToServer.RequestAllIds);
GameMain.Client.ClientPeer.Send(message, DeliveryMethod.ReliableOrdered);
GameMain.Client.ClientPeer.Send(message, DeliveryMethod.Reliable);
}
public void NetMessageReceived(IReadMessage netMessage, ServerPacketHeader header, Client client = null)
@@ -82,7 +82,7 @@ namespace Barotrauma
message.WriteString(netMessageName);
Send(message, DeliveryMethod.ReliableOrdered);
Send(message, DeliveryMethod.Reliable);
}
public void Send(IWriteMessage netMessage, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable)

View File

@@ -29,6 +29,8 @@ namespace Barotrauma
File.Move("Barotrauma.dll", "Temp/Original/Barotrauma.dll", true);
File.Move("Barotrauma.deps.json", "Temp/Original/Barotrauma.deps.json", true);
File.Move("Barotrauma.pdb", "Temp/Original/Barotrauma.pdb", true);
File.Move("BarotraumaCore.dll", "Temp/Original/BarotraumaCore.dll", true);
File.Move("BarotraumaCore.pdb", "Temp/Original/BarotraumaCore.pdb", true);
File.Move("System.Reflection.Metadata.dll", "Temp/Original/System.Reflection.Metadata.dll", true);
File.Move("System.Collections.Immutable.dll", "Temp/Original/System.Collections.Immutable.dll", true);

View File

@@ -144,7 +144,7 @@ namespace Barotrauma
message.WriteUInt16(id);
message.WriteString(name);
Send(message, null, DeliveryMethod.ReliableOrdered);
Send(message, null, DeliveryMethod.Reliable);
}
private void WriteAllIds(Client client)
@@ -160,7 +160,7 @@ namespace Barotrauma
message.WriteString(name);
}
Send(message, client.Connection, DeliveryMethod.ReliableOrdered);
Send(message, client.Connection, DeliveryMethod.Reliable);
}
public void ClientWriteLobby(Client client) => GameMain.Server.ClientWriteLobby(client);
@@ -185,11 +185,6 @@ namespace Barotrauma
GameMain.Server.UpdateClientPermissions(client);
}
public void RemovePendingClient(ServerPeer.PendingClient pendingClient, PeerDisconnectPacket peerDisconnectPacket)
{
GameMain.Server.ServerPeer.RemovePendingClient(pendingClient, peerDisconnectPacket);
}
public int FileSenderMaxPacketsPerUpdate
{
get { return FileSender.FileTransferOut.MaxPacketsPerUpdate; }

View File

@@ -17,5 +17,4 @@ RegisterBarotrauma("Character+TeamChangeEventData")
RegisterBarotrauma("Networking.GameServer")
RegisterBarotrauma("Networking.ServerPeer")
RegisterBarotrauma("Networking.ServerPeer+PendingClient")
RegisterBarotrauma("Networking.FileSender")

View File

@@ -9,7 +9,7 @@ namespace Barotrauma
{
private static string[] trackingFiles = new string[]
{
"Barotrauma.dll", "Barotrauma.deps.json", "Barotrauma.pdb",
"Barotrauma.dll", "Barotrauma.deps.json", "Barotrauma.pdb", "BarotraumaCore.dll", "BarotraumaCore.pdb",
"0Harmony.dll", "Mono.Cecil.dll",
"Sigil.dll",
"Mono.Cecil.Mdb.dll", "Mono.Cecil.Pdb.dll",

View File

@@ -172,11 +172,11 @@ namespace Barotrauma
using (var file = File.Open(configFileName, FileMode.Open, FileAccess.Read))
{
XDocument document = XDocument.Load(file);
Config.EnableCsScripting = bool.Parse(document.Root.Element("ForceCsScripting").Value);
Config.TreatForcedModsAsNormal = bool.Parse(document.Root.Element("TreatForcedModsAsNormal").Value);
Config.PreferToUseWorkshopLuaSetup = bool.Parse(document.Root.Element("PreferToUseWorkshopLuaSetup").Value);
Config.DisableErrorGUIOverlay = bool.Parse(document.Root.Element("DisableErrorGUIOverlay").Value);
Config.HideUserNames = bool.Parse(document.Root.Element("HideUserNames").Value);
Config.EnableCsScripting = document.Root.GetAttributeBool("EnableCsScripting", Config.EnableCsScripting);
Config.TreatForcedModsAsNormal = document.Root.GetAttributeBool("TreatForcedModsAsNormal", Config.TreatForcedModsAsNormal);
Config.PreferToUseWorkshopLuaSetup = document.Root.GetAttributeBool("PreferToUseWorkshopLuaSetup", Config.PreferToUseWorkshopLuaSetup);
Config.DisableErrorGUIOverlay = document.Root.GetAttributeBool("DisableErrorGUIOverlay", Config.DisableErrorGUIOverlay);
Config.HideUserNames = document.Root.GetAttributeBool("HideUserNames", Config.HideUserNames);
}
}
catch (Exception e)

View File

@@ -94,19 +94,21 @@ namespace Barotrauma
{
if (!LuaCsFile.IsPathAllowedException(destination)) { return; }
Steamworks.Ugc.Item? item = await SteamManager.Workshop.GetItem(id);
Option<Steamworks.Ugc.Item> itemOption = await SteamManager.Workshop.GetItem(id);
if (item == null)
if (itemOption.TryUnwrap(out Steamworks.Ugc.Item item))
{
DownloadWorkshopItemAsync(new WorkshopItemDownload()
{
Item = item,
Destination = destination,
Callback = callback
}, true);
}
else
{
throw new Exception($"Tried to download invalid workshop item {id}.");
}
DownloadWorkshopItemAsync(new WorkshopItemDownload()
{
Item = item.Value,
Destination = destination,
Callback = callback
}, true);
}
public void DownloadWorkshopItem(Steamworks.Ugc.Item item, string destination, LuaCsAction callback)
@@ -121,8 +123,16 @@ namespace Barotrauma
public async void GetWorkshopItem(UInt64 id, LuaCsAction callback)
{
Steamworks.Ugc.Item? item = await SteamManager.Workshop.GetItem(id);
callback(item);
Option<Steamworks.Ugc.Item> itemOption = await SteamManager.Workshop.GetItem(id);
if (itemOption.TryUnwrap(out Steamworks.Ugc.Item item))
{
callback(item);
}
else
{
callback(null);
}
}
public void Update()

View File

@@ -56,11 +56,6 @@ namespace Barotrauma
{
return ImmutableArray<Type>.Empty; // No types, don't add to cache
}
if (!TypeSearchCache.TryAdd(typeName, list))
{
DebugConsole.LogError($"ReflectionUtils::AddNonAbstractAssemblyTypes() | Error while adding to quick lookup cache.");
}
return list;
}
@@ -75,8 +70,6 @@ namespace Barotrauma
{
if (!overwrite)
{
DebugConsole.LogError(
$"ReflectionUtils::AddNonAbstractAssemblyTypes() | The assembly [{assembly.GetName()}] already exists in the cache.");
return;
}
@@ -85,18 +78,16 @@ namespace Barotrauma
try
{
if (!CachedNonAbstractTypes.TryAdd(assembly, assembly.GetSafeTypes().Where(t => !t.IsAbstract).ToImmutableArray()))
if (!CachedNonAbstractTypes.TryAdd(assembly, assembly.GetTypes().Where(t => !t.IsAbstract).ToImmutableArray()))
{
DebugConsole.LogError($"ReflectionUtils::AddNonAbstractAssemblyTypes() | Unable to add types from Assembly to cache.");
}
else
{
TypeSearchCache.Clear(); // Needs to be rebuilt to include potential new types
}
}
catch (ReflectionTypeLoadException e)
catch (ReflectionTypeLoadException)
{
DebugConsole.LogError($"ReflectionUtils::AddNonAbstractAssemblyTypes() | RTFException: Unable to load Assembly Types from {assembly.GetName()}.");
}
}
@@ -113,10 +104,10 @@ namespace Barotrauma
/// <summary>
/// Clears all cached assembly data and rebuilds types list only to include base Barotrauma types.
/// </summary>
internal static void ResetCache()
public static void ResetCache()
{
CachedNonAbstractTypes.Clear();
CachedNonAbstractTypes.TryAdd(typeof(ReflectionUtils).Assembly, typeof(ReflectionUtils).Assembly.GetSafeTypes().ToImmutableArray());
CachedNonAbstractTypes.TryAdd(typeof(ReflectionUtils).Assembly, typeof(ReflectionUtils).Assembly.GetTypes().ToImmutableArray());
TypeSearchCache.Clear();
}
@@ -130,7 +121,7 @@ namespace Barotrauma
return null;
}
public static Option<TBase> ParseDerived<TBase, TInput>(TInput input) where TInput : notnull where TBase : notnull
public static Option<TBase> ParseDerived<TBase, TInput>(TInput input)
where TBase : notnull
where TInput : notnull
{

View File

@@ -50,11 +50,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MoonSharp.VsCodeDebugger",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BarotraumaLibs", "BarotraumaLibs", "{29DF600C-C2EB-48F5-9CCB-7E3B1409D95F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BarotraumaCore", "Libraries\BarotraumaLibs\BarotraumaCore\BarotraumaCore.csproj", "{FA273D62-455C-4BF7-B020-D0EBDE9EB565}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BarotraumaCore", "Libraries\BarotraumaLibs\BarotraumaCore\BarotraumaCore.csproj", "{FA273D62-455C-4BF7-B020-D0EBDE9EB565}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EosInterface", "Libraries\BarotraumaLibs\EosInterface\EosInterface.csproj", "{38C5D23D-0858-4254-B7B7-145221A8AB75}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EosInterface", "Libraries\BarotraumaLibs\EosInterface\EosInterface.csproj", "{38C5D23D-0858-4254-B7B7-145221A8AB75}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EosInterface.Implementation.Win64", "Libraries\BarotraumaLibs\EosInterfacePrivate\EosInterface.Implementation.Win64.csproj", "{B411A619-1643-4C5F-A95D-9427D59BE010}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EosInterface.Implementation.Win64", "Libraries\BarotraumaLibs\EosInterfacePrivate\EosInterface.Implementation.Win64.csproj", "{B411A619-1643-4C5F-A95D-9427D59BE010}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -206,32 +206,80 @@ Global
{C7212AE2-A925-4225-A639-AE0653EF65B0}.Release|Any CPU.Build.0 = Release|Any CPU
{C7212AE2-A925-4225-A639-AE0653EF65B0}.Release|x64.ActiveCfg = Release|Any CPU
{C7212AE2-A925-4225-A639-AE0653EF65B0}.Release|x64.Build.0 = Release|Any CPU
{C7212AE2-A925-4225-A639-AE0653EF65B0}.Unstable|Any CPU.ActiveCfg = Release|Any CPU
{C7212AE2-A925-4225-A639-AE0653EF65B0}.Unstable|Any CPU.Build.0 = Release|Any CPU
{C7212AE2-A925-4225-A639-AE0653EF65B0}.Unstable|x64.ActiveCfg = Release|Any CPU
{C7212AE2-A925-4225-A639-AE0653EF65B0}.Unstable|x64.Build.0 = Release|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Debug|x64.ActiveCfg = Debug|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Debug|x64.Build.0 = Debug|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Release|Any CPU.Build.0 = Release|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Release|x64.ActiveCfg = Release|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Release|x64.Build.0 = Release|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Unstable|Any CPU.ActiveCfg = Debug|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Unstable|Any CPU.Build.0 = Debug|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Unstable|x64.ActiveCfg = Debug|Any CPU
{2EEF2610-64A3-4E5D-95ED-0E181C1A34ED}.Unstable|x64.Build.0 = Debug|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|x64.ActiveCfg = Debug|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Debug|x64.Build.0 = Debug|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|Any CPU.Build.0 = Release|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|x64.ActiveCfg = Release|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Release|x64.Build.0 = Release|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|Any CPU.ActiveCfg = Release|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|Any CPU.Build.0 = Release|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|x64.ActiveCfg = Release|Any CPU
{C98FE0D0-BC7D-4806-B592-734B53016FD8}.Unstable|x64.Build.0 = Release|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Debug|x64.ActiveCfg = Debug|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Debug|x64.Build.0 = Debug|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Release|Any CPU.Build.0 = Release|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Release|x64.ActiveCfg = Release|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Release|x64.Build.0 = Release|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Unstable|Any CPU.ActiveCfg = Debug|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Unstable|Any CPU.Build.0 = Debug|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Unstable|x64.ActiveCfg = Debug|Any CPU
{AF484604-D20F-4D87-B298-1A712052D0D9}.Unstable|x64.Build.0 = Debug|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Debug|x64.ActiveCfg = Debug|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Debug|x64.Build.0 = Debug|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Release|Any CPU.Build.0 = Release|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Release|x64.ActiveCfg = Release|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Release|x64.Build.0 = Release|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Unstable|Any CPU.ActiveCfg = Release|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Unstable|Any CPU.Build.0 = Release|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Unstable|x64.ActiveCfg = Release|Any CPU
{FA273D62-455C-4BF7-B020-D0EBDE9EB565}.Unstable|x64.Build.0 = Release|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Debug|x64.ActiveCfg = Debug|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Debug|x64.Build.0 = Debug|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Release|Any CPU.Build.0 = Release|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Release|x64.ActiveCfg = Release|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Release|x64.Build.0 = Release|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Unstable|Any CPU.ActiveCfg = Release|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Unstable|Any CPU.Build.0 = Release|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Unstable|x64.ActiveCfg = Release|Any CPU
{38C5D23D-0858-4254-B7B7-145221A8AB75}.Unstable|x64.Build.0 = Release|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Debug|x64.ActiveCfg = Debug|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Debug|x64.Build.0 = Debug|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Release|Any CPU.Build.0 = Release|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Release|x64.ActiveCfg = Release|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Release|x64.Build.0 = Release|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Unstable|Any CPU.ActiveCfg = Release|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Unstable|Any CPU.Build.0 = Release|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Unstable|x64.ActiveCfg = Release|Any CPU
{B411A619-1643-4C5F-A95D-9427D59BE010}.Unstable|x64.Build.0 = Release|Any CPU
EndGlobalSection
@@ -257,7 +305,6 @@ Global
{FA273D62-455C-4BF7-B020-D0EBDE9EB565} = {29DF600C-C2EB-48F5-9CCB-7E3B1409D95F}
{38C5D23D-0858-4254-B7B7-145221A8AB75} = {29DF600C-C2EB-48F5-9CCB-7E3B1409D95F}
{B411A619-1643-4C5F-A95D-9427D59BE010} = {29DF600C-C2EB-48F5-9CCB-7E3B1409D95F}
{D42D8E48-A687-445D-AAF1-9E7E6EBF1DE6} = {DE36F45F-F09E-4719-B953-00D148F7722A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {17032EAB-554B-4B44-A4F6-EFB177ACAB7A}