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 DefaultMinimumFrictionSpeed = 0.005f;
|
||||||
public const float DefaultWeightlessFriction = 1f;
|
public const float DefaultWeightlessFriction = 1f;
|
||||||
public const float DefaultWeightlessFrictionNoInput = 0.2f;
|
public const float DefaultWeightlessFrictionNoInput = 0.2f;
|
||||||
|
public const float DefaultOffGridFriction = 0.05f;
|
||||||
public const float DefaultWeightlessModifier = 0.7f;
|
public const float DefaultWeightlessModifier = 0.7f;
|
||||||
public const float DefaultWeightlessAcceleration = 1f;
|
public const float DefaultWeightlessAcceleration = 1f;
|
||||||
|
|
||||||
@@ -72,6 +73,12 @@ namespace Content.Shared.Movement.Components
|
|||||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
public float WeightlessFrictionNoInput = DefaultWeightlessFrictionNoInput;
|
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>
|
/// <summary>
|
||||||
/// The movement speed modifier applied to a mob's total input velocity when weightless.
|
/// The movement speed modifier applied to a mob's total input velocity when weightless.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -214,7 +214,9 @@ namespace Content.Shared.Movement.Systems
|
|||||||
|
|
||||||
if (weightless)
|
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;
|
friction = moveSpeedComponent?.WeightlessFriction ?? MovementSpeedModifierComponent.DefaultWeightlessFriction;
|
||||||
else
|
else
|
||||||
friction = moveSpeedComponent?.WeightlessFrictionNoInput ?? MovementSpeedModifierComponent.DefaultWeightlessFrictionNoInput;
|
friction = moveSpeedComponent?.WeightlessFrictionNoInput ?? MovementSpeedModifierComponent.DefaultWeightlessFrictionNoInput;
|
||||||
|
|||||||
Reference in New Issue
Block a user