mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Linear Damping final fixes (#37987)
* Init Commit * Last commit * Merge conflict resolve * fix test failures --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
parent
1088205d84
commit
82bf785647
6 changed files with 11 additions and 15 deletions
|
|
@ -68,9 +68,6 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||
// Set Move
|
||||
if (TryComp(vapor, out PhysicsComponent? physics))
|
||||
{
|
||||
_physics.SetLinearDamping(vapor, physics, 0f);
|
||||
_physics.SetAngularDamping(vapor, physics, 0f);
|
||||
|
||||
_throwing.TryThrow(vapor, dir, speed, user: user);
|
||||
|
||||
var distance = (target.Position - _transformSystem.GetWorldPosition(vaporXform)).Length();
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public abstract partial class SharedMoverController : VirtualController
|
|||
private float _minDamping;
|
||||
private float _airDamping;
|
||||
private float _offGridDamping;
|
||||
private float _frictionModifier;
|
||||
|
||||
private const LookupFlags _touchingFlags = LookupFlags.Approximate | LookupFlags.Dynamic | LookupFlags.Static;
|
||||
|
||||
|
|
@ -93,6 +94,8 @@ public abstract partial class SharedMoverController : VirtualController
|
|||
|
||||
InitializeInput();
|
||||
InitializeRelay();
|
||||
|
||||
Subs.CVar(_configManager, CCVars.TileFrictionModifier, value => _frictionModifier = value, true);
|
||||
Subs.CVar(_configManager, CCVars.RelativeMovement, value => _relativeMovement = value, true);
|
||||
Subs.CVar(_configManager, CCVars.MinFriction, value => _minDamping = value, true);
|
||||
Subs.CVar(_configManager, CCVars.AirFriction, value => _airDamping = value, true);
|
||||
|
|
@ -233,7 +236,7 @@ public abstract partial class SharedMoverController : VirtualController
|
|||
ContentTileDefinition? tileDef = null;
|
||||
|
||||
var touching = false;
|
||||
// Whether we use tilefriction or not
|
||||
// Should we use tile friction or not?
|
||||
if (weightless || inAirHelpless)
|
||||
{
|
||||
// Find the speed we should be moving at and make sure we're not trying to move faster than that
|
||||
|
|
@ -270,6 +273,7 @@ public abstract partial class SharedMoverController : VirtualController
|
|||
}
|
||||
else
|
||||
{
|
||||
// Should we ignore the friction of the tile we're standing on?
|
||||
if (MapGridQuery.TryComp(xform.GridUid, out var gridComp)
|
||||
&& _mapSystem.TryGetTileRef(xform.GridUid.Value, gridComp, xform.Coordinates, out var tile)
|
||||
&& physicsComponent.BodyStatus == BodyStatus.OnGround)
|
||||
|
|
@ -282,12 +286,12 @@ public abstract partial class SharedMoverController : VirtualController
|
|||
|
||||
if (wishDir != Vector2.Zero)
|
||||
{
|
||||
friction = moveSpeedComponent?.Friction ?? MovementSpeedModifierComponent.DefaultFriction;
|
||||
friction = moveSpeedComponent?.Friction ?? MovementSpeedModifierComponent.DefaultFriction * _frictionModifier;
|
||||
friction *= tileDef?.MobFriction ?? tileDef?.Friction ?? 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
friction = moveSpeedComponent?.FrictionNoInput ?? MovementSpeedModifierComponent.DefaultFrictionNoInput;
|
||||
friction = moveSpeedComponent?.FrictionNoInput ?? MovementSpeedModifierComponent.DefaultFrictionNoInput * _frictionModifier;
|
||||
friction *= tileDef?.Friction ?? 1f;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,9 +215,6 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
|||
_physics.SetBodyStatus(target, targetPhysics, BodyStatus.InAir, false);
|
||||
_physics.SetSleepingAllowed(target, targetPhysics, false);
|
||||
tethered.Tetherer = gunUid;
|
||||
tethered.OriginalAngularDamping = targetPhysics.AngularDamping;
|
||||
_physics.SetAngularDamping(target, targetPhysics, 0f);
|
||||
_physics.SetLinearDamping(target, targetPhysics, 0f);
|
||||
_physics.SetAngularVelocity(target, SpinVelocity, body: targetPhysics);
|
||||
_physics.WakeBody(target, body: targetPhysics);
|
||||
var thrown = EnsureComp<ThrownItemComponent>(component.Tethered.Value);
|
||||
|
|
@ -271,7 +268,6 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
|||
|
||||
_physics.SetBodyStatus(component.Tethered.Value, targetPhysics, BodyStatus.OnGround);
|
||||
_physics.SetSleepingAllowed(component.Tethered.Value, targetPhysics, true);
|
||||
_physics.SetAngularDamping(component.Tethered.Value, targetPhysics, Comp<TetheredComponent>(component.Tethered.Value).OriginalAngularDamping);
|
||||
}
|
||||
|
||||
if (!transfer)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,4 @@ public sealed partial class TetheredComponent : Component
|
|||
{
|
||||
[DataField("tetherer"), AutoNetworkedField]
|
||||
public EntityUid Tetherer;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("originalAngularDamping"), AutoNetworkedField]
|
||||
public float OriginalAngularDamping;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@
|
|||
noRot: true
|
||||
- type: Item
|
||||
- type: Physics
|
||||
angularDamping: 0.02
|
||||
linearDamping: 0.02
|
||||
fixedRotation: true
|
||||
bodyType: Dynamic
|
||||
- type: MovementIgnoreGravity
|
||||
weightless: true
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
fix1:
|
||||
|
|
|
|||
|
|
@ -187,6 +187,8 @@
|
|||
- ItemMask
|
||||
- type: Appearance
|
||||
- type: VaporVisuals
|
||||
- type: TileFrictionModifier
|
||||
modifier: 0
|
||||
|
||||
- type: entity
|
||||
parent: Vapor
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue