mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 04:23:04 +00:00
add "dead body sync rate" setting
This commit is contained in:
parent
8d400bfceb
commit
20100a34aa
3 changed files with 26 additions and 0 deletions
|
@ -38,6 +38,8 @@ namespace SanAndreasUnity.Behaviours.Peds
|
|||
{
|
||||
this.PushableByDamage = this.GetComponentOrThrow<PushableByDamage>();
|
||||
this.PushableByDamage.forceMultiplier = PedManager.Instance.ragdollDamageForceWhenDetached;
|
||||
|
||||
this.RefreshSyncRate();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
|
@ -166,5 +168,10 @@ namespace SanAndreasUnity.Behaviours.Peds
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshSyncRate()
|
||||
{
|
||||
this.syncInterval = 1.0f / PedManager.Instance.ragdollSyncRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace SanAndreasUnity.Behaviours
|
|||
public float ragdollDamageForce = 4f;
|
||||
public float ragdollDamageForceWhenDetached = 4f;
|
||||
public CollisionDetectionMode ragdollCollisionDetectionMode = CollisionDetectionMode.Discrete;
|
||||
[Range(1, 60)] public float ragdollSyncRate = 20f;
|
||||
|
||||
|
||||
void Awake ()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using SanAndreasUnity.Behaviours;
|
||||
using SanAndreasUnity.Behaviours.Peds;
|
||||
using SanAndreasUnity.Behaviours.Vehicles;
|
||||
using SanAndreasUnity.UI;
|
||||
using SanAndreasUnity.Utilities;
|
||||
|
@ -14,6 +15,15 @@ namespace SanAndreasUnity.Settings
|
|||
setValue = (value) => { ApplyPedSyncRate(value); },
|
||||
persistType = OptionsWindow.InputPersistType.OnStart
|
||||
};
|
||||
OptionsWindow.FloatInput m_deadBodySyncRate = new OptionsWindow.FloatInput
|
||||
{
|
||||
description = "Dead body sync rate",
|
||||
minValue = 1,
|
||||
maxValue = 60,
|
||||
getValue = () => PedManager.Instance.ragdollSyncRate,
|
||||
setValue = ApplyDeadBodySyncRate,
|
||||
persistType = OptionsWindow.InputPersistType.OnStart,
|
||||
};
|
||||
|
||||
OptionsWindow.FloatInput m_vehicleSyncRate = new OptionsWindow.FloatInput ("Vehicle sync rate", 1, 60) {
|
||||
isAvailable = () => VehicleManager.Instance != null,
|
||||
|
@ -69,6 +79,7 @@ namespace SanAndreasUnity.Settings
|
|||
{
|
||||
OptionsWindow.RegisterInputs ("NET",
|
||||
m_pedSyncRate,
|
||||
m_deadBodySyncRate,
|
||||
m_vehicleSyncRate,
|
||||
m_syncVehicleTransformUsingSyncVars,
|
||||
m_syncVehiclesLinearVelocity,
|
||||
|
@ -86,6 +97,13 @@ namespace SanAndreasUnity.Settings
|
|||
ped.ApplySyncRate(syncRate);
|
||||
}
|
||||
|
||||
static void ApplyDeadBodySyncRate(float syncRate)
|
||||
{
|
||||
PedManager.Instance.ragdollSyncRate = syncRate;
|
||||
foreach (var deadBody in DeadBody.DeadBodies)
|
||||
deadBody.RefreshSyncRate();
|
||||
}
|
||||
|
||||
static void ApplyVehicleSyncRate(float syncRate)
|
||||
{
|
||||
VehicleManager.Instance.vehicleSyncRate = syncRate;
|
||||
|
|
Loading…
Reference in a new issue