Centcom & FTLDestination cleanup (#30226)

* centcomm name and ftlcomp

* networking microopstimization

* go sleep.

* map names and arrivals
This commit is contained in:
IProduceWidgets
2024-08-27 07:28:26 -04:00
committed by GitHub
parent 55771cab74
commit af65af836a
4 changed files with 18 additions and 2 deletions

View File

@@ -52,6 +52,7 @@ public sealed class ArrivalsSystem : EntitySystem
[Dependency] private readonly BiomeSystem _biomes = default!;
[Dependency] private readonly GameTicker _ticker = default!;
[Dependency] private readonly MapLoaderSystem _loader = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly DeviceNetworkSystem _deviceNetworkSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly ShuttleSystem _shuttles = default!;
@@ -497,6 +498,7 @@ public sealed class ArrivalsSystem : EntitySystem
private void SetupArrivalsStation()
{
var mapUid = _mapSystem.CreateMap(out var mapId, false);
_metaData.SetEntityName(mapUid, Loc.GetString("map-name-terminal"));
if (!_loader.TryLoad(mapId, _cfgManager.GetCVar(CCVars.ArrivalsMap), out var uids))
{

View File

@@ -61,6 +61,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
[Dependency] private readonly IdCardSystem _idSystem = default!;
[Dependency] private readonly NavMapSystem _navMap = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
@@ -464,8 +465,9 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
}
component.MapEntity = map;
_metaData.SetEntityName(map, Loc.GetString("map-name-centcomm"));
component.Entity = grid;
_shuttle.TryAddFTLDestination(mapId, false, out _);
_shuttle.TryAddFTLDestination(mapId, true, out _);
Log.Info($"Created centcomm grid {ToPrettyString(grid)} on map {ToPrettyString(map)} for station {ToPrettyString(station)}");
}

View File

@@ -186,6 +186,11 @@ public sealed partial class ShuttleSystem
/// Adds the target map as available for FTL.
/// </summary>
public bool TryAddFTLDestination(MapId mapId, bool enabled, [NotNullWhen(true)] out FTLDestinationComponent? component)
{
return TryAddFTLDestination(mapId, enabled, true, false, out component);
}
public bool TryAddFTLDestination(MapId mapId, bool enabled, bool requireDisk, bool beaconsOnly, [NotNullWhen(true)] out FTLDestinationComponent? component)
{
var mapUid = _mapSystem.GetMapOrInvalid(mapId);
component = null;
@@ -195,10 +200,13 @@ public sealed partial class ShuttleSystem
component = EnsureComp<FTLDestinationComponent>(mapUid);
if (component.Enabled == enabled)
if (component.Enabled == enabled && component.RequireCoordinateDisk == requireDisk && component.BeaconsOnly == beaconsOnly)
return true;
component.Enabled = enabled;
component.RequireCoordinateDisk = requireDisk;
component.BeaconsOnly = beaconsOnly;
_console.RefreshShuttleConsoles();
Dirty(mapUid, component);
return true;

View File

@@ -33,3 +33,7 @@ emergency-shuttle-ui-authorize = AUTHORIZE
emergency-shuttle-ui-repeal = REPEAL
emergency-shuttle-ui-authorizations = Authorizations
emergency-shuttle-ui-remaining = Remaining: {$remaining}
# Map Misc.
map-name-centcomm = Central Command
map-name-terminal = Arrivals Terminal