diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 19779c5cfe..53ede9b924 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -2,6 +2,7 @@ using System.Linq; using Content.Server.Administration; using Content.Server.GameTicking; using Content.Server.GameTicking.Events; +using Content.Server.Parallax; using Content.Server.Shuttles.Components; using Content.Server.Shuttles.Events; using Content.Server.Spawners.Components; @@ -12,6 +13,8 @@ using Content.Shared.Administration; using Content.Shared.CCVar; using Content.Shared.Mobs.Components; using Content.Shared.Movement.Components; +using Content.Shared.Parallax.Biomes; +using Content.Shared.Salvage; using Content.Shared.Shuttles.Components; using Robust.Shared.Spawners; using Content.Shared.Tiles; @@ -20,6 +23,7 @@ using Robust.Shared.Collections; using Robust.Shared.Configuration; using Robust.Shared.Console; using Robust.Shared.Map; +using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent; @@ -35,7 +39,9 @@ public sealed class ArrivalsSystem : EntitySystem [Dependency] private readonly IConsoleHost _console = default!; [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly BiomeSystem _biomes = default!; [Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly MapLoaderSystem _loader = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; @@ -48,6 +54,13 @@ public sealed class ArrivalsSystem : EntitySystem /// public bool Enabled { get; private set; } + private readonly List> _arrivalsBiomeOptions = new() + { + "Grasslands", + "LowDesert", + "Snow", + }; + public override void Initialize() { base.Initialize(); @@ -396,6 +409,8 @@ public sealed class ArrivalsSystem : EntitySystem private void SetupArrivalsStation() { var mapId = _mapManager.CreateMap(); + var mapUid = _mapManager.GetMapEntityId(mapId); + _mapManager.AddUninitializedMap(mapId); if (!_loader.TryLoad(mapId, _cfgManager.GetCVar(CCVars.ArrivalsMap), out var uids)) { @@ -409,6 +424,18 @@ public sealed class ArrivalsSystem : EntitySystem EnsureComp(id); } + // Setup planet arrivals if relevant + if (_cfgManager.GetCVar(CCVars.ArrivalsPlanet)) + { + var template = _random.Pick(_arrivalsBiomeOptions); + _biomes.EnsurePlanet(mapUid, _protoManager.Index(template)); + var range = AddComp(mapUid); + range.Range = 32f; + Dirty(mapUid, range); + } + + _mapManager.DoMapInitialize(mapId); + // Handle roundstart stations. var query = AllEntityQuery(); diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 32855652c9..4a6ee046a2 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1246,6 +1246,12 @@ namespace Content.Shared.CCVar public static readonly CVarDef CameraRotationLocked = CVarDef.Create("shuttle.camera_rotation_locked", false, CVar.REPLICATED); + /// + /// Whether the arrivals terminal should be on a planet map. + /// + public static readonly CVarDef ArrivalsPlanet = + CVarDef.Create("shuttle.arrivals_planet", true, CVar.SERVERONLY); + /// /// Whether the arrivals shuttle is enabled. ///