Notification delay

World ragdoll restriction
This commit is contained in:
SDraw 2024-07-06 13:26:00 +03:00
parent 9c339f3662
commit 0239ab3057
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
14 changed files with 501 additions and 414 deletions

44
ml_prm/WorldHandler.cs Normal file
View 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;
}
}