[HOTFIX] Movement Rewrite Hotfix Shuttles now respect their friction values (#37154)
* Shuttles now use their proper friction values * Documentation * Shuttles now use their proper friction values * Documentation * What the instrumentsystem doin * what the instrumentsystem doing 2
This commit is contained in:
committed by
GitHub
parent
45253ca79e
commit
61adee05f6
@@ -57,12 +57,16 @@ namespace Content.Server.Shuttles.Components
|
||||
public DirectionFlag ThrustDirections = DirectionFlag.None;
|
||||
|
||||
/// <summary>
|
||||
/// Damping applied to the shuttle's physics component when not in FTL.
|
||||
/// Base damping modifier applied to the shuttle's physics component when not in FTL.
|
||||
/// </summary>
|
||||
[DataField("linearDamping"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float LinearDamping = 0.05f;
|
||||
[DataField]
|
||||
public float BodyModifier = 0.25f;
|
||||
|
||||
[DataField("angularDamping"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float AngularDamping = 0.05f;
|
||||
/// <summary>
|
||||
/// Final Damping Modifier for a shuttle.
|
||||
/// This value is set to 0 during FTL. And to BodyModifier when not in FTL.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float DampingModifier;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,8 +421,6 @@ public sealed partial class ShuttleSystem
|
||||
Enable(uid, component: body);
|
||||
_physics.SetLinearVelocity(uid, new Vector2(0f, 20f), body: body);
|
||||
_physics.SetAngularVelocity(uid, 0f, body: body);
|
||||
_physics.SetLinearDamping(uid, body, 0f);
|
||||
_physics.SetAngularDamping(uid, body, 0f);
|
||||
|
||||
_dockSystem.SetDockBolts(uid, true);
|
||||
_console.RefreshShuttleConsoles(uid);
|
||||
@@ -477,8 +475,6 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
_physics.SetLinearVelocity(uid, Vector2.Zero, body: body);
|
||||
_physics.SetAngularVelocity(uid, 0f, body: body);
|
||||
_physics.SetLinearDamping(uid, body, entity.Comp2.LinearDamping);
|
||||
_physics.SetAngularDamping(uid, body, entity.Comp2.AngularDamping);
|
||||
|
||||
var target = entity.Comp1.TargetCoordinates;
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ using Content.Server.Doors.Systems;
|
||||
using Content.Server.Parallax;
|
||||
using Content.Server.Procedural;
|
||||
using Content.Server.Shuttles.Components;
|
||||
using Content.Server.Shuttles.Events;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Salvage;
|
||||
using Content.Shared.Shuttles.Systems;
|
||||
using Content.Shared.Throwing;
|
||||
@@ -78,6 +80,9 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
|
||||
SubscribeLocalEvent<ShuttleComponent, ComponentStartup>(OnShuttleStartup);
|
||||
SubscribeLocalEvent<ShuttleComponent, ComponentShutdown>(OnShuttleShutdown);
|
||||
SubscribeLocalEvent<ShuttleComponent, TileFrictionEvent>(OnTileFriction);
|
||||
SubscribeLocalEvent<ShuttleComponent, FTLStartedEvent>(OnFTLStarted);
|
||||
SubscribeLocalEvent<ShuttleComponent, FTLCompletedEvent>(OnFTLCompleted);
|
||||
|
||||
SubscribeLocalEvent<GridInitializeEvent>(OnGridInit);
|
||||
SubscribeLocalEvent<FixturesComponent, GridFixtureChangeEvent>(OnGridFixtureChange);
|
||||
@@ -122,6 +127,8 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
{
|
||||
Enable(uid, component: physicsComponent, shuttle: component);
|
||||
}
|
||||
|
||||
component.DampingModifier = component.BodyModifier;
|
||||
}
|
||||
|
||||
public void Toggle(EntityUid uid, ShuttleComponent component)
|
||||
@@ -149,8 +156,6 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
_physics.SetBodyType(uid, BodyType.Dynamic, manager: manager, body: component);
|
||||
_physics.SetBodyStatus(uid, component, BodyStatus.InAir);
|
||||
_physics.SetFixedRotation(uid, false, manager: manager, body: component);
|
||||
_physics.SetLinearDamping(uid, component, shuttle.LinearDamping);
|
||||
_physics.SetAngularDamping(uid, component, shuttle.AngularDamping);
|
||||
}
|
||||
|
||||
public void Disable(EntityUid uid, FixturesComponent? manager = null, PhysicsComponent? component = null)
|
||||
@@ -171,4 +176,19 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
|
||||
Disable(uid);
|
||||
}
|
||||
|
||||
private void OnTileFriction(Entity<ShuttleComponent> ent, ref TileFrictionEvent args)
|
||||
{
|
||||
args.Modifier *= ent.Comp.DampingModifier;
|
||||
}
|
||||
|
||||
private void OnFTLStarted(Entity<ShuttleComponent> ent, ref FTLStartedEvent args)
|
||||
{
|
||||
ent.Comp.DampingModifier = 0f;
|
||||
}
|
||||
|
||||
private void OnFTLCompleted(Entity<ShuttleComponent> ent, ref FTLCompletedEvent args)
|
||||
{
|
||||
ent.Comp.DampingModifier = ent.Comp.BodyModifier;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public struct TileFrictionEvent
|
||||
|
||||
public TileFrictionEvent(float modifier)
|
||||
{
|
||||
// TODO: If something ever uses different angular and linear modifiers, split this into two modifiers
|
||||
Modifier = modifier;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user