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

View file

@ -1,25 +1,25 @@
Merged set of MelonLoader mods for ChilloutVR. Merged set of MelonLoader mods for ChilloutVR.
**Table for game build 2023r175:** **Table for game build 2023r175:**
| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | | Full name | Short name | Latest version |
|:---------:|:----------:|:--------------:| :----------------------------------------------------------------| |:---------:|:----------:|:--------------:| :----------------------------------------------------------------|
| [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | 1.4.0 [:arrow_down:](../../releases/latest/download/ml_amt.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | 1.4.0 [:arrow_down:](../../releases/latest/download/ml_amt.dll)|
| [Avatar Synced Look](/ml_asl/README.md) | ml_asl | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_asl.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Avatar Synced Look](/ml_asl/README.md) | ml_asl | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_asl.dll)|
| [Better Fingers Tracking](/ml_bft/README.md) | ml_bft | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_bft.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Better Fingers Tracking](/ml_bft/README.md) | ml_bft | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_bft.dll)|
| [Desktop Head Tracking](/ml_dht/README.md) | ml_dht | 1.2.4 [:arrow_down:](../../releases/latest/download/ml_dht.dll) |<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Desktop Head Tracking](/ml_dht/README.md) | ml_dht | 1.2.4 [:arrow_down:](../../releases/latest/download/ml_dht.dll)|
| [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.5.1 [:arrow_down:](../../releases/latest/download/ml_lme.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.5.1 [:arrow_down:](../../releases/latest/download/ml_lme.dll)|
| [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.1.3 [:arrow_down:](../../releases/latest/download/ml_pam.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.1.3 [:arrow_down:](../../releases/latest/download/ml_pam.dll)|
| [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.8 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.8 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)|
| [Player Ragdoll Mod](/ml_prm/README.md) | ml_prm | 1.1.6 [:arrow_down:](../../releases/latest/download/ml_prm.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Player Ragdoll Mod](/ml_prm/README.md) | ml_prm | 1.1.7 [:arrow_down:](../../releases/latest/download/ml_prm.dll)|
| [Players Instance Notifier](/ml_pin/README.md) | ml_pin | 1.0.5 [:arrow_down:](../../releases/latest/download/ml_ml_pin.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Players Instance Notifier](/ml_pin/README.md) | ml_pin | 1.0.7 [:arrow_down:](../../releases/latest/download/ml_ml_pin.dll)|
| [Vive Extended Input](/ml_vei/README.md) | ml_vei | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_vei.dll)|<ul><li>- [x] Published</li><li>- [x] Update review</li></ul>| | [Vive Extended Input](/ml_vei/README.md) | ml_vei | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_vei.dll)|
**Archived mods:** **Archived mods:**
| Full name | Short name | Notes | | Full name | Short name | Notes |
|:---------:|:----------:|-------| |:---------:|:----------:|-------|
| Avatar Change Info | ml_aci | Superseded by `Extended Game Notifications` | | Avatar Change Info | ml_aci | Superseded by `Extended Game Notifications` |
| Desktop Reticle Switch | ml_drs | Boring functionality | | Desktop Reticle Switch | ml_drs | Boring functionality |
| Extended Game Notifications | ml_egn | In-game feature since 2023r172 update | | Extended Game Notifications | ml_egn | In-game feature since 2023r172 update |
| Four Point Tracking | ml_fpt | In-game feature since 2022r170 update | | Four Point Tracking | ml_fpt | In-game feature since 2022r170 update |
| Game Main Fixes | ml_gmf | In-game feature since 2023r172 update | | Game Main Fixes | ml_gmf | In-game feature since 2023r172 update |
| Server Connection Info | ml_sci | Superseded by `Extended Game Notifications` | Server Connection Info | ml_sci | Superseded by `Extended Game Notifications`

View file

@ -1,4 +1,4 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_pin.PlayersInstanceNotifier), "PlayersInstanceNotifier", "1.0.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonInfo(typeof(ml_pin.PlayersInstanceNotifier), "PlayersInstanceNotifier", "1.0.7", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]

View file

@ -1,28 +1,29 @@
# Players Instance Notifier # Players Instance Notifier
This mod implements sound notifications for players joining and leaving. This mod implements sound notifications for players joining and leaving.
This can be considered as attempt of [JoinNotifier](https://github.com/knah/VRCMods/tree/master/JoinNotifier) revival. This can be considered as attempt of [JoinNotifier](https://github.com/knah/VRCMods/tree/master/JoinNotifier) revival.
# Installation # Installation
* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader) * Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader)
* Get [latest release DLL](../../../releases/latest): * Get [latest release DLL](../../../releases/latest):
* Put `ml_pin.dll` in `Mods` folder of game * Put `ml_pin.dll` in `Mods` folder of game
# Usage # Usage
Available mod's settings in `Settings - Audio - Players Instance Notifier`: Available mod's settings in `Settings - Audio - Players Instance Notifier`:
* **Notify of:** players notification filter type, available filters: `None`, `Friends`, `All`; `All` by default. * **Notify of:** players notification filter type, available filters: `None`, `Friends`, `All`; `All` by default.
* **Mixed volume:** volume of notifications; `100` by default. * **Mixed volume:** volume of notifications; `100` by default.
* Note: Respects game's interface volume setting and mixes with it accordingly. * Note: Respects game's interface volume setting and mixes with it accordingly.
* **Notify in public instances:** notifies in `Public` instances; `true` by default. * **Delay between notifications:** prevents notification until previous one is finished; `true` by default.
* **Notify in friends instances:** notifies in `Friends of friends` and `Friends` instances; `true` by default. * **Notify in public instances:** notifies in `Public` instances; `true` by default.
* **Notify in private instances:** notifies in `Everyone can invite` and `Owner must invite` instances; `true` by default. * **Notify in friends instances:** notifies in `Friends of friends` and `Friends` instances; `true` by default.
* **Always notify of friends:** notifies friends join/leave no matter what; `false` by default. * **Notify in private instances:** notifies in `Everyone can invite` and `Owner must invite` instances; `true` by default.
* **Always notify of friends:** notifies friends join/leave no matter what; `false` by default.
# Custom notification sounds
You can setup your own notification sounds. # Custom notification sounds
Go to `<game_folder>/UserData/PlayersInstanceNotifier` and replace to your preferable sounds. You can setup your own notification sounds.
Go to `<game_folder>/UserData/PlayersInstanceNotifier` and replace to your preferable sounds.
Available sounds for replacement:
* **player_join.wav** Available sounds for replacement:
* **player_leave.wav** * **player_join.wav**
* **friend_join.wav** * **player_leave.wav**
* **friend_leave.wav** * **friend_join.wav**
* **friend_leave.wav**

View file

@ -1,195 +1,207 @@
using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.InteractionSystem;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace ml_pin namespace ml_pin
{ {
static class Settings static class Settings
{ {
internal class SettingEvent<T> internal class SettingEvent<T>
{ {
event Action<T> m_action; event Action<T> m_action;
public void AddHandler(Action<T> p_listener) => m_action += p_listener; public void AddHandler(Action<T> p_listener) => m_action += p_listener;
public void RemoveHandler(Action<T> p_listener) => m_action -= p_listener; public void RemoveHandler(Action<T> p_listener) => m_action -= p_listener;
public void Invoke(T p_value) => m_action?.Invoke(p_value); public void Invoke(T p_value) => m_action?.Invoke(p_value);
} }
public enum NotificationType public enum NotificationType
{ {
None = 0, None = 0,
Friends, Friends,
All All
}; };
enum ModSetting enum ModSetting
{ {
NotifyType, NotifyType,
Volume, Volume,
NotifyInPublic, Delay,
NotifyInFriends, NotifyInPublic,
NotifyInPrivate, NotifyInFriends,
FriendsAlways NotifyInPrivate,
}; FriendsAlways
};
public static NotificationType NotifyType { get; private set; } = NotificationType.All;
public static float Volume { get; private set; } = 1.0f; public static NotificationType NotifyType { get; private set; } = NotificationType.All;
public static bool NotifyInPublic { get; private set; } = true; public static float Volume { get; private set; } = 1.0f;
public static bool NotifyInFriends { get; private set; } = true; public static bool Delay { get; private set; } = true;
public static bool NotifyInPrivate { get; private set; } = true; public static bool NotifyInPublic { get; private set; } = true;
public static bool FriendsAlways { get; private set; } = false; public static bool NotifyInFriends { get; private set; } = true;
public static bool NotifyInPrivate { get; private set; } = true;
static MelonLoader.MelonPreferences_Category ms_category = null; public static bool FriendsAlways { get; private set; } = false;
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
static MelonLoader.MelonPreferences_Category ms_category = null;
public static readonly SettingEvent<NotificationType> OnNotifyTypeChanged = new SettingEvent<NotificationType>(); static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
public static readonly SettingEvent<float> OnVolumeChanged = new SettingEvent<float>();
public static readonly SettingEvent<bool> OnNotifyInPublicChanged = new SettingEvent<bool>(); public static readonly SettingEvent<NotificationType> OnNotifyTypeChanged = new SettingEvent<NotificationType>();
public static readonly SettingEvent<bool> OnNotifyInFriendsChanged = new SettingEvent<bool>(); public static readonly SettingEvent<float> OnVolumeChanged = new SettingEvent<float>();
public static readonly SettingEvent<bool> OnNotifyInPrivateChanged = new SettingEvent<bool>(); public static readonly SettingEvent<bool> OnDelayChange = new SettingEvent<bool>();
public static readonly SettingEvent<bool> OnFriendsAlwaysChanged = new SettingEvent<bool>(); public static readonly SettingEvent<bool> OnNotifyInPublicChanged = new SettingEvent<bool>();
public static readonly SettingEvent<bool> OnNotifyInFriendsChanged = new SettingEvent<bool>();
internal static void Init() public static readonly SettingEvent<bool> OnNotifyInPrivateChanged = new SettingEvent<bool>();
{ public static readonly SettingEvent<bool> OnFriendsAlwaysChanged = new SettingEvent<bool>();
ms_category = MelonLoader.MelonPreferences.CreateCategory("PIN", null, true);
internal static void Init()
ms_entries = new List<MelonLoader.MelonPreferences_Entry>() {
{ ms_category = MelonLoader.MelonPreferences.CreateCategory("PIN", null, true);
ms_category.CreateEntry(ModSetting.NotifyType.ToString(), (int)NotifyType),
ms_category.CreateEntry(ModSetting.Volume.ToString(), (int)(Volume * 100f)), ms_entries = new List<MelonLoader.MelonPreferences_Entry>()
ms_category.CreateEntry(ModSetting.NotifyInPublic.ToString(), NotifyInPublic), {
ms_category.CreateEntry(ModSetting.NotifyInFriends.ToString(), NotifyInFriends), ms_category.CreateEntry(ModSetting.NotifyType.ToString(), (int)NotifyType),
ms_category.CreateEntry(ModSetting.NotifyInPrivate.ToString(), NotifyInPrivate), ms_category.CreateEntry(ModSetting.Volume.ToString(), (int)(Volume * 100f)),
ms_category.CreateEntry(ModSetting.FriendsAlways.ToString(), FriendsAlways), ms_category.CreateEntry(ModSetting.Delay.ToString(), Delay),
}; ms_category.CreateEntry(ModSetting.NotifyInPublic.ToString(), NotifyInPublic),
ms_category.CreateEntry(ModSetting.NotifyInFriends.ToString(), NotifyInFriends),
NotifyType = (NotificationType)(int)ms_entries[(int)ModSetting.NotifyType].BoxedValue; ms_category.CreateEntry(ModSetting.NotifyInPrivate.ToString(), NotifyInPrivate),
Volume = (int)ms_entries[(int)ModSetting.Volume].BoxedValue * 0.01f; ms_category.CreateEntry(ModSetting.FriendsAlways.ToString(), FriendsAlways),
NotifyInPublic = (bool)ms_entries[(int)ModSetting.NotifyInPublic].BoxedValue; };
NotifyInFriends = (bool)ms_entries[(int)ModSetting.NotifyInFriends].BoxedValue;
NotifyInPrivate = (bool)ms_entries[(int)ModSetting.NotifyInPrivate].BoxedValue; NotifyType = (NotificationType)(int)ms_entries[(int)ModSetting.NotifyType].BoxedValue;
FriendsAlways = (bool)ms_entries[(int)ModSetting.FriendsAlways].BoxedValue; Volume = (int)ms_entries[(int)ModSetting.Volume].BoxedValue * 0.01f;
Delay = (bool)ms_entries[(int)ModSetting.Delay].BoxedValue;
MelonLoader.MelonCoroutines.Start(WaitMainMenuUi()); NotifyInPublic = (bool)ms_entries[(int)ModSetting.NotifyInPublic].BoxedValue;
} NotifyInFriends = (bool)ms_entries[(int)ModSetting.NotifyInFriends].BoxedValue;
NotifyInPrivate = (bool)ms_entries[(int)ModSetting.NotifyInPrivate].BoxedValue;
static System.Collections.IEnumerator WaitMainMenuUi() FriendsAlways = (bool)ms_entries[(int)ModSetting.FriendsAlways].BoxedValue;
{
while(ViewManager.Instance == null) MelonLoader.MelonCoroutines.Start(WaitMainMenuUi());
yield return null; }
while(ViewManager.Instance.gameMenuView == null)
yield return null; static System.Collections.IEnumerator WaitMainMenuUi()
while(ViewManager.Instance.gameMenuView.Listener == null) {
yield return null; while(ViewManager.Instance == null)
yield return null;
ViewManager.Instance.gameMenuView.Listener.ReadyForBindings += () => while(ViewManager.Instance.gameMenuView == null)
{ yield return null;
ViewManager.Instance.gameMenuView.View.BindCall("OnToggleUpdate_" + ms_category.Identifier, new Action<string, string>(OnToggleUpdate)); while(ViewManager.Instance.gameMenuView.Listener == null)
ViewManager.Instance.gameMenuView.View.BindCall("OnSliderUpdate_" + ms_category.Identifier, new Action<string, string>(OnSliderUpdate)); yield return null;
ViewManager.Instance.gameMenuView.View.BindCall("OnDropdownUpdate_" + ms_category.Identifier, new Action<string, string>(OnDropdownUpdate));
}; ViewManager.Instance.gameMenuView.Listener.ReadyForBindings += () =>
ViewManager.Instance.gameMenuView.Listener.FinishLoad += (_) => {
{ ViewManager.Instance.gameMenuView.View.BindCall("OnToggleUpdate_" + ms_category.Identifier, new Action<string, string>(OnToggleUpdate));
ViewManager.Instance.gameMenuView.View.ExecuteScript(ResourcesHandler.GetEmbeddedResource("mods_extension.js")); ViewManager.Instance.gameMenuView.View.BindCall("OnSliderUpdate_" + ms_category.Identifier, new Action<string, string>(OnSliderUpdate));
ViewManager.Instance.gameMenuView.View.ExecuteScript(ResourcesHandler.GetEmbeddedResource("mod_menu.js")); ViewManager.Instance.gameMenuView.View.BindCall("OnDropdownUpdate_" + ms_category.Identifier, new Action<string, string>(OnDropdownUpdate));
foreach(var l_entry in ms_entries) };
ViewManager.Instance.gameMenuView.View.TriggerEvent("updateModSetting", ms_category.Identifier, l_entry.DisplayName, l_entry.GetValueAsString()); ViewManager.Instance.gameMenuView.Listener.FinishLoad += (_) =>
}; {
} ViewManager.Instance.gameMenuView.View.ExecuteScript(ResourcesHandler.GetEmbeddedResource("mods_extension.js"));
ViewManager.Instance.gameMenuView.View.ExecuteScript(ResourcesHandler.GetEmbeddedResource("mod_menu.js"));
static void OnToggleUpdate(string p_name, string p_value) foreach(var l_entry in ms_entries)
{ ViewManager.Instance.gameMenuView.View.TriggerEvent("updateModSetting", ms_category.Identifier, l_entry.DisplayName, l_entry.GetValueAsString());
try };
{ }
if(Enum.TryParse(p_name, out ModSetting l_setting) && bool.TryParse(p_value, out bool l_value))
{ static void OnToggleUpdate(string p_name, string p_value)
switch(l_setting) {
{ try
case ModSetting.NotifyInPublic: {
{ if(Enum.TryParse(p_name, out ModSetting l_setting) && bool.TryParse(p_value, out bool l_value))
NotifyInPublic = l_value; {
OnNotifyInPublicChanged.Invoke(NotifyInPublic); switch(l_setting)
} {
break; case ModSetting.Delay:
{
case ModSetting.NotifyInFriends: Delay = l_value;
{ OnDelayChange.Invoke(Delay);
NotifyInFriends = l_value; }
OnNotifyInFriendsChanged.Invoke(NotifyInFriends); break;
}
break; case ModSetting.NotifyInPublic:
{
case ModSetting.NotifyInPrivate: NotifyInPublic = l_value;
{ OnNotifyInPublicChanged.Invoke(NotifyInPublic);
NotifyInPrivate = l_value; }
OnNotifyInPrivateChanged.Invoke(NotifyInPrivate); break;
}
break; case ModSetting.NotifyInFriends:
{
case ModSetting.FriendsAlways: NotifyInFriends = l_value;
{ OnNotifyInFriendsChanged.Invoke(NotifyInFriends);
FriendsAlways = l_value; }
OnFriendsAlwaysChanged.Invoke(FriendsAlways); break;
}
break; case ModSetting.NotifyInPrivate:
} {
NotifyInPrivate = l_value;
ms_entries[(int)l_setting].BoxedValue = l_value; OnNotifyInPrivateChanged.Invoke(NotifyInPrivate);
} }
} break;
catch(Exception e)
{ case ModSetting.FriendsAlways:
MelonLoader.MelonLogger.Error(e); {
} FriendsAlways = l_value;
} OnFriendsAlwaysChanged.Invoke(FriendsAlways);
}
static void OnSliderUpdate(string p_name, string p_value) break;
{ }
try
{ ms_entries[(int)l_setting].BoxedValue = l_value;
if(Enum.TryParse(p_name, out ModSetting l_setting) && int.TryParse(p_value, out int l_value)) }
{ }
switch(l_setting) catch(Exception e)
{ {
case ModSetting.Volume: MelonLoader.MelonLogger.Error(e);
{ }
Volume = l_value * 0.01f; }
OnVolumeChanged.Invoke(Volume);
} static void OnSliderUpdate(string p_name, string p_value)
break; {
} try
{
ms_entries[(int)l_setting].BoxedValue = l_value; if(Enum.TryParse(p_name, out ModSetting l_setting) && int.TryParse(p_value, out int l_value))
} {
} switch(l_setting)
catch(Exception e) {
{ case ModSetting.Volume:
MelonLoader.MelonLogger.Error(e); {
} Volume = l_value * 0.01f;
} OnVolumeChanged.Invoke(Volume);
}
static void OnDropdownUpdate(string p_name, string p_value) break;
{ }
try
{ ms_entries[(int)l_setting].BoxedValue = l_value;
if(Enum.TryParse(p_name, out ModSetting l_setting) && int.TryParse(p_value, out int l_value)) }
{ }
switch(l_setting) catch(Exception e)
{ {
case ModSetting.NotifyType: MelonLoader.MelonLogger.Error(e);
{ }
NotifyType = (NotificationType)l_value; }
OnNotifyTypeChanged.Invoke(NotifyType);
} static void OnDropdownUpdate(string p_name, string p_value)
break; {
} try
{
ms_entries[(int)l_setting].BoxedValue = l_value; if(Enum.TryParse(p_name, out ModSetting l_setting) && int.TryParse(p_value, out int l_value))
} {
} switch(l_setting)
catch(Exception e) {
{ case ModSetting.NotifyType:
MelonLoader.MelonLogger.Error(e); {
} NotifyType = (NotificationType)l_value;
} OnNotifyTypeChanged.Invoke(NotifyType);
} }
} break;
}
ms_entries[(int)l_setting].BoxedValue = l_value;
}
}
catch(Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
}
}

View file

@ -1,70 +1,99 @@
using ABI_RC.Core.AudioEffects; using ABI_RC.Core.AudioEffects;
using System.Collections; using System;
using System.IO; using System.Collections;
using UnityEngine; using System.IO;
using UnityEngine.Networking; using UnityEngine;
using UnityEngine.Networking;
namespace ml_pin
{ namespace ml_pin
class SoundManager {
{ class SoundManager
public enum SoundType {
{ public enum SoundType
PlayerJoin = 0, {
PlayerLeave, PlayerJoin = 0,
FriendJoin, PlayerLeave,
FriendLeave FriendJoin,
} FriendLeave
}
const string c_modName = "PlayersInstanceNotifier";
const string c_modName = "PlayersInstanceNotifier";
bool m_loaded = false;
readonly AudioClip[] m_clips = null; bool m_loaded = false;
readonly AudioClip[] m_clips = null;
internal SoundManager() int[] m_clipDelays = null;
{ int[] m_playTicks = null;
m_clips = new AudioClip[4];
for(int i = 0; i < 4; i++) internal SoundManager()
m_clips[i] = null; {
} m_clips = new AudioClip[4];
public void LoadSounds() for(int i = 0; i < 4; i++)
{ m_clips[i] = null;
if(!m_loaded)
{ m_clipDelays = new int[4];
MelonLoader.MelonCoroutines.Start(LoadAudioClip(SoundType.PlayerJoin, Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, c_modName, "player_join.wav"))); m_clipDelays[(int)SoundType.PlayerJoin] = 708;
MelonLoader.MelonCoroutines.Start(LoadAudioClip(SoundType.PlayerLeave, Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, c_modName, "player_leave.wav"))); m_clipDelays[(int)SoundType.PlayerLeave] = 380;
MelonLoader.MelonCoroutines.Start(LoadAudioClip(SoundType.FriendJoin, Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, c_modName, "friend_join.wav"))); m_clipDelays[(int)SoundType.FriendJoin] = 708;
MelonLoader.MelonCoroutines.Start(LoadAudioClip(SoundType.FriendLeave, Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, c_modName, "friend_leave.wav"))); m_clipDelays[(int)SoundType.FriendLeave] = 380;
m_loaded = true; m_playTicks = new int[4];
} for(int i = 0; i < 4; i++)
} m_playTicks[i] = 0;
}
IEnumerator LoadAudioClip(SoundType p_type, string p_path) public void LoadSounds()
{ {
using UnityWebRequest l_uwr = UnityWebRequestMultimedia.GetAudioClip("file://" + p_path, AudioType.WAV); if(!m_loaded)
((DownloadHandlerAudioClip)l_uwr.downloadHandler).streamAudio = true; {
yield return l_uwr.SendWebRequest(); MelonLoader.MelonCoroutines.Start(LoadAudioClip(SoundType.PlayerJoin, Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, c_modName, "player_join.wav")));
MelonLoader.MelonCoroutines.Start(LoadAudioClip(SoundType.PlayerLeave, Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, c_modName, "player_leave.wav")));
if(l_uwr.isNetworkError || l_uwr.isHttpError) MelonLoader.MelonCoroutines.Start(LoadAudioClip(SoundType.FriendJoin, Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, c_modName, "friend_join.wav")));
{ MelonLoader.MelonCoroutines.Start(LoadAudioClip(SoundType.FriendLeave, Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, c_modName, "friend_leave.wav")));
MelonLoader.MelonLogger.Warning(l_uwr.error);
yield break; m_loaded = true;
} }
}
AudioClip l_content;
AudioClip l_clip = (l_content = DownloadHandlerAudioClip.GetContent(l_uwr)); IEnumerator LoadAudioClip(SoundType p_type, string p_path)
yield return l_content; {
if(!l_uwr.isDone || (l_clip == null)) using UnityWebRequest l_uwr = UnityWebRequestMultimedia.GetAudioClip("file://" + p_path, AudioType.WAV);
yield break; ((DownloadHandlerAudioClip)l_uwr.downloadHandler).streamAudio = true;
yield return l_uwr.SendWebRequest();
m_clips[(int)p_type] = l_clip;
} if(l_uwr.isNetworkError || l_uwr.isHttpError)
{
public void PlaySound(SoundType p_type) MelonLoader.MelonLogger.Warning(l_uwr.error);
{ yield break;
if(m_loaded && (m_clips[(int)p_type] != null)) }
InterfaceAudio.Instance.UserInterfaceAudio.PlayOneShot(m_clips[(int)p_type], Settings.Volume);
} AudioClip l_content;
} AudioClip l_clip = (l_content = DownloadHandlerAudioClip.GetContent(l_uwr));
} yield return l_content;
if(!l_uwr.isDone || (l_clip == null))
yield break;
m_clips[(int)p_type] = l_clip;
m_clipDelays[(int)p_type] = (int)(l_clip.length * 1000f);
}
public void PlaySound(SoundType p_type)
{
if(m_loaded && (m_clips[(int)p_type] != null))
{
if(Settings.Delay)
{
int l_tick = Environment.TickCount;
if(l_tick - m_playTicks[(int)p_type] > m_clipDelays[(int)p_type])
{
m_playTicks[(int)p_type] = l_tick;
InterfaceAudio.Instance.UserInterfaceAudio.PlayOneShot(m_clips[(int)p_type], Settings.Volume);
}
}
else
{
m_playTicks[(int)p_type] = Environment.TickCount;
InterfaceAudio.Instance.UserInterfaceAudio.PlayOneShot(m_clips[(int)p_type], Settings.Volume);
}
}
}
}
}

View file

@ -7,7 +7,7 @@
<Authors>SDraw</Authors> <Authors>SDraw</Authors>
<Company>None</Company> <Company>None</Company>
<Product>PlayersInstanceNotifier</Product> <Product>PlayersInstanceNotifier</Product>
<Version>1.0.6</Version> <Version>1.0.7</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

View file

@ -1,64 +1,71 @@
{ {
let l_block = document.createElement('div'); let l_block = document.createElement('div');
l_block.innerHTML = ` l_block.innerHTML = `
<div class ="settings-subcategory"> <div class ="settings-subcategory">
<div class ="subcategory-name">Players Instance Notifier</div> <div class ="subcategory-name">Players Instance Notifier</div>
<div class ="subcategory-description"></div> <div class ="subcategory-description"></div>
</div> </div>
<div class ="row-wrapper"> <div class ="row-wrapper">
<div class ="option-caption">Notify of: </div> <div class ="option-caption">Notify of: </div>
<div class ="option-input"> <div class ="option-input">
<div id="NotifyType" class ="inp_dropdown no-scroll" data-options="0:None,1:Friends,2:All" data-current="2"></div> <div id="NotifyType" class ="inp_dropdown no-scroll" data-options="0:None,1:Friends,2:All" data-current="2"></div>
</div> </div>
</div> </div>
<div class ="row-wrapper"> <div class ="row-wrapper">
<div class ="option-caption">Mixed volume: </div> <div class ="option-caption">Mixed volume: </div>
<div class ="option-input"> <div class ="option-input">
<div id="Volume" class ="inp_slider no-scroll" data-min="0" data-max="100" data-current="100"></div> <div id="Volume" class ="inp_slider no-scroll" data-min="0" data-max="100" data-current="100"></div>
</div> </div>
</div> </div>
<div class ="row-wrapper"> <div class ="row-wrapper">
<div class ="option-caption">Notify in public instances: </div> <div class ="option-caption">Delay between notifications: </div>
<div class ="option-input"> <div class ="option-input">
<div id="NotifyInPublic" class ="inp_toggle no-scroll" data-current="true"></div> <div id="Delay" class ="inp_toggle no-scroll" data-current="true"></div>
</div> </div>
</div> </div>
<div class ="row-wrapper"> <div class ="row-wrapper">
<div class ="option-caption">Notify in friends instances: </div> <div class ="option-caption">Notify in public instances: </div>
<div class ="option-input"> <div class ="option-input">
<div id="NotifyInFriends" class ="inp_toggle no-scroll" data-current="true"></div> <div id="NotifyInPublic" class ="inp_toggle no-scroll" data-current="true"></div>
</div> </div>
</div> </div>
<div class ="row-wrapper"> <div class ="row-wrapper">
<div class ="option-caption">Notify in private instances: </div> <div class ="option-caption">Notify in friends instances: </div>
<div class ="option-input"> <div class ="option-input">
<div id="NotifyInPrivate" class ="inp_toggle no-scroll" data-current="true"></div> <div id="NotifyInFriends" class ="inp_toggle no-scroll" data-current="true"></div>
</div> </div>
</div> </div>
<div class ="row-wrapper"> <div class ="row-wrapper">
<div class ="option-caption">Always notify of friends: </div> <div class ="option-caption">Notify in private instances: </div>
<div class ="option-input"> <div class ="option-input">
<div id="FriendsAlways" class ="inp_toggle no-scroll" data-current="false"></div> <div id="NotifyInPrivate" class ="inp_toggle no-scroll" data-current="true"></div>
</div> </div>
</div> </div>
`;
document.getElementById('settings-audio').appendChild(l_block); <div class ="row-wrapper">
<div class ="option-caption">Always notify of friends: </div>
// Toggles <div class ="option-input">
for (let l_toggle of l_block.querySelectorAll('.inp_toggle')) <div id="FriendsAlways" class ="inp_toggle no-scroll" data-current="false"></div>
modsExtension.addSetting('PIN', l_toggle.id, modsExtension.createToggle(l_toggle, 'OnToggleUpdate_PIN')); </div>
</div>
// Sliders `;
for (let l_slider of l_block.querySelectorAll('.inp_slider')) document.getElementById('settings-audio').appendChild(l_block);
modsExtension.addSetting('PIN', l_slider.id, modsExtension.createSlider(l_slider, 'OnSliderUpdate_PIN'));
// Toggles
// Dropdowns for (let l_toggle of l_block.querySelectorAll('.inp_toggle'))
for (let l_dropdown of l_block.querySelectorAll('.inp_dropdown')) modsExtension.addSetting('PIN', l_toggle.id, modsExtension.createToggle(l_toggle, 'OnToggleUpdate_PIN'));
modsExtension.addSetting('PIN', l_dropdown.id, modsExtension.createDropdown(l_dropdown, 'OnDropdownUpdate_PIN'));
} // Sliders
for (let l_slider of l_block.querySelectorAll('.inp_slider'))
modsExtension.addSetting('PIN', l_slider.id, modsExtension.createSlider(l_slider, 'OnSliderUpdate_PIN'));
// Dropdowns
for (let l_dropdown of l_block.querySelectorAll('.inp_dropdown'))
modsExtension.addSetting('PIN', l_dropdown.id, modsExtension.createDropdown(l_dropdown, 'OnDropdownUpdate_PIN'));
}

