mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-04 02:49:23 +00:00
Check for props game settings and world restrictions
Combat system integration Additional measure for unsafe worlds
This commit is contained in:
parent
5185c00fb1
commit
912b37c87f
9 changed files with 186 additions and 57 deletions
|
@ -6,6 +6,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using ABI_RC.Core.Util.AssetFiltering;
|
||||
using ABI.CCK.Components;
|
||||
using System.Linq;
|
||||
|
||||
namespace ml_prm
|
||||
{
|
||||
|
@ -47,6 +49,11 @@ namespace ml_prm
|
|||
new HarmonyLib.HarmonyMethod(typeof(PlayerRagdollMod).GetMethod(nameof(OnWorldSpawn_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||
null
|
||||
);
|
||||
HarmonyInstance.Patch(
|
||||
typeof(CombatSystem).GetMethods().First(m => (!m.IsGenericMethod && m.Name == nameof(CombatSystem.Down))),
|
||||
new HarmonyLib.HarmonyMethod(typeof(PlayerRagdollMod).GetMethod(nameof(OnCombatDown_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||
null
|
||||
);
|
||||
|
||||
// Whitelist the toggle script
|
||||
(typeof(SharedFilter).GetField("_localComponentWhitelist", BindingFlags.NonPublic | BindingFlags.Static)?.GetValue(null) as HashSet<Type>)?.Add(typeof(RagdollToggle));
|
||||
|
@ -140,5 +147,22 @@ namespace ml_prm
|
|||
}
|
||||
}
|
||||
|
||||
static void OnCombatDown_Prefix(ref CombatSystem __instance)
|
||||
{
|
||||
if((__instance == CombatSystem.Instance) && !__instance.isDown)
|
||||
ms_instance?.OnCombatDown();
|
||||
}
|
||||
void OnCombatDown()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(m_localController != null)
|
||||
m_localController.OnCombatDown();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MelonLoader.MelonLogger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue