From 72c0a51f606612ef3cf344d0eba5f813ab266830 Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Tue, 18 Feb 2025 16:49:57 +0300 Subject: [PATCH] Master fix (#913) * loadmap fixes * Update PostMapInitTest and CP14StationZLevelsSystem to enhance map whitelisting and initialization * fix #907 * Update PostMapInitTest.cs --- Content.IntegrationTests/Tests/PostMapInitTest.cs | 9 +++++++++ Content.Server/_CP14/Cargo/CP14CargoSystem.cs | 11 ++++++----- .../_CP14/Demiplane/CP14DemiplaneSystem.Echoes.cs | 2 +- .../EntitySystems/CP14StationZLevelsSystem.cs | 15 +++++++++------ 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index 9cb7249e15..af091af4b0 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -49,6 +49,15 @@ namespace Content.IntegrationTests.Tests //CrystallEdge Map replacement "/Maps/_CP14/dev_map.yml", //CrystallEdge Map replacement end + "/Maps/centcomm.yml", + "/Maps/bagel.yml", // Contains mime's rubber stamp --> Either fix this, remove the category, or remove this comment if intentional. + "/Maps/gate.yml", // Contains positronic brain and LSE-1200c "Perforator" + "/Maps/meta.yml", // Contains warden's rubber stamp + "/Maps/reach.yml", // Contains handheld crew monitor + "/Maps/Shuttles/ShuttleEvent/cruiser.yml", // Contains LSE-1200c "Perforator" + "/Maps/Shuttles/ShuttleEvent/honki.yml", // Contains golden honker, clown's rubber stamp + "/Maps/Shuttles/ShuttleEvent/instigator.yml", // Contains EXP-320g "Friendship" + "/Maps/Shuttles/ShuttleEvent/syndie_evacpod.yml", // Contains syndicate rubber stamp }; private static readonly string[] GameMaps = diff --git a/Content.Server/_CP14/Cargo/CP14CargoSystem.cs b/Content.Server/_CP14/Cargo/CP14CargoSystem.cs index 4ad65e20d7..75f3f7a46a 100644 --- a/Content.Server/_CP14/Cargo/CP14CargoSystem.cs +++ b/Content.Server/_CP14/Cargo/CP14CargoSystem.cs @@ -89,20 +89,21 @@ public sealed partial class CP14CargoSystem : CP14SharedCargoSystem if (!Deleted(station.Comp.Shuttle)) return; - if (!_loader.TryLoadMap(station.Comp.ShuttlePath, out var tradepostMap, out var shuttleUids)) + var tradepostMap = _mapManager.CreateMap(); + + if (!_loader.TryLoadGrid(tradepostMap ,station.Comp.ShuttlePath, out var shuttle)) return; - var shuttle = shuttleUids.First(); station.Comp.Shuttle = shuttle; - station.Comp.TradePostMap = _mapManager.GetMapEntityId(tradepostMap.Value.Comp.MapId); + station.Comp.TradePostMap = _mapManager.GetMapEntityId(tradepostMap); var travelingStoreShipComp = EnsureComp(station.Comp.Shuttle.Value); travelingStoreShipComp.Station = station; - var member = EnsureComp(shuttle); + var member = EnsureComp(shuttle.Value); member.Station = station; - var roundRemover = EnsureComp(shuttle); + var roundRemover = EnsureComp(shuttle.Value); roundRemover.Station = station; station.Comp.NextTravelTime = _timing.CurTime + TimeSpan.FromSeconds(10f); diff --git a/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.Echoes.cs b/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.Echoes.cs index e0b759542c..b09a1a6b2c 100644 --- a/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.Echoes.cs +++ b/Content.Server/_CP14/Demiplane/CP14DemiplaneSystem.Echoes.cs @@ -25,7 +25,7 @@ public sealed partial class CP14DemiplaneSystem _chat.TrySendInGameICMessage(exit, ev.Message, InGameICChatType.Whisper, - ChatTransmitRange.NoGhosts, + ChatTransmitRange.HideChat, nameOverride: Loc.GetString("cp14-demiplane-echoes"), hideLog: true); } diff --git a/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.cs b/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.cs index 51ca8bf8a6..e80f9bf21f 100644 --- a/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.cs +++ b/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.cs @@ -67,19 +67,22 @@ public sealed partial class CP14StationZLevelsSystem : EntitySystem continue; } - var mapUid = _map.CreateMap(out var mapId); - var member = EnsureComp(mapUid); - member.Station = ent; + //var mapUid = _map.CreateMap(out var mapId); - Log.Info($"Created map {mapId} for CP14StationZLevelsSystem at level {map}"); if (!_mapLoader.TryLoadMap(level.Path.Value, out var mapEnt, out var grids)) { Log.Error($"Failed to load map for CP14StationZLevelsSystem at level {map}!"); - Del(mapUid); continue; } - ent.Comp.LevelEntities.Add(mapId, map); + + Log.Info($"Created map {mapEnt.Value.Comp.MapId} for CP14StationZLevelsSystem at level {map}"); + + _map.InitializeMap(mapEnt.Value.Comp.MapId); + var member = EnsureComp(mapEnt.Value); + member.Station = ent; + + ent.Comp.LevelEntities.Add(mapEnt.Value.Comp.MapId, map); } }