View file

@ -15,6 +15,7 @@ namespace ml_prm
Settings.Init(); Settings.Init();
ModUi.Init(); ModUi.Init();
GameEvents.Init(HarmonyInstance); GameEvents.Init(HarmonyInstance);
WorldHandler.Init();
// Whitelist the toggle script // Whitelist the toggle script
(typeof(SharedFilter).GetField("_localComponentWhitelist", BindingFlags.NonPublic | BindingFlags.Static)?.GetValue(null) as HashSet<Type>)?.Add(typeof(RagdollToggle)); (typeof(SharedFilter).GetField("_localComponentWhitelist", BindingFlags.NonPublic | BindingFlags.Static)?.GetValue(null) as HashSet<Type>)?.Add(typeof(RagdollToggle));
@ -24,6 +25,8 @@ namespace ml_prm
public override void OnDeinitializeMelon() public override void OnDeinitializeMelon()
{ {
WorldHandler.DeInit();
if(m_localController != null) if(m_localController != null)
UnityEngine.Object.Destroy(m_localController); UnityEngine.Object.Destroy(m_localController);
m_localController = null; m_localController = null;

View file

@ -1,4 +1,4 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.1.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.1.7", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPriority(2)] [assembly: MelonLoader.MelonPriority(2)]
[assembly: MelonLoader.MelonOptionalDependencies("BTKUILib")] [assembly: MelonLoader.MelonOptionalDependencies("BTKUILib")]

View file

@ -45,6 +45,9 @@ Optional mod's settings in [UIExpansionKit](https://github.com/ddakebono/Chillou
Available additional parameters for AAS animator: Available additional parameters for AAS animator:
* **`Ragdolled`:** defines current ragdoll state; boolean. * **`Ragdolled`:** defines current ragdoll state; boolean.
* Note: Can be set as local-only (not synced) if starts with `#` character. * Note: Can be set as local-only (not synced) if starts with `#` character.
# World restriction
World creators can restrict ragdolling by creating empty game object with name `[RagdollRestriction]` anywhere in scene.
# Unity Editor Script # Unity Editor Script
You can also trigger the ragdoll via animations on your avatar. To do this you need: You can also trigger the ragdoll via animations on your avatar. To do this you need:

View file

@ -213,7 +213,7 @@ namespace ml_prm
if(m_downTime >= Settings.RecoverDelay) if(m_downTime >= Settings.RecoverDelay)
{ {
SwitchRagdoll(); SwitchRagdoll();
m_downTime = float.MinValue; // One attepmt to recover m_downTime = float.MinValue; // One attempt to recover
} }
} }
@ -363,13 +363,13 @@ namespace ml_prm
m_rigidBodies.Add(l_body); m_rigidBodies.Add(l_body);
l_body.isKinematic = true; l_body.isKinematic = true;
l_body.angularDrag = Settings.AngularDrag; l_body.angularDrag = Settings.AngularDrag;
l_body.drag = (Utils.IsWorldSafe() ? Settings.MovementDrag : 1f); l_body.drag = (WorldHandler.IsSafeWorld() ? Settings.MovementDrag : 1f);
l_body.useGravity = false; l_body.useGravity = false;
l_body.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; l_body.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
l_body.gameObject.layer = LayerMask.NameToLayer("PlayerLocal"); l_body.gameObject.layer = LayerMask.NameToLayer("PlayerLocal");
GravityInfluencer l_gravInfluencer = l_body.gameObject.AddComponent<GravityInfluencer>(); GravityInfluencer l_gravInfluencer = l_body.gameObject.AddComponent<GravityInfluencer>();
l_gravInfluencer.SetActiveGravity((!Utils.IsWorldSafe() || Settings.Gravity)); l_gravInfluencer.SetActiveGravity((!WorldHandler.IsSafeWorld() || Settings.Gravity));
m_gravityInfluencers.Add(l_gravInfluencer); m_gravityInfluencers.Add(l_gravInfluencer);
} }
@ -398,7 +398,7 @@ namespace ml_prm
if((l_body != null) && (l_collider != null) && (l_puppetTransforms[i] == m_puppetReferences.hips || l_puppetTransforms[i] == m_puppetReferences.spine || l_puppetTransforms[i] == m_puppetReferences.chest)) if((l_body != null) && (l_collider != null) && (l_puppetTransforms[i] == m_puppetReferences.hips || l_puppetTransforms[i] == m_puppetReferences.spine || l_puppetTransforms[i] == m_puppetReferences.chest))
{ {
PhysicsInfluencer l_physicsInfluencer = l_puppetTransforms[i].gameObject.AddComponent<PhysicsInfluencer>(); PhysicsInfluencer l_physicsInfluencer = l_puppetTransforms[i].gameObject.AddComponent<PhysicsInfluencer>();
l_physicsInfluencer.airDrag = (Utils.IsWorldSafe() ? Settings.MovementDrag : 1f); l_physicsInfluencer.airDrag = (WorldHandler.IsSafeWorld() ? Settings.MovementDrag : 1f);
l_physicsInfluencer.airAngularDrag = Settings.AngularDrag; l_physicsInfluencer.airAngularDrag = Settings.AngularDrag;
l_physicsInfluencer.fluidDrag = 3f; l_physicsInfluencer.fluidDrag = 3f;
l_physicsInfluencer.fluidAngularDrag = 1f; l_physicsInfluencer.fluidAngularDrag = 1f;
@ -572,7 +572,7 @@ namespace ml_prm
{ {
if(m_avatarReady) if(m_avatarReady)
{ {
float l_drag = (Utils.IsWorldSafe() ? p_value : 1f); float l_drag = (WorldHandler.IsSafeWorld() ? p_value : 1f);
foreach(Rigidbody l_body in m_rigidBodies) foreach(Rigidbody l_body in m_rigidBodies)
{ {
l_body.drag = l_drag; l_body.drag = l_drag;
@ -601,7 +601,7 @@ namespace ml_prm
{ {
if(m_avatarReady) if(m_avatarReady)
{ {
bool l_gravity = (!Utils.IsWorldSafe() || p_state); bool l_gravity = (!WorldHandler.IsSafeWorld() || p_state);
foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers) foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers)
l_influencer.enabled = l_gravity; l_influencer.enabled = l_gravity;
foreach(GravityInfluencer l_influencer in m_gravityInfluencers) foreach(GravityInfluencer l_influencer in m_gravityInfluencers)
@ -618,8 +618,8 @@ namespace ml_prm
{ {
if(m_physicsMaterial != null) if(m_physicsMaterial != null)
{ {
bool l_slipperiness = (Settings.Slipperiness && Utils.IsWorldSafe()); bool l_slipperiness = (Settings.Slipperiness && WorldHandler.IsSafeWorld());
bool l_bounciness = (Settings.Bounciness && Utils.IsWorldSafe()); bool l_bounciness = (Settings.Bounciness && WorldHandler.IsSafeWorld());
m_physicsMaterial.dynamicFriction = (l_slipperiness ? 0f : c_defaultFriction); m_physicsMaterial.dynamicFriction = (l_slipperiness ? 0f : c_defaultFriction);
m_physicsMaterial.staticFriction = (l_slipperiness ? 0f : c_defaultFriction); m_physicsMaterial.staticFriction = (l_slipperiness ? 0f : c_defaultFriction);
m_physicsMaterial.frictionCombine = (l_slipperiness ? PhysicMaterialCombine.Minimum : PhysicMaterialCombine.Average); m_physicsMaterial.frictionCombine = (l_slipperiness ? PhysicMaterialCombine.Minimum : PhysicMaterialCombine.Average);
@ -631,7 +631,7 @@ namespace ml_prm
{ {
if(m_avatarReady) if(m_avatarReady)
{ {
bool l_buoyancy = (!Utils.IsWorldSafe() || p_state); bool l_buoyancy = (!WorldHandler.IsSafeWorld() || p_state);
foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers) foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers)
l_influencer.enableInfluence = l_buoyancy; l_influencer.enableInfluence = l_buoyancy;
@ -672,7 +672,7 @@ namespace ml_prm
PlayerSetup.Instance.animatorManager.CancelEmote = true; PlayerSetup.Instance.animatorManager.CancelEmote = true;
m_ragdolledParameter.SetValue(true); m_ragdolledParameter.SetValue(true);
if(!Utils.IsWorldSafe()) if(!WorldHandler.IsSafeWorld())
{ {
m_reachedGround = false; // Force player to unragdoll and reach ground first m_reachedGround = false; // Force player to unragdoll and reach ground first
m_groundedTime = 0f; m_groundedTime = 0f;
@ -683,8 +683,8 @@ namespace ml_prm
foreach(Rigidbody l_body in m_rigidBodies) foreach(Rigidbody l_body in m_rigidBodies)
l_body.isKinematic = false; l_body.isKinematic = false;
Vector3 l_velocity = Vector3.ClampMagnitude(m_velocity * (Utils.IsWorldSafe() ? Settings.VelocityMultiplier : 1f), Utils.GetWorldMovementLimit()); Vector3 l_velocity = Vector3.ClampMagnitude(m_velocity * (WorldHandler.IsSafeWorld() ? Settings.VelocityMultiplier : 1f), WorldHandler.GetMovementLimit());
if(Settings.ViewVelocity && Utils.IsWorldSafe()) if(Settings.ViewVelocity && WorldHandler.IsSafeWorld())
{ {
float l_mag = l_velocity.magnitude; float l_mag = l_velocity.magnitude;
l_velocity = PlayerSetup.Instance.GetActiveCamera().transform.forward * l_mag; l_velocity = PlayerSetup.Instance.GetActiveCamera().transform.forward * l_mag;
@ -708,7 +708,7 @@ namespace ml_prm
{ {
BetterBetterCharacterController.Instance.TeleportPlayerTo(m_puppetReferences.hips.position, PlayerSetup.Instance.GetPlayerRotation().eulerAngles, false, false); BetterBetterCharacterController.Instance.TeleportPlayerTo(m_puppetReferences.hips.position, PlayerSetup.Instance.GetPlayerRotation().eulerAngles, false, false);
TryRestoreMovement(); TryRestoreMovement();
if(!Utils.IsWorldSafe()) if(!WorldHandler.IsSafeWorld())
{ {
Vector3 l_vec = BetterBetterCharacterController.Instance.GetVelocity(); Vector3 l_vec = BetterBetterCharacterController.Instance.GetVelocity();
l_vec.y = Mathf.Clamp(l_vec.y, float.MinValue, 0f); l_vec.y = Mathf.Clamp(l_vec.y, float.MinValue, 0f);
@ -775,6 +775,9 @@ namespace ml_prm
bool CanRagdoll() bool CanRagdoll()
{ {
if(WorldHandler.IsRestrictedWorld())
return false;
bool l_result = m_reachedGround; bool l_result = m_reachedGround;
l_result &= !BodySystem.isCalibrating; l_result &= !BodySystem.isCalibrating;
l_result &= !BetterBetterCharacterController.Instance.IsSitting(); l_result &= !BetterBetterCharacterController.Instance.IsSitting();

View file

@ -16,21 +16,6 @@ namespace ml_prm
static readonly FieldInfo ms_influencerTouchingVolumes = typeof(PhysicsInfluencer).GetField("_touchingVolumes", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_influencerTouchingVolumes = typeof(PhysicsInfluencer).GetField("_touchingVolumes", BindingFlags.NonPublic | BindingFlags.Instance);
static readonly FieldInfo ms_influencerSubmergedColliders = typeof(PhysicsInfluencer).GetField("_submergedColliders", BindingFlags.NonPublic | BindingFlags.Instance); static readonly FieldInfo ms_influencerSubmergedColliders = typeof(PhysicsInfluencer).GetField("_submergedColliders", BindingFlags.NonPublic | BindingFlags.Instance);
public static bool IsInVR() => ((MetaPort.Instance != null) && MetaPort.Instance.isUsingVr);
public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying);
public static float GetWorldMovementLimit()
{
float l_result = 1f;
if(CVRWorld.Instance != null)
{
l_result = CVRWorld.Instance.baseMovementSpeed;
l_result *= CVRWorld.Instance.sprintMultiplier;
l_result *= CVRWorld.Instance.inAirMovementMultiplier;
l_result *= CVRWorld.Instance.flyMultiplier;
}
return l_result;
}
public static void ClearFluidVolumes(this BetterBetterCharacterController p_instance) => (ms_touchingVolumes.GetValue(p_instance) as List<FluidVolume>)?.Clear(); public static void ClearFluidVolumes(this BetterBetterCharacterController p_instance) => (ms_touchingVolumes.GetValue(p_instance) as List<FluidVolume>)?.Clear();
public static void CopyGlobal(this Transform p_source, Transform p_target) public static void CopyGlobal(this Transform p_source, Transform p_target)

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;
}
}

View file

@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<PackageId>PlayerRagdollMod</PackageId> <PackageId>PlayerRagdollMod</PackageId>
<Version>1.1.6</Version> <Version>1.1.7</Version>
<Authors>SDraw</Authors> <Authors>SDraw</Authors>
<Company>None</Company> <Company>None</Company>
<Product>PlayerRagdollMod</Product> <Product>PlayerRagdollMod</Product>