From 1def7b7b8dbdc0c0de1aaf2edef922b1837adbdc Mon Sep 17 00:00:00 2001 From: NotAlwaysTrue <2136846186@qq.com> Date: Mon, 22 Dec 2025 22:54:33 +0800 Subject: [PATCH] add catch code for previous commit :( --- .../BarotraumaServer/ServerSource/Networking/GameServer.cs | 4 ++-- .../BarotraumaShared/SharedSource/Characters/HumanPrefab.cs | 4 ++++ .../BarotraumaShared/SharedSource/Characters/Jobs/Job.cs | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs index 35bf2fc4c..d4538fe6a 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs @@ -1233,9 +1233,9 @@ namespace Barotrauma.Networking } } } - finally + catch { - errorLines.Add("Catch event snapshot failed."); + errorLines.Add("Failed to write EntitySpawner events."); } errorLines.Add(""); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/HumanPrefab.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/HumanPrefab.cs index 816dd61ee..cad503496 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/HumanPrefab.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/HumanPrefab.cs @@ -293,6 +293,10 @@ namespace Barotrauma GameMain.Server.EntityEventManager.Events.RemoveAll(ev => ev.Entity == item); } } + catch + { + GameServer.Log("Try making UniqueEvents snapshot failed", ServerLog.MessageType.Warning); + } finally { Entity.Spawner.CreateNetworkEvent(new EntitySpawner.SpawnEntity(item)); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs index c30142d51..e96bcaab4 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs @@ -181,6 +181,10 @@ namespace Barotrauma GameMain.Server.EntityEventManager.Events.RemoveAll(ev => ev.Entity == item); } } + catch + { + GameServer.Log("Try making UniqueEvents snapshot failed", ServerLog.MessageType.Warning); + } finally { Entity.Spawner.CreateNetworkEvent(new EntitySpawner.SpawnEntity(item));