Add trade stations (#23863)

* puters

* Start on fulfillment

* weh

* Smol update

* FTL sound fixes or smth iunno

* Add consoles

* More tweaks

* Make it unanchorable

* final wehs

* weh

* Fix 1 test

* Shrimply bump the distance

* cat
This commit is contained in:
metalgearsloth
2024-01-19 13:02:28 +11:00
committed by GitHub
parent f69f3e0f41
commit a7388e5c05
17 changed files with 2413 additions and 2188 deletions

View File

@@ -235,6 +235,12 @@ public sealed partial class ShuttleSystem
component.State = FTLState.Starting;
var audio = _audio.PlayPvs(_startupSound, uid);
audio.Value.Component.Flags |= AudioFlags.GridAudio;
if (_physicsQuery.TryGetComponent(uid, out var gridPhysics))
{
_transform.SetLocalPosition(audio.Value.Entity, gridPhysics.LocalCenter);
}
// Make sure the map is setup before we leave to avoid pop-in (e.g. parallax).
SetupHyperspace();
return true;
@@ -260,6 +266,7 @@ public sealed partial class ShuttleSystem
{
// Startup time has elapsed and in hyperspace.
case FTLState.Starting:
{
DoTheDinosaur(xform);
comp.State = FTLState.Travelling;
@@ -268,7 +275,8 @@ public sealed partial class ShuttleSystem
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));
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value),
new Vector2(_index + width / 2f, 0f));
xform.LocalRotation = Angle.Zero;
_index += width + Buffer;
comp.Accumulator += comp.TravelTime - DefaultArrivalTime;
@@ -285,7 +293,9 @@ public sealed partial class ShuttleSystem
SetDockBolts(uid, true);
_console.RefreshShuttleConsoles(uid);
var target = comp.TargetUid != null ? new EntityCoordinates(comp.TargetUid.Value, Vector2.Zero) : comp.TargetCoordinates;
var target = comp.TargetUid != null
? new EntityCoordinates(comp.TargetUid.Value, Vector2.Zero)
: comp.TargetCoordinates;
var ev = new FTLStartedEvent(uid, target, fromMapUid, fromMatrix, fromRotation);
RaiseLocalEvent(uid, ref ev, true);
@@ -293,8 +303,15 @@ public sealed partial class ShuttleSystem
var wowdio = _audio.PlayPvs(comp.TravelSound, uid);
comp.TravelStream = wowdio?.Entity;
if (wowdio?.Component != null)
{
wowdio.Value.Component.Flags |= AudioFlags.GridAudio;
if (_physicsQuery.TryGetComponent(uid, out var gridPhysics))
{
_transform.SetLocalPosition(wowdio.Value.Entity, gridPhysics.LocalCenter);
}
}
}
break;
// Arriving, play effects
case FTLState.Travelling:
@@ -313,6 +330,7 @@ public sealed partial class ShuttleSystem
break;
// Arrived
case FTLState.Arriving:
{
DoTheDinosaur(xform);
SetDockBolts(uid, false);
SetDocks(uid, true);
@@ -383,6 +401,12 @@ public sealed partial class ShuttleSystem
comp.TravelStream = _audio.Stop(comp.TravelStream);
var audio = _audio.PlayPvs(_arrivalSound, uid);
audio.Value.Component.Flags |= AudioFlags.GridAudio;
// TODO: Shitcode til engine fix
if (_physicsQuery.TryGetComponent(uid, out var gridPhysics))
{
_transform.SetLocalPosition(audio.Value.Entity, gridPhysics.LocalCenter);
}
if (TryComp<FTLDestinationComponent>(uid, out var dest))
{
@@ -397,6 +421,7 @@ public sealed partial class ShuttleSystem
var ftlEvent = new FTLCompletedEvent(uid, _mapManager.GetMapEntityId(mapId));
RaiseLocalEvent(uid, ref ftlEvent, true);
}
break;
case FTLState.Cooldown:
RemComp<FTLComponent>(uid);
@@ -711,6 +736,9 @@ public sealed partial class ShuttleSystem
continue;
var aabb = fixture.Shape.ComputeAABB(transform, 0);
// Shift it slightly
aabb = aabb.Translated(-grid.TileSizeHalfVector);
// Create a small border around it.
aabb = aabb.Enlarged(0.2f);
aabbs.Add(aabb);