Merge branch 'heads/upstream' into OBT/1.2.0(SpringUpdate)

This commit is contained in:
NotAlwaysTrue
2026-04-25 13:08:16 +08:00
420 changed files with 24089 additions and 11191 deletions
@@ -14,6 +14,7 @@ using MoonSharp.Interpreter;
using System.Net;
using Barotrauma.Extensions;
using System.Threading.Tasks;
using Barotrauma.LuaCs.Events;
namespace Barotrauma
{
@@ -35,8 +36,6 @@ namespace Barotrauma
set { world = value; }
}
public static LuaCsSetup LuaCs;
public static GameServer Server;
public static NetworkMember NetworkMember
{
@@ -113,6 +112,8 @@ namespace Barotrauma
GameScreen = new GameScreen();
MainThread = Thread.CurrentThread;
LuaCsSetup.Instance.GetType();
}
public void Init()
@@ -131,8 +132,6 @@ namespace Barotrauma
NetLobbyScreen = new NetLobbyScreen();
CheckContentPackage();
LuaCs = new LuaCsSetup();
}
@@ -244,6 +243,9 @@ namespace Barotrauma
//handled in TryStartChildServerRelay
i += 2;
break;
case "-lenienthandshake":
NetConfig.UseLenientHandshake = true;
break;
}
}
@@ -367,12 +369,16 @@ namespace Barotrauma
TaskPool.Update();
CoroutineManager.Update(paused: false, (float)Timing.Step);
GameMain.LuaCs.Update();
performanceCounterTimer.Stop();
if (GameMain.LuaCs.PerformanceCounter.EnablePerformanceCounter)
if (LuaCsSetup.Instance.PerformanceCounterService.EnablePerformanceCounter)
{
GameMain.LuaCs.PerformanceCounter.UpdateElapsedTime = (double)performanceCounterTimer.ElapsedTicks / Stopwatch.Frequency;
LuaCsSetup.Instance.PerformanceCounterService.AddElapsedTicks(new SimplePerformanceData("Update", performanceCounterTimer.ElapsedTicks));
}
if (LuaCsSetup.Instance.PerformanceCounter.EnablePerformanceCounter)
{
LuaCsSetup.Instance.PerformanceCounter.UpdateElapsedTime = (double)performanceCounterTimer.ElapsedTicks / Stopwatch.Frequency;
}
performanceCounterTimer.Reset();
Timing.Accumulator -= Timing.Step;
@@ -459,7 +465,17 @@ namespace Barotrauma
public void Exit()
{
ShouldRun = false;
GameMain.LuaCs.Stop();
try
{
if (LuaCsSetup.Instance is not null)
{
LuaCsSetup.Instance.Dispose();
}
}
catch (Exception e)
{
DebugConsole.ThrowError($"Error while disposing of LuaCsForBarotrauma: {e.Message} | {e.StackTrace}");
}
}
}
}