mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
porting over my cruise control code from frontier with some minor bug fixes. also had to fuck with the passive dampening system because the notsorobust toolbox has hurt its self in confusion Description. redid the port from frontier removing unnecessary complicated and confusing content. replaced hard coded values with cvars patched issues with the passive dampener system causing dampener states to reset added regions to cvar file to make it easier to look threw reverted text so that its more ship based, your not driving a car this is my original work so re-licensed my work under my name rather than frontier blanket who is licensed to use edit agpl3 🆑 - tweak: tweaked friction remover system - fix: fixed inertia dampening system resetting or effecting the wrong grid - remove: Removed overcomplicated alterations Co-authored-by: neuPanda <spainman0@yahoo.com> (cherry picked from commit e389dffcdd74812cfc1c372aff8cbccd74dd24ee)
38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using Robust.Shared.Map.Components;
|
|
using Robust.Shared.Physics;
|
|
using Robust.Shared.Physics.Components;
|
|
using Robust.Shared.Physics.Systems;
|
|
|
|
namespace Content.Shared.Physics;
|
|
|
|
public sealed class FrictionRemoverSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
|
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<PhysicsComponent, PhysicsSleepEvent>(RemoveDampening);
|
|
}
|
|
|
|
|
|
private void RemoveDampening(EntityUid uid, PhysicsComponent component, PhysicsSleepEvent args)
|
|
{
|
|
var linear = 0f;
|
|
var angular = 0f;
|
|
if (TryComp<PassiveDampeningComponent>(uid, out var dampening) && dampening.Enabled)
|
|
{
|
|
// use passive, that said, if its already set, it may have been updated by shuttle console.
|
|
// don't overwrite shuttle console just because you start moving or stop
|
|
// because for some reason when you go from stopped to moving, or moving to stopped this method is called
|
|
linear = component.LinearDamping != 0 ? component.LinearDamping : dampening.LinearDampening;
|
|
angular = component.AngularDamping != 0 ? component.AngularDamping: dampening.AngularDampening;
|
|
}
|
|
|
|
_physics.SetAngularDamping(uid, component, angular, false);
|
|
_physics.SetLinearDamping(uid, component, linear);
|
|
}
|
|
}
|