Tweak shuttle movement (#6468)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Radrark
2022-03-07 02:03:53 -03:00
committed by GitHub
parent 19136505d9
commit 401ccfba0a
7 changed files with 126 additions and 44 deletions

View File

@@ -118,7 +118,7 @@ namespace Content.Server.Shuttles.EntitySystems
foreach (var ent in _mapManager.GetGrid(e.NewTile.GridIndex).GetAnchoredEntities(checkPos))
{
if (!EntityManager.TryGetComponent(ent, out ThrusterComponent? thruster) || thruster.Type == ThrusterType.Angular) continue;
if (!EntityManager.TryGetComponent(ent, out ThrusterComponent? thruster) || !thruster.RequireSpace) continue;
// Work out if the thruster is facing this direction
var direction = EntityManager.GetComponent<TransformComponent>(ent).LocalRotation.ToWorldVec();
@@ -174,11 +174,11 @@ namespace Content.Server.Shuttles.EntitySystems
var oldDirection = (int) args.OldRotation.GetCardinalDir() / 2;
var direction = (int) args.NewRotation.GetCardinalDir() / 2;
shuttleComponent.LinearThrusterImpulse[oldDirection] -= component.Impulse;
shuttleComponent.LinearThrust[oldDirection] -= component.Thrust;
DebugTools.Assert(shuttleComponent.LinearThrusters[oldDirection].Contains(component));
shuttleComponent.LinearThrusters[oldDirection].Remove(component);
shuttleComponent.LinearThrusterImpulse[direction] += component.Impulse;
shuttleComponent.LinearThrust[direction] += component.Thrust;
DebugTools.Assert(!shuttleComponent.LinearThrusters[direction].Contains(component));
shuttleComponent.LinearThrusters[direction].Add(component);
}
@@ -247,7 +247,7 @@ namespace Content.Server.Shuttles.EntitySystems
case ThrusterType.Linear:
var direction = (int) xform.LocalRotation.GetCardinalDir() / 2;
shuttleComponent.LinearThrusterImpulse[direction] += component.Impulse;
shuttleComponent.LinearThrust[direction] += component.Thrust;
DebugTools.Assert(!shuttleComponent.LinearThrusters[direction].Contains(component));
shuttleComponent.LinearThrusters[direction].Add(component);
@@ -271,7 +271,7 @@ namespace Content.Server.Shuttles.EntitySystems
break;
case ThrusterType.Angular:
shuttleComponent.AngularThrust += component.Impulse;
shuttleComponent.AngularThrust += component.Thrust;
DebugTools.Assert(!shuttleComponent.AngularThrusters.Contains(component));
shuttleComponent.AngularThrusters.Add(component);
break;
@@ -313,12 +313,12 @@ namespace Content.Server.Shuttles.EntitySystems
angle ??= xform.LocalRotation;
var direction = (int) angle.Value.GetCardinalDir() / 2;
shuttleComponent.LinearThrusterImpulse[direction] -= component.Impulse;
shuttleComponent.LinearThrust[direction] -= component.Thrust;
DebugTools.Assert(shuttleComponent.LinearThrusters[direction].Contains(component));
shuttleComponent.LinearThrusters[direction].Remove(component);
break;
case ThrusterType.Angular:
shuttleComponent.AngularThrust -= component.Impulse;
shuttleComponent.AngularThrust -= component.Thrust;
DebugTools.Assert(shuttleComponent.AngularThrusters.Contains(component));
shuttleComponent.AngularThrusters.Remove(component);
break;
@@ -359,7 +359,7 @@ namespace Content.Server.Shuttles.EntitySystems
return false;
}
if (component.Type == ThrusterType.Angular)
if (!component.RequireSpace)
return true;
return NozzleExposed(xform);