From 1538e0677b763249ff439048bb940830b902c1ca Mon Sep 17 00:00:00 2001 From: Zack Backmen Date: Wed, 19 Feb 2025 13:16:54 +0300 Subject: [PATCH] fix upstream --- Content.Client/Viewport/ScalingViewport.cs | 4 +- .../Backmen/Arrivals/CentcommSystem.cs | 68 ++++++++++++------- .../Shipwrecked/ShipwreckedRuleSystem.cs | 6 +- .../Shipyard/Systems/ShipyardSystem.cs | 36 ++-------- .../Backmen/SpecForces/SpecForcesSystem.cs | 9 ++- .../EntityEffects/Effects/HealthChange.cs | 2 +- .../Systems/EmergencyShuttleSystem.cs | 6 +- Content.Shared/Follower/FollowerSystem.cs | 2 +- .../clothing/head/base_clothinghead.ftl | 2 +- .../clothing/head/base_clothinghead.ftl | 2 +- .../Clothing/Head/hardsuit-helmets.yml | 2 +- .../Clothing/Head/hardsuit-helmets.yml | 6 +- .../Clothing/Head/hardsuit-helmets.yml | 12 ++-- .../Entities/Clothing/Head/helmets.yml | 2 +- 14 files changed, 76 insertions(+), 83 deletions(-) diff --git a/Content.Client/Viewport/ScalingViewport.cs b/Content.Client/Viewport/ScalingViewport.cs index ccd9636d776..d9548d0f02b 100644 --- a/Content.Client/Viewport/ScalingViewport.cs +++ b/Content.Client/Viewport/ScalingViewport.cs @@ -144,7 +144,7 @@ protected override void KeyBindUp(GUIBoundKeyEventArgs args) _inputManager.ViewportKeyEvent(this, args); } - protected override void Draw(DrawingHandleScreen handle) + protected override void Draw(IRenderHandle handle) { EnsureViewportCreated(); @@ -170,7 +170,7 @@ protected override void Draw(DrawingHandleScreen handle) var drawBox = GetDrawBox(); var drawBoxGlobal = drawBox.Translated(GlobalPixelPosition); _viewport.RenderScreenOverlaysBelow(handle, this, drawBoxGlobal); - handle.DrawTextureRect(_viewport.RenderTarget.Texture, drawBox); + handle.DrawingHandleScreen.DrawTextureRect(_viewport.RenderTarget.Texture, drawBox); _viewport.RenderScreenOverlaysAbove(handle, this, drawBoxGlobal); } diff --git a/Content.Server/Backmen/Arrivals/CentcommSystem.cs b/Content.Server/Backmen/Arrivals/CentcommSystem.cs index a3f91280a88..86565b9a0f1 100644 --- a/Content.Server/Backmen/Arrivals/CentcommSystem.cs +++ b/Content.Server/Backmen/Arrivals/CentcommSystem.cs @@ -25,11 +25,12 @@ using Content.Shared.Shuttles.Components; using Content.Shared.Whitelist; using Robust.Server.GameObjects; -using Robust.Server.Maps; using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; +using Robust.Shared.EntitySerialization.Systems; using Robust.Shared.Map; +using Robust.Shared.Map.Components; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -56,10 +57,12 @@ public sealed class CentcommSystem : EntitySystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly MapLoaderSystem _loader = default!; + [Dependency] private readonly SharedMapSystem _mapSystem = default!; public EntityUid CentComGrid { get; private set; } = EntityUid.Invalid; public MapId CentComMap { get; private set; } = MapId.Nullspace; - public EntityUid CentComMapUid { get; private set; } = EntityUid.Invalid; + public Entity? CentComMapUid { get; private set; } public float ShuttleIndex { get; set; } = 0; private WeightedRandomPrototype _stationCentComMapPool = default!; @@ -126,9 +129,9 @@ private void OnLoadingMaps(LoadingMapsEvent ev) private void OnCentComEndRound(RoundEndedEvent ev) { - if (CentComMapUid.IsValid() && _shuttleSystem.TryAddFTLDestination(CentComMap, true, out var ftl)) + if (CentComMapUid != null && _shuttleSystem.TryAddFTLDestination(CentComMap, true, out var ftl)) { - EnableFtl((CentComMapUid, ftl)); + EnableFtl((CentComMapUid.Value, ftl)); } } @@ -242,7 +245,7 @@ private void OnCleanup(RoundRestartCleanupEvent ev) _mapManager.DeleteMap(CentComMap); CentComMap = MapId.Nullspace; - CentComMapUid = EntityUid.Invalid; + CentComMapUid = null; ShuttleIndex = 0; } @@ -266,40 +269,52 @@ public void EnsureCentcom(bool force = false) Log.Info("Start load centcom"); - if (CentComMap == MapId.Nullspace) + var mapPickId = _stationCentComMapPool.Pick(_random); + if (!_prototypeManager.TryIndex(mapPickId, out var mapToLoad)) { - CentComMap = _mapManager.CreateMap(); + mapPickId = StationCentComMapDefault; + mapToLoad = _prototypeManager.Index(StationCentComMapDefault); } - CentComMapUid = _mapManager.GetMapEntityId(CentComMap); + if (!_loader.TryLoadMap(mapToLoad.MapPath, out var mapId, out var grids)) + return; + + var grid = grids.FirstOrNull(x=>HasComp(x.Owner)); - var mapId = _stationCentComMapPool.Pick(_random); - if (!_prototypeManager.TryIndex(mapId, out var map)) + if (!Exists(mapId)) { - mapId = StationCentComMapDefault; - map = _prototypeManager.Index(StationCentComMapDefault); + Log.Error($"Failed to set up centcomm map!"); + QueueDel(grid); + return; } + if (!Exists(grid)) + { + Log.Error($"Failed to set up centcomm grid!"); + QueueDel(mapId); + return; + } - var ent = _gameTicker.LoadGameMap( - map, CentComMap, new MapLoadOptions() - { - LoadMap = false - }, "Central Command").FirstOrNull(HasComp); - - _metaDataSystem.SetEntityName(_mapManager.GetMapEntityId(CentComMap), Loc.GetString("map-name-centcomm")); - - if (ent == null) + var xform = Transform(grid.Value); + if (xform.ParentUid != mapId.Value.Owner || xform.MapUid != mapId.Value.Owner) { - Log.Warning("No CentComm map found, skipping setup."); + Log.Error($"Centcomm grid is not parented to its own map?"); + QueueDel(mapId); + QueueDel(grid); return; } - CentComGrid = ent.Value; + + CentComMapUid = mapId; + CentComMap = CentComMapUid.Value.Comp.MapId; + + _metaDataSystem.SetEntityName(CentComMapUid.Value, Loc.GetString("map-name-centcomm")); + + CentComGrid = grid.Value; if (_shuttle.TryAddFTLDestination(CentComMap, true, false, false, out var ftl)) { ftl.RequireCoordinateDisk = false; - DisableFtl((CentComMapUid, ftl)); + DisableFtl((CentComMapUid.Value.Owner, ftl)); } var q = EntityQueryEnumerator(); @@ -357,7 +372,10 @@ private void OnPreGameMapLoad(PreGameMapLoad ev) return; } - ev.Options.Offset = new Vector2(0, 0); + ev.Options.PauseMaps = false; + ev.Options.InitializeMaps = true; + ev.Offset = Vector2.Zero; + ev.Rotation = Angle.Zero; } private void OnFtlActionUsed(EntityUid uid, ActorComponent component, CentcomFtlAction args) diff --git a/Content.Server/Backmen/Shipwrecked/ShipwreckedRuleSystem.cs b/Content.Server/Backmen/Shipwrecked/ShipwreckedRuleSystem.cs index a0d389dd5e0..646e3120848 100644 --- a/Content.Server/Backmen/Shipwrecked/ShipwreckedRuleSystem.cs +++ b/Content.Server/Backmen/Shipwrecked/ShipwreckedRuleSystem.cs @@ -85,10 +85,10 @@ using Content.Shared.Zombies; using Robust.Server.Audio; using Robust.Server.GameObjects; -using Robust.Server.Maps; using Robust.Server.Player; using Robust.Shared.Audio; using Robust.Shared.Configuration; +using Robust.Shared.EntitySerialization; using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Map.Enumerators; @@ -545,8 +545,8 @@ private async void SpawnPlanetaryStructures(EntityUid uid, ShipwreckedRuleCompon private MapId LoadDefaultMap() { - _gameTicker.LoadGameMap(_prototypeManager.Index(DefaultShuttle), _gameTicker.DefaultMap, new MapLoadOptions(), null); - return _gameTicker.DefaultMap; + _gameTicker.LoadGameMap(_prototypeManager.Index(DefaultShuttle), out var mapId); + return mapId; } [ValidatePrototypeId] diff --git a/Content.Server/Backmen/Shipyard/Systems/ShipyardSystem.cs b/Content.Server/Backmen/Shipyard/Systems/ShipyardSystem.cs index c1a965f083a..03198a11658 100644 --- a/Content.Server/Backmen/Shipyard/Systems/ShipyardSystem.cs +++ b/Content.Server/Backmen/Shipyard/Systems/ShipyardSystem.cs @@ -6,7 +6,6 @@ using Content.Shared.Backmen.Shipyard; using Content.Shared.GameTicking; using Robust.Server.GameObjects; -using Robust.Server.Maps; using Robust.Shared.Map; using Content.Shared.Backmen.CCVar; using Robust.Shared.Configuration; @@ -14,7 +13,10 @@ using System.Numerics; using Content.Shared.Backmen.Shipyard.Components; using Content.Shared.Backmen.Shipyard.Prototypes; +using Robust.Shared.EntitySerialization; +using Robust.Shared.EntitySerialization.Systems; using Robust.Shared.Map.Components; +using Robust.Shared.Utility; namespace Content.Server.Backmen.Shipyard.Systems; @@ -121,41 +123,15 @@ private bool TryAddShuttle(string shuttlePath, [NotNullWhen(true)] out EntityUid if (ShipyardMap == null) return false; - var loadOptions = new MapLoadOptions() - { - Offset = new Vector2(500f + _shuttleIndex, 1f) - }; - - if (!_map.TryLoad(ShipyardMap.Value, shuttlePath, out var gridList, loadOptions)) + if (!_map.TryLoadGrid(ShipyardMap.Value, new ResPath(shuttlePath), out var grid, offset: new Vector2(500f + _shuttleIndex, 1f))) { _sawmill.Error($"Unable to spawn shuttle {shuttlePath}"); return false; } - _shuttleIndex += Comp(gridList[0]).LocalAABB.Width + ShuttleSpawnBuffer; - - //only dealing with 1 grid at a time for now, until more is known about multi-grid drifting - if (gridList.Count != 1) - { - if (gridList.Count < 1) - { - _sawmill.Error($"Unable to spawn shuttle {shuttlePath}, no grid found in file"); - } - - if (gridList.Count > 1) - { - _sawmill.Error($"Unable to spawn shuttle {shuttlePath}, too many grids present in file"); - - foreach (var grid in gridList) - { - _mapManager.DeleteGrid(grid); - } - } - - return false; - } + _shuttleIndex += Comp(grid.Value).LocalAABB.Width + ShuttleSpawnBuffer; - shuttleGrid = gridList[0]; + shuttleGrid = grid; return true; } diff --git a/Content.Server/Backmen/SpecForces/SpecForcesSystem.cs b/Content.Server/Backmen/SpecForces/SpecForcesSystem.cs index aab4fc9d519..e1d2e8f92eb 100644 --- a/Content.Server/Backmen/SpecForces/SpecForcesSystem.cs +++ b/Content.Server/Backmen/SpecForces/SpecForcesSystem.cs @@ -1,8 +1,8 @@ using System.Linq; +using System.Numerics; using Content.Server.GameTicking; using Content.Shared.GameTicking; using Robust.Server.GameObjects; -using Robust.Server.Maps; using Robust.Shared.Map; using Robust.Shared.Prototypes; using Content.Server.Spawners.Components; @@ -22,6 +22,8 @@ using Content.Shared.Backmen.CCVar; using Content.Shared.Ghost.Roles.Components; using Robust.Shared.Configuration; +using Robust.Shared.EntitySerialization; +using Robust.Shared.EntitySerialization.Systems; using Robust.Shared.Serialization.Manager; namespace Content.Server.Backmen.SpecForces; @@ -287,10 +289,7 @@ private void SpawnSpecForces(SpecForceTeamPrototype proto, ListGrid's entity of the shuttle. private EntityUid? SpawnShuttle(string shuttlePath) { - var shuttleMap = _mapManager.CreateMap(); - var options = new MapLoadOptions {LoadMap = true}; - - if (!_map.TryLoad(shuttleMap, shuttlePath, out var grids, options)) + if (!_map.TryLoadMap(new ResPath(shuttlePath), out var map, out var grids)) { return null; } diff --git a/Content.Server/EntityEffects/Effects/HealthChange.cs b/Content.Server/EntityEffects/Effects/HealthChange.cs index 3147c2a5b3c..2150e95b639 100644 --- a/Content.Server/EntityEffects/Effects/HealthChange.cs +++ b/Content.Server/EntityEffects/Effects/HealthChange.cs @@ -165,7 +165,7 @@ public override void Effect(EntityEffectBaseArgs args) args.TargetEntity, damageSpec * scale, IgnoreResistances, - interruptsDoAfters: false + interruptsDoAfters: false, // start-backmen: surgery targetPart: TargetBodyPart.All, partMultiplier: 0.5f, diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index 906750650bb..5579cbd6e30 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -399,7 +399,7 @@ public void AnnounceShuttleDock(ShuttleDockResult result, bool extended) // TODO: Need filter extensions or something don't blame me. _audio.PlayGlobal(audioFile, Filter.Broadcast(), true); - _centcommSystem.EnableFtl(_centcommSystem.CentComMapUid); // backmen: centcom + _centcommSystem.EnableFtl(_centcommSystem.CentComMapUid!.Value.Owner); // backmen: centcom } private void OnStationInit(EntityUid uid, StationCentcommComponent component, MapInitEvent args) @@ -521,8 +521,8 @@ public HashSet GetCentcommMaps() { var maps = new HashSet(); - if(_centcommSystem.CentComMapUid.IsValid()) - maps.Add(_centcommSystem.CentComMapUid); + if(_centcommSystem.CentComMapUid != null) + maps.Add(_centcommSystem.CentComMapUid.Value); return maps; } diff --git a/Content.Shared/Follower/FollowerSystem.cs b/Content.Shared/Follower/FollowerSystem.cs index ada2aab0c2d..fee81a582ef 100644 --- a/Content.Shared/Follower/FollowerSystem.cs +++ b/Content.Shared/Follower/FollowerSystem.cs @@ -49,7 +49,7 @@ public override void Initialize() SubscribeLocalEvent(OnBeforeSave); SubscribeLocalEvent(OnFollowedPolymorphed); } - +/* private void OnFollowedGetState(EntityUid uid, FollowedComponent component, ref ComponentGetState args) { component.Following.RemoveWhere(x => TerminatingOrDeleted(x)); diff --git a/Resources/Locale/en-US/ss14-ru/prototypes/entities/clothing/head/base_clothinghead.ftl b/Resources/Locale/en-US/ss14-ru/prototypes/entities/clothing/head/base_clothinghead.ftl index 58d2750436f..d28a8feb800 100644 --- a/Resources/Locale/en-US/ss14-ru/prototypes/entities/clothing/head/base_clothinghead.ftl +++ b/Resources/Locale/en-US/ss14-ru/prototypes/entities/clothing/head/base_clothinghead.ftl @@ -8,7 +8,7 @@ ent-ClothingHeadEVAHelmetBase = base space helmet .desc = { ent-ClothingHeadBase.desc } ent-ClothingHeadHardsuitBase = base hardsuit helmet .desc = { "" } -ent-ClothingHeadHardsuitWithLightBase = base hardsuit helmet with light +ent-ClothingHeadSuitWithLightBase = base hardsuit helmet with light .desc = { ent-ClothingHeadHardsuitBase.desc } ent-ClothingHeadHatHoodWinterBase = base winter coat hood .desc = A hood, made to keep your head warm. diff --git a/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/clothing/head/base_clothinghead.ftl b/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/clothing/head/base_clothinghead.ftl index f3d501afbf3..14d44b627da 100644 --- a/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/clothing/head/base_clothinghead.ftl +++ b/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/clothing/head/base_clothinghead.ftl @@ -8,7 +8,7 @@ ent-ClothingHeadEVAHelmetBase = базовый космический шлем .desc = { ent-ClothingHeadBase.desc } ent-ClothingHeadHardsuitBase = базовый шлем скафандра .desc = { ent-ClothingHeadBase.desc } -ent-ClothingHeadHardsuitWithLightBase = базовый шлем скафандра с фонарём +ent-ClothingHeadSuitWithLightBase = базовый шлем скафандра с фонарём .desc = { ent-ClothingHeadHardsuitBase.desc } ent-ClothingHeadHatHoodWinterBase = базовый капюшон зимней куртки .desc = Капюшон, чтобы держать голову в тепле. diff --git a/Resources/Prototypes/Corvax/Entities/Clothing/Head/hardsuit-helmets.yml b/Resources/Prototypes/Corvax/Entities/Clothing/Head/hardsuit-helmets.yml index 40ac5be328a..d2891b3fb0f 100644 --- a/Resources/Prototypes/Corvax/Entities/Clothing/Head/hardsuit-helmets.yml +++ b/Resources/Prototypes/Corvax/Entities/Clothing/Head/hardsuit-helmets.yml @@ -1,5 +1,5 @@ - type: entity - parent: ClothingHeadHardsuitWithLightBase + parent: ClothingHeadSuitWithLightBase id: ClothingHeadHelmetCBURNLeader categories: [ HideSpawnMenu ] name: cburn commander helmet diff --git a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml index 1fd15bd3c20..7bfba4714ba 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml @@ -269,7 +269,7 @@ #Captain's Hardsuit - type: entity - parent: [ ClothingHeadHardsuitBase, ClothingHeadHardsuitWithLightBase ] #Backmen edit + parent: [ ClothingHeadHardsuitBase, ClothingHeadSuitWithLightBase ] #Backmen edit id: ClothingHeadHelmetHardsuitCap name: captain's hardsuit helmet description: Special hardsuit helmet, made for the captain of the station. @@ -503,7 +503,7 @@ #Cybersun Juggernaut Hardsuit - type: entity - parent: ClothingHeadHardsuitWithLightBase # Corvax-Resprite + parent: ClothingHeadSuitWithLightBase # Corvax-Resprite id: ClothingHeadHelmetHardsuitCybersun name: cybersun juggernaut helmet description: Made of compressed red matter, this helmet was designed in the Tau chromosphere facility. @@ -748,7 +748,7 @@ #Deathsquad Hardsuit - type: entity - parent: [ BaseCentcommContraband, ClothingHeadHardsuitWithLightBase ] # Corvax-Resprite + parent: [ BaseCentcommContraband, ClothingHeadSuitWithLightBase ] # Corvax-Resprite id: ClothingHeadHelmetHardsuitDeathsquad name: deathsquad hardsuit helmet description: A robust helmet for special operations. diff --git a/Resources/Prototypes/_Backmen/Entities/Clothing/Head/hardsuit-helmets.yml b/Resources/Prototypes/_Backmen/Entities/Clothing/Head/hardsuit-helmets.yml index 6a0274ee712..09f753b9554 100644 --- a/Resources/Prototypes/_Backmen/Entities/Clothing/Head/hardsuit-helmets.yml +++ b/Resources/Prototypes/_Backmen/Entities/Clothing/Head/hardsuit-helmets.yml @@ -13,7 +13,7 @@ lowPressureMultiplier: 1000 - type: entity - parent: ClothingHeadHardsuitWithLightBase + parent: ClothingHeadSuitWithLightBase id: ClothingHeadHelmetHardsuitOrden name: Helmet of the space suit of the elite special squad of the Red Order. description: An indispensable part of the suit, it has small scratches. @@ -39,7 +39,7 @@ Radiation: 0.2 - type: entity - parent: ClothingHeadHardsuitWithLightBase + parent: ClothingHeadSuitWithLightBase id: ClothingHeadHelmetHardsuitOrdinaryOrden name: Helmet of the space suit of the Red Order. description: An indispensable part of the suit, it has small scratches. @@ -67,7 +67,7 @@ # carporate hardsuit - type: entity - parent: ClothingHeadHardsuitWithLightBase + parent: ClothingHeadSuitWithLightBase id: ClothingHeadHelmetHardsuitCentcomCarporate name: Шлем скафандра ЦК (Корпорат) description: Специальный космический шлем Корпорат сделаный для различных ситуация с хорошим фанариком лоялиста НаноТрайзен. @@ -109,7 +109,7 @@ - Psionics - type: entity - parent: ClothingHeadHardsuitWithLightBase + parent: ClothingHeadSuitWithLightBase id: ClothingHeadHelmetHardsuitUEG name: Шлем скафандра охраны ОПЗ description: Этот шлем был нагло скопирован с шлема лидера ОБР NanoTrasen @@ -215,7 +215,7 @@ sprite: Backmen/Clothing/Head/Hardsuits/RescueTroopsUnits/dungeonmasterhardsuit.rsi - type: entity - parent: ClothingHeadHardsuitWithLightBase + parent: ClothingHeadSuitWithLightBase id: ClothingHeadHelmetHardsuitSecurityEgov name: marine hardsuit helmet description: A marine helmet designed specifically for combat in space and the harsh far-off worlds. @@ -247,7 +247,7 @@ #Chrono - type: entity - parent: ClothingHeadHardsuitWithLightBase + parent: ClothingHeadSuitWithLightBase id: ClothingHeadHelmetHardsuitChronoLegionnaire name: chrono legionnaire hardsuit helmet description: An advanced and stylish helmet right from the future. Or from the past? diff --git a/Resources/Prototypes/_Backmen/Entities/Clothing/Head/helmets.yml b/Resources/Prototypes/_Backmen/Entities/Clothing/Head/helmets.yml index 449ae3bb8d4..5f2ab8893c2 100644 --- a/Resources/Prototypes/_Backmen/Entities/Clothing/Head/helmets.yml +++ b/Resources/Prototypes/_Backmen/Entities/Clothing/Head/helmets.yml @@ -108,7 +108,7 @@ #Cargo EVA Helmet - type: entity - parent: ClothingHeadHardsuitWithLightBase + parent: ClothingHeadSuitWithLightBase id: ClothingHeadHelmetCargoEVA categories: [ HideSpawnMenu ] name: EVA cargo helmet