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: Forcibly set to `1.0` in worlds that don't allow flight.
* **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.
* **Recover delay:** time delay for enabled `Auto recover` in seconds; `3.0` by default.
* **Reset settings:** resets mod settings to default.

View file

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

View file

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