mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-05 03:19:23 +00:00
Notification delay
World ragdoll restriction
This commit is contained in:
parent
9c339f3662
commit
0239ab3057
14 changed files with 501 additions and 414 deletions
44
ml_prm/WorldHandler.cs
Normal file
44
ml_prm/WorldHandler.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Systems.GameEventSystem;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_prm
|
||||
{
|
||||
static class WorldHandler
|
||||
{
|
||||
static bool ms_safeWorld = true;
|
||||
static bool ms_restrictedWorld = false;
|
||||
static float ms_movementLimit = 1f;
|
||||
|
||||
internal static void Init()
|
||||
{
|
||||
CVRGameEventSystem.World.OnLoad.AddListener(OnWorldLoad);
|
||||
}
|
||||
|
||||
internal static void DeInit()
|
||||
{
|
||||
CVRGameEventSystem.World.OnLoad.RemoveListener(OnWorldLoad);
|
||||
}
|
||||
|
||||
static void OnWorldLoad(string p_id)
|
||||
{
|
||||
ms_safeWorld = ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying);
|
||||
ms_movementLimit = 1f;
|
||||
|
||||
GameObject l_restrictObj = GameObject.Find("[RagdollRestriction]");
|
||||
ms_restrictedWorld = ((l_restrictObj == null) ? false : (l_restrictObj.scene.name != "DontDestroyOnLoad"));
|
||||
|
||||
if(CVRWorld.Instance != null)
|
||||
{
|
||||
ms_movementLimit = CVRWorld.Instance.baseMovementSpeed;
|
||||
ms_movementLimit *= CVRWorld.Instance.sprintMultiplier;
|
||||
ms_movementLimit *= CVRWorld.Instance.inAirMovementMultiplier;
|
||||
ms_movementLimit *= CVRWorld.Instance.flyMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsSafeWorld() => ms_safeWorld;
|
||||
public static bool IsRestrictedWorld() => ms_restrictedWorld;
|
||||
public static float GetMovementLimit() => ms_movementLimit;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue