Adds the Central Command outpost for Roundend and ERT to spawn at. (#9146)
* Adds Reach II * Updated Reach II to work after refactor * removing old map * Adding the Central Command outpost * Reachii isn't meant to be in here at all. * updated possible error in .yml * updating .yml * Updated CentComm, fixed some issues like lighting. * Imagine if we also docked at centcomm * a Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
5e316afe86
commit
6325a10a43
@@ -20,6 +20,12 @@ public sealed class HyperspaceComponent : Component
|
|||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float Accumulator = 0f;
|
public float Accumulator = 0f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Target Uid to dock with at the end of hyperspace.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite), DataField("targetUid")]
|
||||||
|
public EntityUid? TargetUid;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("targetCoordinates")]
|
[ViewVariables(VVAccess.ReadWrite), DataField("targetCoordinates")]
|
||||||
public EntityCoordinates TargetCoordinates;
|
public EntityCoordinates TargetCoordinates;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Server.Doors.Components;
|
||||||
using Content.Server.Doors.Systems;
|
using Content.Server.Doors.Systems;
|
||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
using Content.Server.Shuttles.Events;
|
using Content.Server.Shuttles.Events;
|
||||||
@@ -322,6 +323,16 @@ namespace Content.Server.Shuttles.Systems
|
|||||||
dockA.DockJoint = joint;
|
dockA.DockJoint = joint;
|
||||||
dockB.DockJoint = joint;
|
dockB.DockJoint = joint;
|
||||||
|
|
||||||
|
if (TryComp<AirlockComponent>(dockA.Owner, out var airlockA))
|
||||||
|
{
|
||||||
|
airlockA.SetBoltsWithAudio(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TryComp<AirlockComponent>(dockB.Owner, out var airlockB))
|
||||||
|
{
|
||||||
|
airlockB.SetBoltsWithAudio(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (TryComp(dockA.Owner, out DoorComponent? doorA))
|
if (TryComp(dockA.Owner, out DoorComponent? doorA))
|
||||||
{
|
{
|
||||||
doorA.ChangeAirtight = false;
|
doorA.ChangeAirtight = false;
|
||||||
@@ -406,6 +417,16 @@ namespace Content.Server.Shuttles.Systems
|
|||||||
if (dock.DockedWith == null)
|
if (dock.DockedWith == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (TryComp<AirlockComponent>(dock.Owner, out var airlockA))
|
||||||
|
{
|
||||||
|
airlockA.SetBoltsWithAudio(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TryComp<AirlockComponent>(dock.DockedWith, out var airlockB))
|
||||||
|
{
|
||||||
|
airlockB.SetBoltsWithAudio(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (TryComp(dock.Owner, out DoorComponent? doorA))
|
if (TryComp(dock.Owner, out DoorComponent? doorA))
|
||||||
{
|
{
|
||||||
doorA.ChangeAirtight = true;
|
doorA.ChangeAirtight = true;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public sealed partial class ShuttleSystem
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// How long after the transit is over to end the round.
|
/// How long after the transit is over to end the round.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly TimeSpan _bufferTime = TimeSpan.FromSeconds(3);
|
private readonly TimeSpan _bufferTime = TimeSpan.FromSeconds(5);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="CCVars.EmergencyShuttleTransitTime"/>
|
/// <see cref="CCVars.EmergencyShuttleTransitTime"/>
|
||||||
@@ -113,13 +113,20 @@ public sealed partial class ShuttleSystem
|
|||||||
{
|
{
|
||||||
if (!TryComp<ShuttleComponent>(comp.EmergencyShuttle, out var shuttle)) continue;
|
if (!TryComp<ShuttleComponent>(comp.EmergencyShuttle, out var shuttle)) continue;
|
||||||
|
|
||||||
// TODO: Add support so Hyperspace will just dock it to Centcomm.
|
if (Deleted(_centcomm))
|
||||||
|
{
|
||||||
|
// TODO: Need to get non-overlapping positions.
|
||||||
Hyperspace(shuttle,
|
Hyperspace(shuttle,
|
||||||
new EntityCoordinates(
|
new EntityCoordinates(
|
||||||
_mapManager.GetMapEntityId(_centcommMap.Value),
|
_mapManager.GetMapEntityId(_centcommMap.Value),
|
||||||
Vector2.One * 1000f), _consoleAccumulator, _transitTime);
|
Vector2.One * 1000f), _consoleAccumulator, _transitTime);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Hyperspace(shuttle,
|
||||||
|
_centcomm.Value, _consoleAccumulator, _transitTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public sealed partial class ShuttleSystem
|
|||||||
[Dependency] private readonly StationSystem _station = default!;
|
[Dependency] private readonly StationSystem _station = default!;
|
||||||
|
|
||||||
private MapId? _centcommMap;
|
private MapId? _centcommMap;
|
||||||
|
private EntityUid? _centcomm;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for multiple shuttle spawn offsets.
|
/// Used for multiple shuttle spawn offsets.
|
||||||
@@ -91,19 +92,20 @@ public sealed partial class ShuttleSystem
|
|||||||
var player = args.SenderSession.AttachedEntity;
|
var player = args.SenderSession.AttachedEntity;
|
||||||
|
|
||||||
if (player == null ||
|
if (player == null ||
|
||||||
!TryComp<StationDataComponent>(_station.GetOwningStation(player.Value), out var stationData)) return;
|
!TryComp<StationDataComponent>(_station.GetOwningStation(player.Value), out var stationData) ||
|
||||||
|
!TryComp<ShuttleComponent>(stationData.EmergencyShuttle, out var shuttle)) return;
|
||||||
|
|
||||||
var config = GetDockingConfig(stationData);
|
var targetGrid = GetLargestGrid(stationData);
|
||||||
|
if (targetGrid == null) return;
|
||||||
|
var config = GetDockingConfig(shuttle, targetGrid.Value);
|
||||||
|
if (config == null) return;
|
||||||
|
|
||||||
if (config != null)
|
|
||||||
{
|
|
||||||
RaiseNetworkEvent(new EmergencyShuttlePositionMessage()
|
RaiseNetworkEvent(new EmergencyShuttlePositionMessage()
|
||||||
{
|
{
|
||||||
StationUid = config.TargetGrid,
|
StationUid = targetGrid,
|
||||||
Position = config.Area,
|
Position = config.Area,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks whether the emergency shuttle can warp to the specified position.
|
/// Checks whether the emergency shuttle can warp to the specified position.
|
||||||
@@ -113,38 +115,23 @@ public sealed partial class ShuttleSystem
|
|||||||
return !grid.Grid.GetLocalTilesIntersecting(area).Any();
|
return !grid.Grid.GetLocalTilesIntersecting(area).Any();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
private DockingConfig? GetDockingConfig(ShuttleComponent component, EntityUid targetGrid)
|
||||||
/// Tries to find the most valid docking config for the station.
|
|
||||||
/// </summary>
|
|
||||||
private DockingConfig? GetDockingConfig(StationDataComponent dataComponent)
|
|
||||||
{
|
{
|
||||||
// Find the largest grid associated with the station, then try all combinations of docks on it with
|
var gridDocks = GetDocks(targetGrid);
|
||||||
// all of them on the shuttle and try to find the most appropriate.
|
|
||||||
if (dataComponent.EmergencyShuttle == null) return null;
|
|
||||||
|
|
||||||
var targetGrid = GetLargestGrid(dataComponent);
|
|
||||||
|
|
||||||
if (targetGrid == null) return null;
|
|
||||||
var gridDocks = GetDocks(targetGrid.Value);
|
|
||||||
|
|
||||||
if (gridDocks.Count <= 0) return null;
|
if (gridDocks.Count <= 0) return null;
|
||||||
|
|
||||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
var targetGridGrid = Comp<IMapGridComponent>(targetGrid.Value);
|
var targetGridGrid = Comp<IMapGridComponent>(targetGrid);
|
||||||
var targetGridXform = xformQuery.GetComponent(targetGrid.Value);
|
var targetGridXform = xformQuery.GetComponent(targetGrid);
|
||||||
var targetGridMatrix = targetGridXform.WorldMatrix;
|
|
||||||
var targetGridAngle = targetGridXform.WorldRotation.Reduced();
|
var targetGridAngle = targetGridXform.WorldRotation.Reduced();
|
||||||
var targetGridRotation = targetGridAngle.ToVec();
|
var targetGridRotation = targetGridAngle.ToVec();
|
||||||
|
|
||||||
var shuttleDocks = GetDocks(dataComponent.EmergencyShuttle.Value);
|
var shuttleDocks = GetDocks(component.Owner);
|
||||||
var shuttleAABB = Comp<IMapGridComponent>(dataComponent.EmergencyShuttle.Value).Grid.LocalAABB;
|
var shuttleAABB = Comp<IMapGridComponent>(component.Owner).Grid.LocalAABB;
|
||||||
|
|
||||||
var validDockConfigs = new List<DockingConfig>();
|
var validDockConfigs = new List<DockingConfig>();
|
||||||
|
SetPilotable(component, false);
|
||||||
if (TryComp<ShuttleComponent>(dataComponent.EmergencyShuttle, out var shuttle))
|
|
||||||
{
|
|
||||||
SetPilotable(shuttle, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shuttleDocks.Count > 0)
|
if (shuttleDocks.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -168,7 +155,7 @@ public sealed partial class ShuttleSystem
|
|||||||
out var targetAngle)) continue;
|
out var targetAngle)) continue;
|
||||||
|
|
||||||
// Can't just use the AABB as we want to get bounds as tight as possible.
|
// Can't just use the AABB as we want to get bounds as tight as possible.
|
||||||
var spawnPosition = new EntityCoordinates(targetGrid.Value, matty.Transform(Vector2.Zero));
|
var spawnPosition = new EntityCoordinates(targetGrid, matty.Transform(Vector2.Zero));
|
||||||
spawnPosition = new EntityCoordinates(targetGridXform.MapUid!.Value, spawnPosition.ToMapPos(EntityManager));
|
spawnPosition = new EntityCoordinates(targetGridXform.MapUid!.Value, spawnPosition.ToMapPos(EntityManager));
|
||||||
|
|
||||||
var dockedBounds = new Box2Rotated(shuttleAABB.Translated(spawnPosition.Position), targetGridAngle, spawnPosition.Position);
|
var dockedBounds = new Box2Rotated(shuttleAABB.Translated(spawnPosition.Position), targetGridAngle, spawnPosition.Position);
|
||||||
@@ -240,7 +227,7 @@ public sealed partial class ShuttleSystem
|
|||||||
.ThenBy(x => Math.Abs(Angle.ShortestDistance(x.Angle.Reduced(), targetGridAngle).Theta)).ToList();
|
.ThenBy(x => Math.Abs(Angle.ShortestDistance(x.Angle.Reduced(), targetGridAngle).Theta)).ToList();
|
||||||
|
|
||||||
var location = validDockConfigs.First();
|
var location = validDockConfigs.First();
|
||||||
location.TargetGrid = targetGrid.Value;
|
location.TargetGrid = targetGrid;
|
||||||
// TODO: Ideally do a hyperspace warpin, just have it run on like a 10 second timer.
|
// TODO: Ideally do a hyperspace warpin, just have it run on like a 10 second timer.
|
||||||
|
|
||||||
return location;
|
return location;
|
||||||
@@ -249,72 +236,33 @@ public sealed partial class ShuttleSystem
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calls the emergency shuttle for the station.
|
/// Calls the emergency shuttle for the station.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stationUid"></param>
|
|
||||||
/// <param name="dryRun">Should we show the debug data and not actually call it.</param>
|
|
||||||
public void CallEmergencyShuttle(EntityUid? stationUid)
|
public void CallEmergencyShuttle(EntityUid? stationUid)
|
||||||
{
|
{
|
||||||
if (!TryComp<StationDataComponent>(stationUid, out var stationData) ||
|
if (!TryComp<StationDataComponent>(stationUid, out var stationData) ||
|
||||||
!TryComp<TransformComponent>(stationData.EmergencyShuttle, out var xform)) return;
|
!TryComp<TransformComponent>(stationData.EmergencyShuttle, out var xform) ||
|
||||||
|
!TryComp<ShuttleComponent>(stationData.EmergencyShuttle, out var shuttle)) return;
|
||||||
|
|
||||||
var config = GetDockingConfig(stationData);
|
var targetGrid = GetLargestGrid(stationData);
|
||||||
|
|
||||||
if (config != null)
|
|
||||||
{
|
|
||||||
// Set position
|
|
||||||
xform.Coordinates = config.Coordinates;
|
|
||||||
xform.WorldRotation = config.Angle;
|
|
||||||
|
|
||||||
// Connect everything
|
|
||||||
foreach (var (dockA, dockB) in config.Docks)
|
|
||||||
{
|
|
||||||
_dockSystem.Dock(dockA, dockB);
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid.Value)} docked with stations");
|
|
||||||
_chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}")), playDefaultSound: false);
|
|
||||||
// TODO: Need filter extensions or something don't blame me.
|
|
||||||
SoundSystem.Play("/Audio/Announcements/shuttle_dock.ogg", Filter.Broadcast());
|
|
||||||
|
|
||||||
// Bolt all the airlocks so they don't stuff around with them.
|
|
||||||
SetDockBolts(stationData.EmergencyShuttle.Value, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var shuttleAABB = Comp<IMapGridComponent>(stationData.EmergencyShuttle.Value).Grid.WorldAABB;
|
|
||||||
Box2? aabb = null;
|
|
||||||
|
|
||||||
// Spawn nearby.
|
|
||||||
foreach (var gridUid in stationData.Grids)
|
|
||||||
{
|
|
||||||
var grid = Comp<IMapGridComponent>(gridUid).Grid;
|
|
||||||
var gridAABB = grid.WorldAABB;
|
|
||||||
aabb = aabb?.Union(gridAABB) ?? gridAABB;
|
|
||||||
}
|
|
||||||
|
|
||||||
// UHH GOOD LUCK
|
// UHH GOOD LUCK
|
||||||
if (aabb == null)
|
if (targetGrid == null)
|
||||||
{
|
{
|
||||||
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid.Value)} unable to dock with station {ToPrettyString(stationUid.Value)}");
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid.Value)} unable to dock with station {ToPrettyString(stationUid.Value)}");
|
||||||
_chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-good-luck"), playDefaultSound: false);
|
_chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-good-luck"), playDefaultSound: false);
|
||||||
// TODO: Need filter extensions or something don't blame me.
|
// TODO: Need filter extensions or something don't blame me.
|
||||||
SoundSystem.Play("/Audio/Misc/notice1.ogg", Filter.Broadcast());
|
SoundSystem.Play("/Audio/Misc/notice1.ogg", Filter.Broadcast());
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var minRadius = MathF.Max(aabb.Value.Width, aabb.Value.Height) + MathF.Max(shuttleAABB.Width, shuttleAABB.Height);
|
if (TryHyperspaceDock(shuttle, targetGrid.Value))
|
||||||
var spawnPos = aabb.Value.Center + _random.NextVector2(minRadius, minRadius + 10f);
|
|
||||||
|
|
||||||
if (TryComp<PhysicsComponent>(stationData.EmergencyShuttle, out var shuttleBody))
|
|
||||||
{
|
{
|
||||||
shuttleBody.LinearVelocity = Vector2.Zero;
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid.Value)} docked with stations");
|
||||||
shuttleBody.AngularVelocity = 0f;
|
_chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}")), playDefaultSound: false);
|
||||||
|
// TODO: Need filter extensions or something don't blame me.
|
||||||
|
SoundSystem.Play("/Audio/Announcements/shuttle_dock.ogg", Filter.Broadcast());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
xform.WorldPosition = spawnPos;
|
{
|
||||||
xform.WorldRotation = _random.NextAngle();
|
|
||||||
|
|
||||||
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid.Value)} unable to find a valid docking port for {ToPrettyString(stationUid.Value)}");
|
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid.Value)} unable to find a valid docking port for {ToPrettyString(stationUid.Value)}");
|
||||||
_chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-nearby"), playDefaultSound: false);
|
_chatSystem.DispatchStationAnnouncement(stationUid.Value, Loc.GetString("emergency-shuttle-nearby"), playDefaultSound: false);
|
||||||
// TODO: Need filter extensions or something don't blame me.
|
// TODO: Need filter extensions or something don't blame me.
|
||||||
@@ -443,9 +391,18 @@ public sealed partial class ShuttleSystem
|
|||||||
_centcommMap = _mapManager.CreateMap();
|
_centcommMap = _mapManager.CreateMap();
|
||||||
_mapManager.SetMapPaused(_centcommMap.Value, true);
|
_mapManager.SetMapPaused(_centcommMap.Value, true);
|
||||||
|
|
||||||
// Load Centcomm, when we get it!
|
// Load Centcomm
|
||||||
// var (_, centcomm) = _loader.LoadBlueprint(_centcommMap.Value, "/Maps/Salvage/saltern.yml", new MapLoadOptions());
|
var centcommPath = _configManager.GetCVar(CCVars.CentcommMap);
|
||||||
// _centcomm = centcomm;
|
|
||||||
|
if (!string.IsNullOrEmpty(centcommPath))
|
||||||
|
{
|
||||||
|
var (_, centcomm) = _loader.LoadBlueprint(_centcommMap.Value, "/Maps/centcomm.yml");
|
||||||
|
_centcomm = centcomm;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_sawmill.Info("No centcomm map found, skipping setup.");
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var comp in EntityQuery<StationDataComponent>(true))
|
foreach (var comp in EntityQuery<StationDataComponent>(true))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Server.Buckle.Components;
|
using Content.Server.Buckle.Components;
|
||||||
using Content.Server.Doors.Components;
|
using Content.Server.Doors.Components;
|
||||||
using Content.Server.Doors.Systems;
|
using Content.Server.Doors.Systems;
|
||||||
@@ -51,20 +52,49 @@ public sealed partial class ShuttleSystem
|
|||||||
float startupTime = DefaultStartupTime,
|
float startupTime = DefaultStartupTime,
|
||||||
float hyperspaceTime = DefaultTravelTime)
|
float hyperspaceTime = DefaultTravelTime)
|
||||||
{
|
{
|
||||||
if (HasComp<HyperspaceComponent>(component.Owner))
|
if (!TrySetupHyperspace(component.Owner, out var hyperspace))
|
||||||
{
|
|
||||||
_sawmill.Warning($"Tried queuing {ToPrettyString(component.Owner)} which already has HyperspaceComponent?");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
SetDocks(component.Owner, false);
|
|
||||||
var hyperspace = AddComp<HyperspaceComponent>(component.Owner);
|
|
||||||
hyperspace.StartupTime = startupTime;
|
hyperspace.StartupTime = startupTime;
|
||||||
hyperspace.TravelTime = hyperspaceTime;
|
hyperspace.TravelTime = hyperspaceTime;
|
||||||
hyperspace.Accumulator = hyperspace.StartupTime;
|
hyperspace.Accumulator = hyperspace.StartupTime;
|
||||||
hyperspace.TargetCoordinates = coordinates;
|
hyperspace.TargetCoordinates = coordinates;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Moves a shuttle from its current position to docked on the target one. Goes through the hyperspace map while the timer is running.
|
||||||
|
/// </summary>
|
||||||
|
public void Hyperspace(ShuttleComponent component,
|
||||||
|
EntityUid target,
|
||||||
|
float startupTime = DefaultStartupTime,
|
||||||
|
float hyperspaceTime = DefaultTravelTime)
|
||||||
|
{
|
||||||
|
if (!TrySetupHyperspace(component.Owner, out var hyperspace))
|
||||||
|
return;
|
||||||
|
|
||||||
|
hyperspace.StartupTime = startupTime;
|
||||||
|
hyperspace.TravelTime = hyperspaceTime;
|
||||||
|
hyperspace.Accumulator = hyperspace.StartupTime;
|
||||||
|
hyperspace.TargetUid = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TrySetupHyperspace(EntityUid uid, [NotNullWhen(true)] out HyperspaceComponent? component)
|
||||||
|
{
|
||||||
|
component = null;
|
||||||
|
|
||||||
|
if (HasComp<HyperspaceComponent>(uid))
|
||||||
|
{
|
||||||
|
_sawmill.Warning($"Tried queuing {ToPrettyString(uid)} which already has HyperspaceComponent?");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Maybe move this to docking instead?
|
||||||
|
SetDocks(uid, false);
|
||||||
|
|
||||||
|
component = AddComp<HyperspaceComponent>(uid);
|
||||||
// TODO: Need BroadcastGrid to not be bad.
|
// TODO: Need BroadcastGrid to not be bad.
|
||||||
SoundSystem.Play(_startupSound.GetSound(), Filter.Pvs(component.Owner, GetSoundRange(component.Owner), entityManager: EntityManager), _startupSound.Params);
|
SoundSystem.Play(_startupSound.GetSound(), Filter.Pvs(component.Owner, GetSoundRange(component.Owner), entityManager: EntityManager), _startupSound.Params);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateHyperspace(float frameTime)
|
private void UpdateHyperspace(float frameTime)
|
||||||
@@ -107,8 +137,8 @@ public sealed partial class ShuttleSystem
|
|||||||
// Arrive.
|
// Arrive.
|
||||||
case HyperspaceState.Travelling:
|
case HyperspaceState.Travelling:
|
||||||
DoTheDinosaur(xform);
|
DoTheDinosaur(xform);
|
||||||
SetDocks(comp.Owner, true);
|
|
||||||
SetDockBolts(comp.Owner, false);
|
SetDockBolts(comp.Owner, false);
|
||||||
|
SetDocks(comp.Owner, true);
|
||||||
|
|
||||||
if (TryComp(comp.Owner, out body))
|
if (TryComp(comp.Owner, out body))
|
||||||
{
|
{
|
||||||
@@ -118,7 +148,15 @@ public sealed partial class ShuttleSystem
|
|||||||
body.AngularDamping = ShuttleIdleAngularDamping;
|
body.AngularDamping = ShuttleIdleAngularDamping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (comp.TargetUid != null && TryComp<ShuttleComponent>(comp.Owner, out var shuttle))
|
||||||
|
{
|
||||||
|
TryHyperspaceDock(shuttle, comp.TargetUid.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
xform.Coordinates = comp.TargetCoordinates;
|
xform.Coordinates = comp.TargetCoordinates;
|
||||||
|
}
|
||||||
|
|
||||||
SoundSystem.Play(_arrivalSound.GetSound(),
|
SoundSystem.Play(_arrivalSound.GetSound(),
|
||||||
Filter.Pvs(comp.Owner, GetSoundRange(comp.Owner), entityManager: EntityManager));
|
Filter.Pvs(comp.Owner, GetSoundRange(comp.Owner), entityManager: EntityManager));
|
||||||
RemComp<HyperspaceComponent>(comp.Owner);
|
RemComp<HyperspaceComponent>(comp.Owner);
|
||||||
@@ -141,11 +179,11 @@ public sealed partial class ShuttleSystem
|
|||||||
|
|
||||||
private void SetDockBolts(EntityUid uid, bool enabled)
|
private void SetDockBolts(EntityUid uid, bool enabled)
|
||||||
{
|
{
|
||||||
foreach (var (dock, door, xform) in EntityQuery<DockingComponent, AirlockComponent, TransformComponent>(true))
|
foreach (var (_, door, xform) in EntityQuery<DockingComponent, AirlockComponent, TransformComponent>(true))
|
||||||
{
|
{
|
||||||
if (xform.ParentUid != uid) continue;
|
if (xform.ParentUid != uid) continue;
|
||||||
|
|
||||||
_doors.TryClose(dock.Owner);
|
_doors.TryClose(door.Owner);
|
||||||
door.SetBoltsWithAudio(enabled);
|
door.SetBoltsWithAudio(enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,4 +247,52 @@ public sealed partial class ShuttleSystem
|
|||||||
toKnock.Add(child.Value);
|
toKnock.Add(child.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool TryHyperspaceDock(ShuttleComponent component, EntityUid targetUid)
|
||||||
|
{
|
||||||
|
if (!TryComp<TransformComponent>(component.Owner, out var xform) ||
|
||||||
|
!TryComp<TransformComponent>(targetUid, out var targetXform)) return false;
|
||||||
|
|
||||||
|
var config = GetDockingConfig(component, targetUid);
|
||||||
|
|
||||||
|
if (config != null)
|
||||||
|
{
|
||||||
|
// Set position
|
||||||
|
xform.Coordinates = config.Coordinates;
|
||||||
|
xform.WorldRotation = config.Angle;
|
||||||
|
|
||||||
|
// Connect everything
|
||||||
|
foreach (var (dockA, dockB) in config.Docks)
|
||||||
|
{
|
||||||
|
_dockSystem.Dock(dockA, dockB);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var shuttleAABB = Comp<IMapGridComponent>(component.Owner).Grid.WorldAABB;
|
||||||
|
Box2? aabb = null;
|
||||||
|
|
||||||
|
// Spawn nearby.
|
||||||
|
foreach (var grid in _mapManager.GetAllMapGrids(targetXform.MapID))
|
||||||
|
{
|
||||||
|
var gridAABB = grid.WorldAABB;
|
||||||
|
aabb = aabb?.Union(gridAABB) ?? gridAABB;
|
||||||
|
}
|
||||||
|
|
||||||
|
aabb ??= new Box2();
|
||||||
|
|
||||||
|
var minRadius = MathF.Max(aabb.Value.Width, aabb.Value.Height) + MathF.Max(shuttleAABB.Width, shuttleAABB.Height);
|
||||||
|
var spawnPos = aabb.Value.Center + _random.NextVector2(minRadius, minRadius + 10f);
|
||||||
|
|
||||||
|
if (TryComp<PhysicsComponent>(component.Owner, out var shuttleBody))
|
||||||
|
{
|
||||||
|
shuttleBody.LinearVelocity = Vector2.Zero;
|
||||||
|
shuttleBody.AngularVelocity = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
xform.WorldPosition = spawnPos;
|
||||||
|
xform.WorldRotation = _random.NextAngle();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Robust.Shared;
|
using Robust.Shared;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Shared.CCVar
|
namespace Content.Shared.CCVar
|
||||||
{
|
{
|
||||||
@@ -934,6 +935,12 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<bool> EmergencyShuttleEnabled =
|
public static readonly CVarDef<bool> EmergencyShuttleEnabled =
|
||||||
CVarDef.Create("shuttle.emergency_enabled", true, CVar.SERVERONLY);
|
CVarDef.Create("shuttle.emergency_enabled", true, CVar.SERVERONLY);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The map to load for centcomm for the emergency shuttle to dock to.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<string> CentcommMap =
|
||||||
|
CVarDef.Create("shuttle.centcomm_map", "/Maps/centcomm.yml", CVar.SERVERONLY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VIEWPORT
|
* VIEWPORT
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ emergency-shuttle-command-dock-desc = Calls the emergency shuttle and docks it t
|
|||||||
emergency-shuttle-command-launch-desc = Early launches the emergency shuttle if possible.
|
emergency-shuttle-command-launch-desc = Early launches the emergency shuttle if possible.
|
||||||
|
|
||||||
# Emergency shuttle
|
# Emergency shuttle
|
||||||
emergency-shuttle-left = The Emergency Shuttle has left the station. Estimate {$transitTime} seconds until the shuttle clears the area.
|
emergency-shuttle-left = The Emergency Shuttle has left the station. Estimate {$transitTime} seconds until the shuttle arives at Centcomm.
|
||||||
emergency-shuttle-launch-time = The emergency shuttle will launch in {$consoleAccumulator} seconds.
|
emergency-shuttle-launch-time = The emergency shuttle will launch in {$consoleAccumulator} seconds.
|
||||||
emergency-shuttle-docked = The Emergency Shuttle has docked with the station. It will leave in {$time} seconds.
|
emergency-shuttle-docked = The Emergency Shuttle has docked with the station. It will leave in {$time} seconds.
|
||||||
emergency-shuttle-good-luck = The Emergency Shuttle is unable to find a station. Good luck.
|
emergency-shuttle-good-luck = The Emergency Shuttle is unable to find a station. Good luck.
|
||||||
|
|||||||
29004
Resources/Maps/centcomm.yml
Normal file
29004
Resources/Maps/centcomm.yml
Normal file
File diff suppressed because it is too large
Load Diff
15
Resources/Prototypes/Maps/centcomm.yml
Normal file
15
Resources/Prototypes/Maps/centcomm.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
- type: gameMap
|
||||||
|
id: centcomm
|
||||||
|
mapName: 'Central Command'
|
||||||
|
mapPath: /Maps/centcomm.yml
|
||||||
|
minPlayers: 10
|
||||||
|
stations:
|
||||||
|
centcomm:
|
||||||
|
mapNameTemplate: '{0} Central Command {1}'
|
||||||
|
nameGenerator:
|
||||||
|
!type:NanotrasenNameGenerator
|
||||||
|
prefixCreator: 'TG'
|
||||||
|
overflowJobs:
|
||||||
|
- Passenger
|
||||||
|
availableJobs:
|
||||||
|
Passenger: [ 0, 1 ]
|
||||||
Reference in New Issue
Block a user