From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
Date: Fri, 9 Aug 2024 04:52:25 +0000 (-0400)
Subject: offgrid mob friction (#29383)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=2528231ad194cbb973942a8e6ad5cae70e1c1ab4;p=space-station-14.git
offgrid mob friction (#29383)
* offgrid mob friction
* save the world...
---
diff --git a/Content.Shared/Movement/Components/MovementSpeedModifierComponent.cs b/Content.Shared/Movement/Components/MovementSpeedModifierComponent.cs
index a0feab7052..02a8538531 100644
--- a/Content.Shared/Movement/Components/MovementSpeedModifierComponent.cs
+++ b/Content.Shared/Movement/Components/MovementSpeedModifierComponent.cs
@@ -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;
+ ///
+ /// The negative velocity applied for friction when weightless and not standing on a grid or mapgrid
+ ///
+ [ViewVariables(VVAccess.ReadWrite), DataField]
+ public float OffGridFriction = DefaultOffGridFriction;
+
///
/// The movement speed modifier applied to a mob's total input velocity when weightless.
///
diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs
index 1f64717823..c41db21b01 100644
--- a/Content.Shared/Movement/Systems/SharedMoverController.cs
+++ b/Content.Shared/Movement/Systems/SharedMoverController.cs
@@ -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;