Turn arrivals into a planetmap (#21777)
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Linq;
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.GameTicking.Events;
|
using Content.Server.GameTicking.Events;
|
||||||
|
using Content.Server.Parallax;
|
||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
using Content.Server.Shuttles.Events;
|
using Content.Server.Shuttles.Events;
|
||||||
using Content.Server.Spawners.Components;
|
using Content.Server.Spawners.Components;
|
||||||
@@ -12,6 +13,8 @@ using Content.Shared.Administration;
|
|||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
|
using Content.Shared.Parallax.Biomes;
|
||||||
|
using Content.Shared.Salvage;
|
||||||
using Content.Shared.Shuttles.Components;
|
using Content.Shared.Shuttles.Components;
|
||||||
using Robust.Shared.Spawners;
|
using Robust.Shared.Spawners;
|
||||||
using Content.Shared.Tiles;
|
using Content.Shared.Tiles;
|
||||||
@@ -20,6 +23,7 @@ using Robust.Shared.Collections;
|
|||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
|
using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
|
||||||
@@ -35,7 +39,9 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||||||
[Dependency] private readonly IConsoleHost _console = default!;
|
[Dependency] private readonly IConsoleHost _console = default!;
|
||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly BiomeSystem _biomes = default!;
|
||||||
[Dependency] private readonly GameTicker _ticker = default!;
|
[Dependency] private readonly GameTicker _ticker = default!;
|
||||||
[Dependency] private readonly MapLoaderSystem _loader = default!;
|
[Dependency] private readonly MapLoaderSystem _loader = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
@@ -48,6 +54,13 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Enabled { get; private set; }
|
public bool Enabled { get; private set; }
|
||||||
|
|
||||||
|
private readonly List<ProtoId<BiomeTemplatePrototype>> _arrivalsBiomeOptions = new()
|
||||||
|
{
|
||||||
|
"Grasslands",
|
||||||
|
"LowDesert",
|
||||||
|
"Snow",
|
||||||
|
};
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -396,6 +409,8 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||||||
private void SetupArrivalsStation()
|
private void SetupArrivalsStation()
|
||||||
{
|
{
|
||||||
var mapId = _mapManager.CreateMap();
|
var mapId = _mapManager.CreateMap();
|
||||||
|
var mapUid = _mapManager.GetMapEntityId(mapId);
|
||||||
|
_mapManager.AddUninitializedMap(mapId);
|
||||||
|
|
||||||
if (!_loader.TryLoad(mapId, _cfgManager.GetCVar(CCVars.ArrivalsMap), out var uids))
|
if (!_loader.TryLoad(mapId, _cfgManager.GetCVar(CCVars.ArrivalsMap), out var uids))
|
||||||
{
|
{
|
||||||
@@ -409,6 +424,18 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||||||
EnsureComp<PreventPilotComponent>(id);
|
EnsureComp<PreventPilotComponent>(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<RestrictedRangeComponent>(mapUid);
|
||||||
|
range.Range = 32f;
|
||||||
|
Dirty(mapUid, range);
|
||||||
|
}
|
||||||
|
|
||||||
|
_mapManager.DoMapInitialize(mapId);
|
||||||
|
|
||||||
// Handle roundstart stations.
|
// Handle roundstart stations.
|
||||||
var query = AllEntityQuery<StationArrivalsComponent>();
|
var query = AllEntityQuery<StationArrivalsComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -1246,6 +1246,12 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<bool> CameraRotationLocked =
|
public static readonly CVarDef<bool> CameraRotationLocked =
|
||||||
CVarDef.Create("shuttle.camera_rotation_locked", false, CVar.REPLICATED);
|
CVarDef.Create("shuttle.camera_rotation_locked", false, CVar.REPLICATED);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the arrivals terminal should be on a planet map.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<bool> ArrivalsPlanet =
|
||||||
|
CVarDef.Create("shuttle.arrivals_planet", true, CVar.SERVERONLY);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the arrivals shuttle is enabled.
|
/// Whether the arrivals shuttle is enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user