Add arrivals (#14755)

* Arrivals

* More arrivals and shitty uhh preload

* cvar

* a

* clockin + maps

* shitter prevention

* Placement

* a

* cvar for tests and dev

* weh
This commit is contained in:
metalgearsloth
2023-03-22 20:29:55 +11:00
committed by GitHub
parent a26b284349
commit f3a06a0696
39 changed files with 9456 additions and 141 deletions

View File

@@ -15,6 +15,7 @@ using System.Diagnostics.CodeAnalysis;
using Content.Server.Shuttles.Events;
using Content.Shared.Buckle.Components;
using Content.Shared.Doors.Components;
using Content.Shared.Shuttles.Components;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
@@ -40,7 +41,6 @@ public sealed partial class ShuttleSystem
private const float DefaultTravelTime = 30f;
private const float DefaultArrivalTime = 5f;
private const float FTLCooldown = 30f;
private const float ShuttleFTLRange = 100f;
/// <summary>
@@ -84,6 +84,12 @@ public sealed partial class ShuttleSystem
public bool CanFTL(EntityUid? uid, [NotNullWhen(false)] out string? reason, TransformComponent? xform = null)
{
if (HasComp<PreventPilotComponent>(uid))
{
reason = Loc.GetString("shuttle-console-prevent");
return false;
}
reason = null;
if (!TryComp<MapGridComponent>(uid, out var grid) ||
@@ -223,6 +229,9 @@ public sealed partial class ShuttleSystem
DoTheDinosaur(xform);
comp.State = FTLState.Travelling;
var fromMapUid = xform.MapUid;
var fromMatrix = _transform.GetWorldMatrix(xform);
var fromRotation = _transform.GetWorldRotation(xform);
var width = Comp<MapGridComponent>(uid).LocalAABB.Width;
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f));
@@ -239,14 +248,16 @@ public sealed partial class ShuttleSystem
_physics.SetAngularDamping(body, 0f);
}
SetDockBolts(uid, true);
_console.RefreshShuttleConsoles(uid);
var ev = new FTLStartedEvent(fromMapUid, fromMatrix, fromRotation);
RaiseLocalEvent(uid, ref ev);
if (comp.TravelSound != null)
{
comp.TravelStream = SoundSystem.Play(comp.TravelSound.GetSound(),
Filter.Pvs(uid, 4f, entityManager: EntityManager), comp.TravelSound.Params);
}
SetDockBolts(uid, true);
_console.RefreshShuttleConsoles(uid);
break;
// Arriving, play effects
case FTLState.Travelling: