From: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Date: Tue, 13 May 2025 12:14:18 +0000 (-0700) Subject: [HOTFIX] Movement Rewrite Hotfix Shuttles now respect their friction values (#37154) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=61adee05f6e50088ffeb25fdc54da188ae689043;p=space-station-14.git [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 --- diff --git a/Content.Server/Shuttles/Components/ShuttleComponent.cs b/Content.Server/Shuttles/Components/ShuttleComponent.cs index 949d8ea5bb..90ecb6129b 100644 --- a/Content.Server/Shuttles/Components/ShuttleComponent.cs +++ b/Content.Server/Shuttles/Components/ShuttleComponent.cs @@ -57,12 +57,16 @@ namespace Content.Server.Shuttles.Components public DirectionFlag ThrustDirections = DirectionFlag.None; /// - /// 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. /// - [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; + /// + /// Final Damping Modifier for a shuttle. + /// This value is set to 0 during FTL. And to BodyModifier when not in FTL. + /// + [DataField] + public float DampingModifier; } } diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index 40464e516f..fd712142af 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -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; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index f2c58d103c..dadadeb211 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -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(OnShuttleStartup); SubscribeLocalEvent(OnShuttleShutdown); + SubscribeLocalEvent(OnTileFriction); + SubscribeLocalEvent(OnFTLStarted); + SubscribeLocalEvent(OnFTLCompleted); SubscribeLocalEvent(OnGridInit); SubscribeLocalEvent(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 ent, ref TileFrictionEvent args) + { + args.Modifier *= ent.Comp.DampingModifier; + } + + private void OnFTLStarted(Entity ent, ref FTLStartedEvent args) + { + ent.Comp.DampingModifier = 0f; + } + + private void OnFTLCompleted(Entity ent, ref FTLCompletedEvent args) + { + ent.Comp.DampingModifier = ent.Comp.BodyModifier; + } } diff --git a/Content.Shared/Movement/Events/TileFrictionEvent.cs b/Content.Shared/Movement/Events/TileFrictionEvent.cs index e355f21f45..3b6894c0d9 100644 --- a/Content.Shared/Movement/Events/TileFrictionEvent.cs +++ b/Content.Shared/Movement/Events/TileFrictionEvent.cs @@ -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; } }