using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Il2CppHexabodyVR.PlayerController;
using Il2CppHurricaneVR.Framework.Core.Grabbers;
using Il2CppHurricaneVR.Framework.Shared;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
using WallKick;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(WallKickMod), "WallKick", "2.0.8", "", null)]
[assembly: MelonGame("Kubunautilus", "BrutalistickVR")]
[assembly: MelonPriority(-50)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("WallKick")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WallKick")]
[assembly: AssemblyTitle("WallKick")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace WallKick
{
public static class Cfg
{
public const string Category = "WallKick";
private const int Schema = 8;
private const float DefProbeRadius = 0.8f;
private const float DefEnemyProbeRadius = 1.5f;
private const float DefProbeHeight = 0.55f;
private const float DefProbeStep = 0.35f;
private const float DefMaxUpness = 0.4f;
private const float DefEnemyMaxUpness = 0.8f;
private const bool DefRequireStatic = true;
private const float DefKickApex = 0.9f;
private const float DefKickRampTime = 0.14f;
private const float DefKickAccel = 38f;
private const float DefKickChainDecay = 0f;
private const float DefKickChainMinApex = 0.15f;
private const float DefHorizontalDamp = 1f;
private const bool DefKillSpin = true;
private const bool DefKickExactApex = true;
private const float DefKickHold = 0.08f;
private const float DefCooldown = 0.35f;
private const float DefStickWindow = 0.55f;
private const float DefMinAirTime = 0.02f;
private const float DefKickAirGrace = 0.25f;
private const bool DefRequireAir = true;
private const bool DefRequireTrigger = true;
private const bool DefVerbose = true;
private const float DefKickBackSpeed = 6.5f;
private const float DefBackModeUp = 0.35f;
private const bool DefGazeBlend = true;
private const float DefKickUpMix = 0.5f;
private const bool DefKickOffEnemies = true;
private const bool DefNoKickWhileHolding = true;
private const bool DefEnemyOnlyBack = true;
private const float DefEnemyHitDelay = 0.14f;
private const float DefEnemyHold = 0.28f;
private const bool DefRequireFacing = true;
private const float DefFacingMinDot = 0.35f;
public static MelonPreferences_Category Prefs;
public static MelonPreferences_Entry<bool> Enabled;
public static MelonPreferences_Entry<float> ProbeRadius;
public static MelonPreferences_Entry<float> EnemyProbeRadius;
public static MelonPreferences_Entry<float> ProbeHeight;
public static MelonPreferences_Entry<float> ProbeStep;
public static MelonPreferences_Entry<float> MaxUpness;
public static MelonPreferences_Entry<float> EnemyMaxUpness;
public static MelonPreferences_Entry<bool> RequireStatic;
public static MelonPreferences_Entry<float> KickApex;
public static MelonPreferences_Entry<float> KickRampTime;
public static MelonPreferences_Entry<float> KickAccel;
public static MelonPreferences_Entry<float> KickChainDecay;
public static MelonPreferences_Entry<float> KickChainMinApex;
public static MelonPreferences_Entry<float> HorizontalDamp;
public static MelonPreferences_Entry<bool> KillSpin;
public static MelonPreferences_Entry<bool> KickExactApex;
public static MelonPreferences_Entry<float> KickHold;
public static MelonPreferences_Entry<float> Cooldown;
public static MelonPreferences_Entry<float> StickWindow;
public static MelonPreferences_Entry<float> MinAirTime;
public static MelonPreferences_Entry<float> KickAirGrace;
public static MelonPreferences_Entry<bool> RequireAir;
public static MelonPreferences_Entry<bool> RequireTrigger;
public static MelonPreferences_Entry<bool> Verbose;
public static MelonPreferences_Entry<float> KickBackSpeed;
public static MelonPreferences_Entry<float> BackModeUp;
public static MelonPreferences_Entry<bool> GazeBlend;
public static MelonPreferences_Entry<float> KickUpMix;
public static MelonPreferences_Entry<bool> KickOffEnemies;
public static MelonPreferences_Entry<bool> NoKickWhileHolding;
public static MelonPreferences_Entry<bool> EnemyOnlyBack;
public static MelonPreferences_Entry<float> EnemyHitDelay;
public static MelonPreferences_Entry<float> EnemyHold;
public static MelonPreferences_Entry<bool> RequireFacing;
public static MelonPreferences_Entry<float> FacingMinDot;
public static void Register()
{
Prefs = MelonPreferences.CreateCategory("WallKick", "WallKick");
MelonPreferences_Entry<int> val = Prefs.CreateEntry<int>("CfgSchema", 0, "схема настроек", (string)null, false, false, (ValueValidator)null, (string)null);
Enabled = Prefs.CreateEntry<bool>("Enabled", true, "Мод включён", (string)null, false, false, (ValueValidator)null, (string)null);
ProbeRadius = Prefs.CreateEntry<float>("ProbeRadius", 0.8f, "Радиус лучей вокруг шара, м", (string)null, false, false, (ValueValidator)null, (string)null);
EnemyProbeRadius = Prefs.CreateEntry<float>("EnemyProbeRadius", 1.5f, "Радиус поиска врага, м (рука достаёт дальше тела)", (string)null, false, false, (ValueValidator)null, (string)null);
ProbeHeight = Prefs.CreateEntry<float>("ProbeHeight", 0.55f, "Высота лучей над шаром, м", (string)null, false, false, (ValueValidator)null, (string)null);
ProbeStep = Prefs.CreateEntry<float>("ProbeStep", 0.35f, "Шаг между высотами лучей, м", (string)null, false, false, (ValueValidator)null, (string)null);
MaxUpness = Prefs.CreateEntry<float>("MaxUpness", 0.4f, "Стена, если |n.y| меньше этого", (string)null, false, false, (ValueValidator)null, (string)null);
EnemyMaxUpness = Prefs.CreateEntry<float>("EnemyMaxUpness", 0.8f, "Враг, если |n.y| меньше этого (тело округлое, порог мягче)", (string)null, false, false, (ValueValidator)null, (string)null);
RequireStatic = Prefs.CreateEntry<bool>("RequireStatic", true, "Только статичная геометрия", (string)null, false, false, (ValueValidator)null, (string)null);
KickApex = Prefs.CreateEntry<float>("KickApex", 0.9f, "Высота подскока от стены, м", (string)null, false, false, (ValueValidator)null, (string)null);
KickRampTime = Prefs.CreateEntry<float>("KickRampTime", 0.14f, "Длительность разгона, с", (string)null, false, false, (ValueValidator)null, (string)null);
KickAccel = Prefs.CreateEntry<float>("KickAccel", 38f, "Макс. ускорение разгона, м/с^2", (string)null, false, false, (ValueValidator)null, (string)null);
KickChainDecay = Prefs.CreateEntry<float>("KickChainDecay", 0f, "Ослабевание цепочки отскоков; 0 = без цепочки", (string)null, false, false, (ValueValidator)null, (string)null);
KickChainMinApex = Prefs.CreateEntry<float>("KickChainMinApex", 0.15f, "Ниже этой высоты отскок обнуляется", (string)null, false, false, (ValueValidator)null, (string)null);
HorizontalDamp = Prefs.CreateEntry<float>("HorizontalDamp", 1f, "Гашение горизонтали: 1 = полностью", (string)null, false, false, (ValueValidator)null, (string)null);
KillSpin = Prefs.CreateEntry<bool>("KillSpin", true, "Гасить вращение при отскоке", (string)null, false, false, (ValueValidator)null, (string)null);
KickExactApex = Prefs.CreateEntry<bool>("KickExactApex", true, "Строго одинаковый апекс", (string)null, false, false, (ValueValidator)null, (string)null);
KickHold = Prefs.CreateEntry<float>("KickHold", 0.08f, "Удержание импульса после разгона, с", (string)null, false, false, (ValueValidator)null, (string)null);
Cooldown = Prefs.CreateEntry<float>("Cooldown", 0.35f, "Кулдаун между отскоками, с", (string)null, false, false, (ValueValidator)null, (string)null);
StickWindow = Prefs.CreateEntry<float>("StickWindow", 0.55f, "Запас времени на подлёт к цели после нажатия, с", (string)null, false, false, (ValueValidator)null, (string)null);
MinAirTime = Prefs.CreateEntry<float>("MinAirTime", 0.02f, "Не отскакивать раньше, с", (string)null, false, false, (ValueValidator)null, (string)null);
KickAirGrace = Prefs.CreateEntry<float>("KickAirGrace", 0.25f, "Льготное окно в воздухе, с", (string)null, false, false, (ValueValidator)null, (string)null);
RequireAir = Prefs.CreateEntry<bool>("RequireAir", true, "Отскок только в воздухе", (string)null, false, false, (ValueValidator)null, (string)null);
RequireTrigger = Prefs.CreateEntry<bool>("RequireTrigger", true, "Требовать A + триггер", (string)null, false, false, (ValueValidator)null, (string)null);
Verbose = Prefs.CreateEntry<bool>("Verbose", true, "Подробный лог", (string)null, false, false, (ValueValidator)null, (string)null);
KickBackSpeed = Prefs.CreateEntry<float>("KickBackSpeed", 6.5f, "Скорость отброса назад от стены, м/с", (string)null, false, false, (ValueValidator)null, (string)null);
BackModeUp = Prefs.CreateEntry<float>("BackModeUp", 0.35f, "Подброс вверх в режиме «назад», м", (string)null, false, false, (ValueValidator)null, (string)null);
GazeBlend = Prefs.CreateEntry<bool>("GazeBlend", true, "Бленд дуги по взгляду: вниз = вверх, прямо = назад", (string)null, false, false, (ValueValidator)null, (string)null);
KickUpMix = Prefs.CreateEntry<float>("KickUpMix", 0.5f, "Фикс-микс при выкл. GazeBlend: 0 = назад, 1 = вверх", (string)null, false, false, (ValueValidator)null, (string)null);
KickOffEnemies = Prefs.CreateEntry<bool>("KickOffEnemies", true, "Отталкиваться от противников (не от пропов)", (string)null, false, false, (ValueValidator)null, (string)null);
NoKickWhileHolding = Prefs.CreateEntry<bool>("NoKickWhileHolding", true, "Не откидывать, пока держишься за статику", (string)null, false, false, (ValueValidator)null, (string)null);
EnemyOnlyBack = Prefs.CreateEntry<bool>("EnemyOnlyBack", true, "От врага отлетать только назад, без подброса", (string)null, false, false, (ValueValidator)null, (string)null);
EnemyHitDelay = Prefs.CreateEntry<float>("EnemyHitDelay", 0.14f, "Задержка импульса по врагу, с (нога должна успеть ударить)", (string)null, false, false, (ValueValidator)null, (string)null);
EnemyHold = Prefs.CreateEntry<float>("EnemyHold", 0.28f, "Удержание отброса по врагу, с (иначе гасится сразу)", (string)null, false, false, (ValueValidator)null, (string)null);
RequireFacing = Prefs.CreateEntry<bool>("RequireFacing", true, "Отскок только когда смотришь на цель", (string)null, false, false, (ValueValidator)null, (string)null);
FacingMinDot = Prefs.CreateEntry<float>("FacingMinDot", 0.35f, "Насколько надо быть лицом к цели: 1 = строго в упор", (string)null, false, false, (ValueValidator)null, (string)null);
if (val.Value != 8)
{
int value = val.Value;
Enabled.Value = true;
ProbeRadius.Value = 0.8f;
EnemyProbeRadius.Value = 1.5f;
ProbeHeight.Value = 0.55f;
ProbeStep.Value = 0.35f;
MaxUpness.Value = 0.4f;
EnemyMaxUpness.Value = 0.8f;
RequireStatic.Value = true;
KickApex.Value = 0.9f;
KickRampTime.Value = 0.14f;
KickAccel.Value = 38f;
KickChainDecay.Value = 0f;
KickChainMinApex.Value = 0.15f;
HorizontalDamp.Value = 1f;
KillSpin.Value = true;
KickExactApex.Value = true;
KickHold.Value = 0.08f;
Cooldown.Value = 0.35f;
StickWindow.Value = 0.55f;
MinAirTime.Value = 0.02f;
KickAirGrace.Value = 0.25f;
RequireAir.Value = true;
RequireTrigger.Value = true;
Verbose.Value = true;
KickBackSpeed.Value = 6.5f;
BackModeUp.Value = 0.35f;
GazeBlend.Value = true;
KickUpMix.Value = 0.5f;
KickOffEnemies.Value = true;
NoKickWhileHolding.Value = true;
EnemyOnlyBack.Value = true;
EnemyHitDelay.Value = 0.14f;
EnemyHold.Value = 0.28f;
RequireFacing.Value = true;
FacingMinDot.Value = 0.35f;
val.Value = 8;
MelonLogger.Msg("[WallKick] СХЕМА {0} -> {1}: значения сброшены к дефолтам кода.", new object[2] { value, 8 });
}
MelonLogger.Msg("[WallKick] стена: probeR={0:F2} h={1:F2} шаг={2:F2} upness<{3:F2} статика={4} схема={5}", new object[6] { ProbeRadius.Value, ProbeHeight.Value, ProbeStep.Value, MaxUpness.Value, RequireStatic.Value, val.Value });
MelonLogger.Msg("[WallKick] отскок: apex={0:F2}м -> v={1:F2}м/с разгон={2:F2}с accel={3:F1} удержание={4:F2}с точныйАпекс={5} вращение={6}", new object[7]
{
KickApex.Value,
SpeedForApex(),
KickRampTime.Value,
KickAccel.Value,
KickHold.Value,
KickExactApex.Value,
KillSpin.Value
});
MelonLogger.Msg("[WallKick] цепочка: ослабевание={0:F2} (0 = выкл), обнуление ниже {1:F2}м", new object[2] { KickChainDecay.Value, KickChainMinApex.Value });
MelonLogger.Msg("[WallKick] условия: толькоВоздух={0} A+триггер={1} minAir={2:F2} grace={3:F2} кулдаун={4:F2} окно={5:F2}", new object[6] { RequireAir.Value, RequireTrigger.Value, MinAirTime.Value, KickAirGrace.Value, Cooldown.Value, StickWindow.Value });
MelonLogger.Msg("[WallKick] дуга: назад={0:F2}м/с верхНазад={1:F2}м взгляд={2} микс={3:F2} враги={4} неВися={5}", new object[6] { KickBackSpeed.Value, BackModeUp.Value, GazeBlend.Value, KickUpMix.Value, KickOffEnemies.Value, NoKickWhileHolding.Value });
}
public static float SpeedForApex()
{
return SpeedForApexValue(KickApex.Value);
}
public static float SpeedForApexValue(float apex)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Abs(Physics.gravity.y);
if (num < 0.01f)
{
num = 9.81f;
}
return Mathf.Sqrt(2f * num * Mathf.Max(0f, apex));
}
}
public static class Surf
{
public const string Tag = "[WallKick]";
private static readonly HashSet<int> OwnIds = new HashSet<int>();
private static Transform _own;
private static Transform _root;
private static readonly HashSet<string> BodyParts = new HashSet<string>
{
"Neck", "Head", "Jaw", "UpperChest", "MiddleChest", "Pelvis", "Shoulder_R", "Shoulder_L", "Elbow_R", "Elbow_L",
"Hip_R", "Hip_L", "Knee_R", "Knee_L", "Foot_R", "Foot_L", "Hand_R", "Hand_L"
};
private static readonly Vector3[] Dirs;
private static Type _tBridge;
private static Type _tHealth;
private static bool _tResolved;
private static string _tHow;
public static void Init(HexaBodyPlayer4 body)
{
OwnIds.Clear();
_own = ((Component)body).transform;
_root = (((Object)(object)_own != (Object)null) ? _own.root : null);
if ((Object)(object)_root != (Object)null)
{
Collider[] array = Il2CppArrayBase<Collider>.op_Implicit(((Component)_root).GetComponentsInChildren<Collider>(true));
if (array != null)
{
for (int i = 0; i < array.Length; i++)
{
if (!((Object)(object)array[i] == (Object)null))
{
OwnIds.Add(((Object)array[i]).GetInstanceID());
}
}
}
}
MelonLogger.Msg("[WallKick] СНАПШОТ рига: своих коллайдеров={0}", new object[1] { OwnIds.Count });
}
public static bool FindMulti(Vector3 point, float radius, float maxUpness, out Vector3 normal, out float dist, out string name, out bool enemy)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Max(0.05f, Cfg.ProbeStep.Value);
_ = Cfg.ProbeHeight.Value;
normal = Vector3.zero;
dist = -1f;
name = "";
enemy = false;
bool flag = false;
float[] array = new float[5]
{
0f,
num,
0f - num,
2f * num,
-2f * num
};
for (int i = 0; i < array.Length; i++)
{
float radius2 = Mathf.Max(radius, Cfg.EnemyProbeRadius.Value);
if (!Find(point + Vector3.up * array[i], radius, maxUpness, out var normal2, out var dist2, out var name2, out var enemy2))
{
if (!Cfg.KickOffEnemies.Value || !EnemyPass(point + Vector3.up * array[i], radius2, maxUpness, out normal2, out dist2, out name2))
{
continue;
}
enemy2 = true;
}
if (!flag || !(dist2 >= dist))
{
normal = normal2;
dist = dist2;
name = name2;
enemy = enemy2;
flag = true;
if (i == 0)
{
return true;
}
}
}
return flag;
}
private static bool EnemyPass(Vector3 point, float radius, float maxUpness, out Vector3 normal, out float dist, out string name)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
normal = Vector3.zero;
dist = -1f;
name = "";
float num = float.MaxValue;
for (int i = 0; i < Dirs.Length; i++)
{
Vector3 val = Dirs[i];
RaycastHit[] array = Il2CppArrayBase<RaycastHit>.op_Implicit((Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(point, val, radius, -1, (QueryTriggerInteraction)2));
for (int j = 0; j < array.Length; j++)
{
RaycastHit val2 = array[j];
Collider collider = ((RaycastHit)(ref val2)).collider;
if (!((Object)(object)collider == (Object)null) && collider.isTrigger && IsEnemy(collider) && !OwnIds.Contains(((Object)collider).GetInstanceID()))
{
Transform transform = ((Component)collider).transform;
if ((!((Object)(object)_own != (Object)null) || (!((Object)(object)transform == (Object)(object)_own) && !transform.IsChildOf(_own))) && (!((Object)(object)_root != (Object)null) || (!((Object)(object)transform == (Object)(object)_root) && !transform.IsChildOf(_root))) && !BodyParts.Contains(((Object)((Component)collider).gameObject).name) && !(Mathf.Abs(((RaycastHit)(ref val2)).normal.y) > maxUpness) && !(((RaycastHit)(ref val2)).distance >= num))
{
num = ((RaycastHit)(ref val2)).distance;
normal = ((RaycastHit)(ref val2)).normal;
name = ((Object)((Component)collider).gameObject).name;
}
}
}
}
if (num >= float.MaxValue)
{
return false;
}
dist = num;
return true;
}
public static bool Find(Vector3 point, float radius, float maxUpness, out Vector3 normal, out float dist, out string name, out bool enemy)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
normal = Vector3.zero;
dist = -1f;
name = "";
enemy = false;
float num = float.MaxValue;
if (Cfg.KickOffEnemies.Value)
{
float maxUpness2 = Mathf.Max(0.5f, Cfg.EnemyMaxUpness.Value);
if (EnemyPass(point, radius, maxUpness2, out var normal2, out var dist2, out var name2))
{
normal = normal2;
dist = dist2;
name = name2;
enemy = true;
return true;
}
}
for (int i = 0; i < Dirs.Length; i++)
{
Vector3 val = Dirs[i];
Vector3 val2 = point + val * 0.03f;
float num2 = Mathf.Max(0.05f, radius);
for (int j = 0; j < 6; j++)
{
if (num2 <= 0.01f)
{
break;
}
RaycastHit val3 = default(RaycastHit);
if (!Physics.Raycast(val2, val, ref val3, num2, -1, (QueryTriggerInteraction)1))
{
break;
}
Collider collider = ((RaycastHit)(ref val3)).collider;
if ((Object)(object)collider == (Object)null)
{
break;
}
if (!Passes(collider))
{
val2 = ((RaycastHit)(ref val3)).point + val * 0.02f;
num2 -= ((RaycastHit)(ref val3)).distance + 0.02f;
continue;
}
if (!(Mathf.Abs(((RaycastHit)(ref val3)).normal.y) > maxUpness) && ((RaycastHit)(ref val3)).distance < num)
{
num = ((RaycastHit)(ref val3)).distance;
normal = ((RaycastHit)(ref val3)).normal;
name = ((Object)((Component)collider).gameObject).name;
enemy = IsEnemy(collider);
}
break;
}
}
if (num >= float.MaxValue)
{
return false;
}
dist = num;
return true;
}
private static void ResolveEnemyTypes()
{
if (!_tResolved)
{
_tResolved = true;
try
{
_tBridge = Type.GetType("ActiveRagdoll.ColliderBridge, Assembly-CSharp");
_tHealth = Type.GetType("ActiveRagdoll.StickHealth, Assembly-CSharp");
_tHow = ((_tBridge != (Type)null || _tHealth != (Type)null) ? ("Type.GetType: bridge=" + (_tBridge != (Type)null) + " health=" + (_tHealth != (Type)null)) : "Type.GetType пусто -> фолбэк FullName");
}
catch (Exception ex)
{
_tHow = "Type.GetType исключение: " + ex.GetType().Name + " -> фолбэк FullName";
}
MelonLogger.Msg("[WallKick] ВРАГИ: типы решены: {0}", new object[1] { _tHow });
}
}
public static bool IsEnemy(Collider col)
{
if ((Object)(object)col == (Object)null)
{
return false;
}
ResolveEnemyTypes();
try
{
Transform val = ((Component)col).transform;
int num = 0;
while ((Object)(object)val != (Object)null && num++ < 8)
{
if (_tBridge != (Type)null && (Object)(object)((Component)val).GetComponent(_tBridge) != (Object)null)
{
return true;
}
if (_tHealth != (Type)null && (Object)(object)((Component)val).GetComponent(_tHealth) != (Object)null)
{
return true;
}
if (NameHit(val))
{
return true;
}
val = val.parent;
}
}
catch
{
}
return false;
}
private static bool NameHit(Transform t)
{
try
{
Component[] array = Il2CppArrayBase<Component>.op_Implicit(((Component)t).GetComponents<Component>());
if (array == null)
{
return false;
}
foreach (Component val in array)
{
if (!((Object)(object)val == (Object)null))
{
string name = ((object)val).GetType().Name;
if (!string.IsNullOrEmpty(name) && (name == "ColliderBridge" || name == "StickHealth"))
{
return true;
}
}
}
}
catch
{
}
return false;
}
private static bool Passes(Collider col)
{
bool value = Cfg.RequireStatic.Value;
if (OwnIds.Contains(((Object)col).GetInstanceID()))
{
return false;
}
Transform transform = ((Component)col).transform;
if ((Object)(object)_own != (Object)null && ((Object)(object)transform == (Object)(object)_own || transform.IsChildOf(_own)))
{
return false;
}
if ((Object)(object)_root != (Object)null && ((Object)(object)transform == (Object)(object)_root || transform.IsChildOf(_root)))
{
return false;
}
if (BodyParts.Contains(((Object)((Component)col).gameObject).name))
{
return false;
}
if (value)
{
Rigidbody attachedRigidbody = col.attachedRigidbody;
if ((Object)(object)attachedRigidbody != (Object)null && !attachedRigidbody.isKinematic)
{
if (Cfg.KickOffEnemies.Value && IsEnemy(col))
{
return true;
}
return false;
}
}
return true;
}
static Surf()
{
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
Vector3[] obj = new Vector3[8]
{
Vector3.forward,
Vector3.back,
Vector3.left,
Vector3.right,
default(Vector3),
default(Vector3),
default(Vector3),
default(Vector3)
};
Vector3 val = new Vector3(1f, 0f, 1f);
obj[4] = ((Vector3)(ref val)).normalized;
val = new Vector3(-1f, 0f, 1f);
obj[5] = ((Vector3)(ref val)).normalized;
val = new Vector3(1f, 0f, -1f);
obj[6] = ((Vector3)(ref val)).normalized;
val = new Vector3(-1f, 0f, -1f);
obj[7] = ((Vector3)(ref val)).normalized;
Dirs = (Vector3[])(object)obj;
_tHow = "нет";
}
}
public class WallKickMod : MelonMod
{
private const string Tag = "[WallKick]";
private static readonly List<HVRController> Ctls = new List<HVRController>();
private static readonly List<HVRHandGrabber> Grabbers = new List<HVRHandGrabber>();
private static HexaBodyPlayer4 _body;
private static bool _found;
private static bool _rampActive;
private static float _rampLeft;
private static float _rampTotal;
private static float _holdLeft;
private static float _kickSpeed;
private static float _kickApex;
private static Vector3 _kickPlanar;
private static float _waitWindow;
private static float _cooldown;
private static bool _queuedByPress;
private static bool _comboWas;
private static bool _fired;
private static bool _jumpWas;
private static bool _trigWas;
private static bool _order;
private static float _hitDelayLeft;
private static float _chainF = -1f;
private static int _chainStep;
private static float _takeoffAt = -1f;
private static float _lastAirborneAt = -1f;
private static Vector3 _wallOut;
private static float _wallGap = -1f;
private static int _wallCount;
private static string _wallName = "";
private static bool _wallEnemy;
private static float _arcTimer;
private static float _arcLogTimer;
private static float _arcStartY;
private static bool _loggedLookSource;
private static Transform _lookRoot;
public override void OnInitializeMelon()
{
Cfg.Register();
MelonLogger.Msg("[WallKick] v2.0.8 — проверка курса fail-closed, порядок A затем триггер.");
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
HardReset();
_body = null;
_found = false;
Ctls.Clear();
Grabbers.Clear();
}
public override void OnDeinitializeMelon()
{
HardReset();
}
private static void HardReset()
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
_rampActive = false;
_rampLeft = 0f;
_holdLeft = 0f;
_hitDelayLeft = 0f;
_waitWindow = 0f;
_cooldown = 0f;
_queuedByPress = false;
_comboWas = false;
_fired = false;
_jumpWas = false;
_trigWas = false;
_order = false;
_chainF = -1f;
_chainStep = 0;
_arcTimer = 0f;
_takeoffAt = -1f;
_lastAirborneAt = -1f;
_wallCount = 0;
_wallGap = -1f;
_wallName = "";
_wallOut = Vector3.zero;
_wallEnemy = false;
}
private static bool TriggerHeld()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < Ctls.Count; i++)
{
HVRController val = Ctls[i];
if ((Object)(object)val != (Object)null && val.TriggerButtonState.Active)
{
return true;
}
}
return false;
}
private static string TriggerNames()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
string text = "контроллеров=" + Ctls.Count;
for (int i = 0; i < Ctls.Count; i++)
{
HVRController val = Ctls[i];
text = ((!((Object)(object)val == (Object)null)) ? (text + " " + ((object)val.Side/*cast due to .constrained prefix*/).ToString() + "=" + val.TriggerButtonState.Active) : (text + " [null]"));
}
return text;
}
public override void OnUpdate()
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
if (!Cfg.Enabled.Value || !EnsureBody())
{
return;
}
float unscaledDeltaTime = Time.unscaledDeltaTime;
if (_cooldown > 0f)
{
_cooldown -= unscaledDeltaTime;
}
if (_body.IsGrounded)
{
_takeoffAt = -1f;
_chainF = -1f;
_chainStep = 0;
}
else
{
if (_takeoffAt < 0f)
{
_takeoffAt = Time.time;
}
_lastAirborneAt = Time.time;
}
HexaBodyInputsBase inputs = HexaBodyPlayer4.Inputs;
bool num = (Object)(object)inputs != (Object)null && inputs.JumpState.Active;
bool flag = TriggerHeld();
bool jumpWas = _jumpWas;
_jumpWas = num;
bool flag2 = num && (!Cfg.RequireTrigger.Value || flag);
if (Cfg.RequireTrigger.Value && flag && !_trigWas && jumpWas)
{
_order = true;
}
if (num && !jumpWas && !_trigWas && flag)
{
_order = true;
}
if (num && !jumpWas && _trigWas)
{
_order = false;
}
_trigWas = flag;
if (flag2)
{
flag2 = _order;
}
bool num2 = flag2 && !_comboWas;
_comboWas = flag2;
if (!flag2)
{
_fired = false;
}
if (num2 && _cooldown <= 0f && !_fired)
{
_waitWindow = Mathf.Max(0f, Cfg.StickWindow.Value);
_queuedByPress = true;
}
if (!_fired && flag2 && _cooldown <= 0f && _hitDelayLeft <= 0f && ProbeWall() && CanKick())
{
QueueKick("A+триггер");
return;
}
if (_waitWindow > 0f && !_fired)
{
_waitWindow -= unscaledDeltaTime;
if (_cooldown <= 0f && _hitDelayLeft <= 0f && ProbeWall() && CanKick())
{
QueueKick(_queuedByPress ? "A+триггер (буфер)" : "A+триггер (окно)");
return;
}
if (_waitWindow <= 0f)
{
_queuedByPress = false;
}
}
if (!_fired && flag2 && ProbeWall())
{
_waitWindow = Mathf.Max(_waitWindow, Mathf.Max(0f, Cfg.StickWindow.Value));
}
}
private static bool HoldingStatic()
{
for (int i = 0; i < Grabbers.Count; i++)
{
HVRHandGrabber val = Grabbers[i];
if ((Object)(object)val == (Object)null)
{
continue;
}
try
{
if (val.IsClimbing)
{
return true;
}
if (((HVRGrabberBase)val).IsGrabbing && (Object)(object)((HVRGrabberBase)val).HeldObject != (Object)null && ((HVRGrabberBase)val).HeldObject.Stationary)
{
return true;
}
}
catch
{
}
}
return false;
}
private static float GazeForwardY()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
try
{
Camera main = Camera.main;
if ((Object)(object)main != (Object)null)
{
return ((Component)main).transform.forward.y;
}
}
catch
{
}
try
{
if ((Object)(object)_body != (Object)null && (Object)(object)_body.Head != (Object)null)
{
return ((Component)_body.Head).transform.forward.y;
}
}
catch
{
}
return 0f;
}
private static float FacingDot()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
if (!Cfg.RequireFacing.Value)
{
return -1f;
}
Vector3 val;
try
{
val = HorizontalLook();
}
catch
{
val = Vector3.zero;
}
if (((Vector3)(ref val)).sqrMagnitude < 1E-06f)
{
return -1f;
}
Vector3 wallOut = _wallOut;
wallOut.y = 0f;
if (((Vector3)(ref wallOut)).sqrMagnitude < 1E-06f)
{
return -1f;
}
return Vector3.Dot(-((Vector3)(ref wallOut)).normalized, ((Vector3)(ref val)).normalized);
}
private static Vector3 HorizontalLook()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
Vector3 result = Vector3.zero;
string text = "нет";
try
{
Camera val = Camera.main;
if ((Object)(object)val == (Object)null)
{
Camera[] array = Il2CppArrayBase<Camera>.op_Implicit((Il2CppArrayBase<Camera>)(object)Camera.allCameras);
for (int i = 0; i < array.Length; i++)
{
if (!((Object)(object)array[i] == (Object)null) && ((Behaviour)array[i]).isActiveAndEnabled)
{
val = array[i];
break;
}
}
}
if ((Object)(object)val != (Object)null)
{
result = ((Component)val).transform.forward;
text = ((Object)val).name;
}
}
catch
{
}
if (((Vector3)(ref result)).sqrMagnitude < 1E-06f)
{
try
{
if ((Object)(object)_body != (Object)null && (Object)(object)_body.Head != (Object)null)
{
result = ((Component)_body.Head).transform.forward;
text = "Head";
}
}
catch
{
}
}
if (((Vector3)(ref result)).sqrMagnitude < 1E-06f && (Object)(object)_lookRoot != (Object)null)
{
try
{
result = _lookRoot.forward;
text = "rig";
}
catch
{
}
}
if (!_loggedLookSource && ((Vector3)(ref result)).sqrMagnitude > 1E-06f)
{
_loggedLookSource = true;
MelonLogger.Msg("[WallKick] ВЗГЛЯД: источник = {0}, проверка курса включена (minDot={1:F2}).", new object[2]
{
text,
Cfg.FacingMinDot.Value
});
}
result.y = 0f;
return result;
}
private static float GazeDown()
{
if (!Cfg.GazeBlend.Value)
{
return Mathf.Clamp01(Cfg.KickUpMix.Value);
}
float num = Mathf.Clamp01((0f - GazeForwardY() - 0.15f) / 0.6f);
return num * num * (3f - 2f * num);
}
private static bool AirGrace()
{
if ((Object)(object)_body == (Object)null)
{
return false;
}
if (!_body.IsGrounded)
{
return true;
}
if (_lastAirborneAt >= 0f)
{
return Time.time - _lastAirborneAt <= Cfg.KickAirGrace.Value;
}
return false;
}
private static bool CanKick()
{
if ((Object)(object)_body == (Object)null || (Object)(object)_body.LocoBall == (Object)null)
{
return false;
}
if (Cfg.RequireAir.Value && !AirGrace())
{
MelonLogger.Msg("[WallKick] пропуск: игрок на земле.");
return false;
}
if (Cfg.NoKickWhileHolding.Value && HoldingStatic())
{
MelonLogger.Msg("[WallKick] пропуск: держимся за статику.");
return false;
}
float num = FacingDot();
if (Cfg.RequireFacing.Value)
{
if (num < 0f)
{
MelonLogger.Msg("[WallKick] пропуск: курс неизвестен (взгляд не получен).");
return false;
}
if (num < Cfg.FacingMinDot.Value)
{
MelonLogger.Msg("[WallKick] пропуск: цель не по курсу ({0:F2} < {1:F2}).", new object[2]
{
num,
Cfg.FacingMinDot.Value
});
return false;
}
}
if (_takeoffAt >= 0f && Time.time - _takeoffAt < Cfg.MinAirTime.Value)
{
MelonLogger.Msg("[WallKick] пропуск: отрыв был {0:F3} с назад.", new object[1] { Time.time - _takeoffAt });
return false;
}
return true;
}
private static void QueueKick(string reason)
{
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
float num = GazeDown();
float num2 = Mathf.Max(0f, Cfg.KickBackSpeed.Value) * (1f - num) * Mathf.Clamp01(Cfg.HorizontalDamp.Value);
float num3 = Mathf.Lerp(Mathf.Max(0f, Cfg.BackModeUp.Value), Mathf.Max(0f, Cfg.KickApex.Value), num);
if (_wallEnemy && Cfg.EnemyOnlyBack.Value)
{
num = 0f;
num2 = Mathf.Max(0f, Cfg.KickBackSpeed.Value) * Mathf.Clamp01(Cfg.HorizontalDamp.Value);
num3 = 0f;
}
float num4;
if (Cfg.KickChainDecay.Value > 0.001f)
{
if (_chainF < 0f)
{
num4 = 1f;
_chainStep = 1;
}
else
{
num4 = _chainF * Mathf.Clamp01(Cfg.KickChainDecay.Value);
_chainStep++;
}
_chainF = num4;
}
else
{
num4 = 1f;
_chainStep = 0;
}
float num5 = num3 * num4;
if (num3 > 0f && num5 < Mathf.Max(0f, Cfg.KickChainMinApex.Value))
{
num5 = 0f;
num4 = 0f;
_chainF = 0f;
}
float num6 = num2 * num4;
Vector3 forward = default(Vector3);
((Vector3)(ref forward))..ctor(_wallOut.x, 0f, _wallOut.z);
if (((Vector3)(ref forward)).sqrMagnitude < 1E-06f)
{
Vector3 val = (((Object)(object)_body.Head != (Object)null) ? ((Component)_body.Head).transform.forward : Vector3.forward);
((Vector3)(ref forward))..ctor(0f - val.x, 0f, 0f - val.z);
if (((Vector3)(ref forward)).sqrMagnitude < 1E-06f)
{
forward = Vector3.forward;
}
}
((Vector3)(ref forward)).Normalize();
_rampActive = true;
_rampTotal = Mathf.Max(0.02f, Cfg.KickRampTime.Value);
_rampLeft = _rampTotal;
_holdLeft = (_wallEnemy ? Mathf.Max(0f, Cfg.EnemyHold.Value) : Mathf.Max(0f, Cfg.KickHold.Value));
_hitDelayLeft = (_wallEnemy ? Mathf.Max(0f, Cfg.EnemyHitDelay.Value) : 0f);
_kickSpeed = Cfg.SpeedForApexValue(num5);
_kickApex = num5;
_kickPlanar = forward * num6;
_cooldown = Mathf.Max(0f, Cfg.Cooldown.Value);
_waitWindow = 0f;
_fired = true;
float num7 = (((Object)(object)_body.LocoBall != (Object)null) ? _body.LocoBall.velocity.y : 0f);
MelonLogger.Msg("[WallKick] ОТСКОК ({0}) #{1}: {2}=[{3}] d={4:F2} назад={5:F2}м/с высота={6:F2}м -> vY={7:F2}м/с взглядВниз={8:F2} (gazeY={9:F2}) vYвход={10:F2}{11} | {12}", new object[13]
{
reason,
_chainStep,
_wallEnemy ? "враг" : "стен",
_wallName,
_wallGap,
num6,
num5,
_kickSpeed,
num,
GazeForwardY(),
num7,
(_wallEnemy ? (" задержкаУдара=" + _hitDelayLeft.ToString("F2") + "с") : "") + ((num5 <= 0f) ? " (без подброса)" : ""),
TriggerNames()
});
}
public override void OnFixedUpdate()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_body == (Object)null || (Object)(object)_body.LocoBall == (Object)null)
{
return;
}
LogArc();
if (!_rampActive)
{
return;
}
if (_hitDelayLeft > 0f)
{
_hitDelayLeft -= Time.fixedDeltaTime;
if (_hitDelayLeft > 0f)
{
return;
}
MelonLogger.Msg("[WallKick] УДАР СОСТОЯЛСЯ, импульс по врагу");
}
Rigidbody locoBall = _body.LocoBall;
float fixedDeltaTime = Time.fixedDeltaTime;
Vector3 velocity = locoBall.velocity;
if (_rampLeft > 0f)
{
_rampLeft -= fixedDeltaTime;
float num = Mathf.Clamp01(1f - _rampLeft / _rampTotal);
float num2 = num * num * (3f - 2f * num);
float num3 = Mathf.Max(0.05f, Cfg.KickAccel.Value) * fixedDeltaTime;
Vector3 val = _kickPlanar - new Vector3(velocity.x, 0f, velocity.z);
if (((Vector3)(ref val)).sqrMagnitude > num3 * num3)
{
val = ((Vector3)(ref val)).normalized * num3;
}
float num4 = _kickSpeed * num2;
float num5 = (Cfg.KickExactApex.Value ? Mathf.Clamp(num4 - velocity.y, 0f - num3, num3) : Mathf.Clamp(num4 - velocity.y, 0f, num3));
PushVector(new Vector3(val.x, num5, val.z));
if (Cfg.KillSpin.Value)
{
ZeroSpin();
}
return;
}
float num6 = (Cfg.KickExactApex.Value ? _kickSpeed : ((velocity.y < _kickSpeed) ? _kickSpeed : velocity.y));
if (_holdLeft > 0f)
{
_holdLeft -= fixedDeltaTime;
PushVector(new Vector3(_kickPlanar.x, num6, _kickPlanar.z) - velocity);
if (Cfg.KillSpin.Value)
{
ZeroSpin();
}
}
else
{
PushVector(new Vector3(_kickPlanar.x, num6, _kickPlanar.z) - velocity);
_rampActive = false;
_arcTimer = Mathf.Max(0f, 1f);
_arcLogTimer = 0f;
_arcStartY = ((Component)locoBall).transform.position.y;
MelonLogger.Msg("[WallKick] ВЫХОД ИЗ РАЗГОНА: vY={0:F2} (цель {1:F2})", new object[2] { num6, _kickSpeed });
}
}
private static void PushVector(Vector3 delta)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
if (!(((Vector3)(ref delta)).sqrMagnitude < 1E-08f))
{
Add(_body.Head);
Add(_body.Pelvis);
Add(_body.Knee);
Add(_body.LocoBall);
}
void Add(Rigidbody rb)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rb == (Object)null))
{
rb.velocity += delta;
}
}
}
private static void ZeroSpin()
{
Zero(_body.Head);
Zero(_body.Pelvis);
Zero(_body.Knee);
Zero(_body.LocoBall);
static void Zero(Rigidbody rb)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rb == (Object)null))
{
rb.angularVelocity = Vector3.zero;
}
}
}
private static void LogArc()
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
if (!(_arcTimer <= 0f) && Cfg.Verbose.Value && !((Object)(object)_body.LocoBall == (Object)null))
{
_arcTimer -= Time.fixedDeltaTime;
_arcLogTimer -= Time.fixedDeltaTime;
if (!(_arcLogTimer > 0f))
{
_arcLogTimer = 0.08f;
Rigidbody locoBall = _body.LocoBall;
float num = ((Component)locoBall).transform.position.y - _arcStartY;
Vector3 velocity = locoBall.velocity;
MelonLogger.Msg("[WallKick] полёт t={0:F2} v=({1:F2},{2:F2},{3:F2}) высота={4:F2} grounded={5}", new object[6]
{
Mathf.Max(0f, 1f - _arcTimer),
velocity.x,
velocity.y,
velocity.z,
num,
_body.IsGrounded
});
}
}
}
private static bool ProbeWall()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
_wallCount = 0;
_wallGap = -1f;
_wallName = "";
_wallEnemy = false;
if ((Object)(object)_body == (Object)null || (Object)(object)_body.LocoBall == (Object)null)
{
return false;
}
Vector3 point = ((Component)_body.LocoBall).transform.position + Vector3.up * Cfg.ProbeHeight.Value;
float radius = Mathf.Max(Cfg.ProbeRadius.Value, Cfg.EnemyProbeRadius.Value);
if (Surf.FindMulti(point, radius, Cfg.MaxUpness.Value, out _wallOut, out _wallGap, out _wallName, out _wallEnemy))
{
_wallCount = 1;
}
return _wallCount > 0;
}
private static bool EnsureBody()
{
if ((Object)(object)_body != (Object)null)
{
return true;
}
HexaBodyPlayer4[] array = Il2CppArrayBase<HexaBodyPlayer4>.op_Implicit(Object.FindObjectsOfType<HexaBodyPlayer4>(false));
foreach (HexaBodyPlayer4 val in array)
{
if ((Object)(object)val == (Object)null || (Object)(object)val.LocoBall == (Object)null)
{
continue;
}
_body = val;
Ctls.Clear();
Grabbers.Clear();
Transform val2 = (_lookRoot = ((Component)val).transform.root);
if ((Object)(object)val2 != (Object)null)
{
HVRController[] array2 = Il2CppArrayBase<HVRController>.op_Implicit(((Component)val2).GetComponentsInChildren<HVRController>(true));
if (array2 != null)
{
Ctls.AddRange(array2);
}
HVRHandGrabber[] array3 = Il2CppArrayBase<HVRHandGrabber>.op_Implicit(((Component)val2).GetComponentsInChildren<HVRHandGrabber>(true));
if (array3 != null)
{
Grabbers.AddRange(array3);
}
}
if (Ctls.Count == 0)
{
HVRController[] array4 = Il2CppArrayBase<HVRController>.op_Implicit(Object.FindObjectsOfType<HVRController>(false));
if (array4 != null)
{
Ctls.AddRange(array4);
}
}
if (Grabbers.Count == 0)
{
HVRHandGrabber[] array5 = Il2CppArrayBase<HVRHandGrabber>.op_Implicit(Object.FindObjectsOfType<HVRHandGrabber>(false));
if (array5 != null)
{
Grabbers.AddRange(array5);
}
}
MelonLogger.Msg("[WallKick] найден HexaBodyPlayer4: {0}", new object[1] { ((Object)val).name });
MelonLogger.Msg("[WallKick] maxVertAcc={0:F2} airAcc={1:F2} gravity={2:F2} ballMass={3:F2}", new object[4]
{
val.MaxVerticalAcceleration,
val.AirAcceleration,
val.Gravity,
val.LocoBall.mass
});
MelonLogger.Msg("[WallKick] apex {0:F2}м -> {1:F2}м/с; {2}", new object[3]
{
Cfg.KickApex.Value,
Cfg.SpeedForApex(),
TriggerNames()
});
if (Ctls.Count == 0)
{
MelonLogger.Msg("[WallKick] ВНИМАНИЕ: контроллеры не найдены, A+триггер не сработает.");
}
Surf.Init(val);
return true;
}
if (!_found)
{
_found = true;
MelonLogger.Msg("[WallKick] ждём появления игрока в сцене...");
}
return false;
}
}
}