Drag limitation

This commit is contained in:
SDraw 2023-04-18 20:32:28 +03:00
parent 9839169cc1
commit 427c346ba2
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
3 changed files with 26 additions and 12 deletions

View file

@ -28,6 +28,7 @@ Optional mod's settings with [BTKUILib](https://github.com/BTK-Development/BTKUI
* Note: Limited according to world's fly multiplier. * Note: Limited according to world's fly multiplier.
* Note: Forcibly set to `1.0` in worlds that don't allow flight. * Note: Forcibly set to `1.0` in worlds that don't allow flight.
* **Movement drag:** movement resistance; `2.0` by default. * **Movement drag:** movement resistance; `2.0` by default.
* Note: Forcibly set to `0.0` in worlds that don't allow flight.
* **Angular movement drag:** angular movement resistance; `2.0` by default. * **Angular movement drag:** angular movement resistance; `2.0` by default.
* **Recover delay:** time delay for enabled `Auto recover` in seconds; `3.0` by default. * **Recover delay:** time delay for enabled `Auto recover` in seconds; `3.0` by default.
* **Reset settings:** resets mod settings to default. * **Reset settings:** resets mod settings to default.

View file

@ -302,6 +302,7 @@ namespace ml_prm
OnGravityChange(Settings.Gravity); OnGravityChange(Settings.Gravity);
OnPhysicsMaterialChange(true); OnPhysicsMaterialChange(true);
OnMovementDragChange(Settings.MovementDrag);
} }
internal void OnCombatDown() internal void OnCombatDown()
@ -336,9 +337,10 @@ namespace ml_prm
{ {
if(m_avatarReady) if(m_avatarReady)
{ {
float l_drag = (Utils.IsWorldSafe() ? p_value : 0f);
foreach(Rigidbody l_body in m_rigidBodies) foreach(Rigidbody l_body in m_rigidBodies)
{ {
l_body.drag = p_value; l_body.drag = l_drag;
if(m_enabled) if(m_enabled)
l_body.WakeUp(); l_body.WakeUp();
} }

View file

@ -190,43 +190,50 @@ namespace ml_prm
{ {
PointersReaction = p_state; PointersReaction = p_state;
PointersReactionChange?.Invoke(p_state); PointersReactionChange?.Invoke(p_state);
} break; }
break;
case ModSetting.IgnoreLocal: case ModSetting.IgnoreLocal:
{ {
IgnoreLocal = p_state; IgnoreLocal = p_state;
IgnoreLocalChange?.Invoke(p_state); IgnoreLocalChange?.Invoke(p_state);
} break; }
break;
case ModSetting.CombatReaction: case ModSetting.CombatReaction:
{ {
CombatReaction = p_state; CombatReaction = p_state;
CombatReactionChange?.Invoke(p_state); CombatReactionChange?.Invoke(p_state);
} break; }
break;
case ModSetting.AutoRecover: case ModSetting.AutoRecover:
{ {
AutoRecover = p_state; AutoRecover = p_state;
AutoRecoverChange?.Invoke(p_state); AutoRecoverChange?.Invoke(p_state);
} break; }
break;
case ModSetting.Slipperiness: case ModSetting.Slipperiness:
{ {
Slipperiness = p_state; Slipperiness = p_state;
SlipperinessChange?.Invoke(p_state); SlipperinessChange?.Invoke(p_state);
} break; }
break;
case ModSetting.Bounciness: case ModSetting.Bounciness:
{ {
Bounciness = p_state; Bounciness = p_state;
BouncinessChange?.Invoke(p_state); BouncinessChange?.Invoke(p_state);
} break; }
break;
case ModSetting.ViewVelocity: case ModSetting.ViewVelocity:
{ {
ViewVelocity = p_state; ViewVelocity = p_state;
ViewVelocityChange?.Invoke(p_state); ViewVelocityChange?.Invoke(p_state);
} break; }
break;
} }
ms_entries[(int)p_setting].BoxedValue = p_state; ms_entries[(int)p_setting].BoxedValue = p_state;
@ -242,25 +249,29 @@ namespace ml_prm
{ {
VelocityMultiplier = p_value; VelocityMultiplier = p_value;
VelocityMultiplierChange?.Invoke(p_value); VelocityMultiplierChange?.Invoke(p_value);
} break; }
break;
case ModSetting.MovementDrag: case ModSetting.MovementDrag:
{ {
MovementDrag = p_value; MovementDrag = p_value;
MovementDragChange?.Invoke(p_value); MovementDragChange?.Invoke(p_value);
} break; }
break;
case ModSetting.AngularDrag: case ModSetting.AngularDrag:
{ {
AngularDrag = p_value; AngularDrag = p_value;
AngularDragChange?.Invoke(p_value); AngularDragChange?.Invoke(p_value);
} break; }
break;
case ModSetting.RecoverDelay: case ModSetting.RecoverDelay:
{ {
RecoverDelay = p_value; RecoverDelay = p_value;
RecoverDelayChange?.Invoke(p_value); RecoverDelayChange?.Invoke(p_value);
} break; }
break;
} }
ms_entries[(int)p_setting].BoxedValue = p_value; ms_entries[(int)p_setting].BoxedValue = p_value;