Add station anchors (#18697)

This commit is contained in:
Kevin Zheng
2023-08-05 02:24:24 -07:00
committed by GitHub
parent 011fa393ac
commit ba589dbf65
3 changed files with 25 additions and 15 deletions

View File

@@ -236,6 +236,7 @@ public sealed partial class ShuttleSystem
var xform = Transform(uid);
PhysicsComponent? body;
ShuttleComponent? shuttle;
TryComp(uid, out shuttle);
switch (comp.State)
{
@@ -256,7 +257,8 @@ public sealed partial class ShuttleSystem
if (TryComp(uid, out body))
{
Enable(uid, body);
if (shuttle != null)
Enable(uid, body, shuttle);
_physics.SetLinearVelocity(uid, new Vector2(0f, 20f), body: body);
_physics.SetAngularVelocity(uid, 0f, body: body);
_physics.SetLinearDamping(body, 0f);
@@ -283,7 +285,7 @@ public sealed partial class ShuttleSystem
// TODO: Arrival effects
// For now we'll just use the ss13 bubbles but we can do fancier.
if (TryComp(uid, out shuttle))
if (shuttle != null)
{
_thruster.DisableLinearThrusters(shuttle);
_thruster.EnableLinearThrustDirection(shuttle, DirectionFlag.South);
@@ -301,11 +303,13 @@ public sealed partial class ShuttleSystem
{
_physics.SetLinearVelocity(uid, Vector2.Zero, body: body);
_physics.SetAngularVelocity(uid, 0f, body: body);
_physics.SetLinearDamping(body, ShuttleLinearDamping);
_physics.SetAngularDamping(body, ShuttleAngularDamping);
if (shuttle != null)
{
_physics.SetLinearDamping(body, shuttle.LinearDamping);
_physics.SetAngularDamping(body, shuttle.AngularDamping);
}
}
TryComp(uid, out shuttle);
MapId mapId;
if (comp.TargetUid != null && shuttle != null)
@@ -347,9 +351,9 @@ public sealed partial class ShuttleSystem
{
Disable(uid, body);
}
else
else if (shuttle != null)
{
Enable(uid, body);
Enable(uid, body, shuttle);
}
}