offgrid mob friction (#29383)
* offgrid mob friction * save the world...
This commit is contained in:
@@ -15,6 +15,7 @@ namespace Content.Shared.Movement.Components
|
||||
public const float DefaultMinimumFrictionSpeed = 0.005f;
|
||||
public const float DefaultWeightlessFriction = 1f;
|
||||
public const float DefaultWeightlessFrictionNoInput = 0.2f;
|
||||
public const float DefaultOffGridFriction = 0.05f;
|
||||
public const float DefaultWeightlessModifier = 0.7f;
|
||||
public const float DefaultWeightlessAcceleration = 1f;
|
||||
|
||||
@@ -72,6 +73,12 @@ namespace Content.Shared.Movement.Components
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float WeightlessFrictionNoInput = DefaultWeightlessFrictionNoInput;
|
||||
|
||||
/// <summary>
|
||||
/// The negative velocity applied for friction when weightless and not standing on a grid or mapgrid
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float OffGridFriction = DefaultOffGridFriction;
|
||||
|
||||
/// <summary>
|
||||
/// The movement speed modifier applied to a mob's total input velocity when weightless.
|
||||
/// </summary>
|
||||
|
||||
@@ -214,7 +214,9 @@ namespace Content.Shared.Movement.Systems
|
||||
|
||||
if (weightless)
|
||||
{
|
||||
if (worldTotal != Vector2.Zero && touching)
|
||||
if (gridComp == null && !MapGridQuery.HasComp(xform.GridUid))
|
||||
friction = moveSpeedComponent?.OffGridFriction ?? MovementSpeedModifierComponent.DefaultOffGridFriction;
|
||||
else if (worldTotal != Vector2.Zero && touching)
|
||||
friction = moveSpeedComponent?.WeightlessFriction ?? MovementSpeedModifierComponent.DefaultWeightlessFriction;
|
||||
else
|
||||
friction = moveSpeedComponent?.WeightlessFrictionNoInput ?? MovementSpeedModifierComponent.DefaultWeightlessFrictionNoInput;
|
||||
|
||||
Reference in New Issue
Block a user