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 System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GorillaLocomotion;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.XR;
using UnityEngine.XR.Interaction.Toolkit;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("hussspace")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("huss harold")]
[assembly: AssemblyTitle("hussspace")]
[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 hussspace
{
[HarmonyPatch(typeof(Player), "Update")]
internal static class CrawlPatch
{
private static void Prefix(Player __instance, out Vector3 __state)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
__state = ((Component)__instance).transform.position;
}
private static void Postfix(Player __instance, Vector3 __state)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: 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_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
float deltaTime = Time.deltaTime;
if (deltaTime <= 0f)
{
return;
}
Vector3 val = ((Component)__instance).transform.position - __state;
val.y = 0f;
bool flag = __instance.wasLeftHandTouching || __instance.wasRightHandTouching;
float num = (flag ? (((Vector3)(ref val)).magnitude / deltaTime) : 0f);
Plugin.CrawlSpeed = Mathf.Lerp(Plugin.CrawlSpeed, num, 10f * deltaTime);
if (!flag)
{
Plugin.CrawlMult = 1f;
}
else
{
if (val == Vector3.zero)
{
return;
}
float num2 = Mathf.InverseLerp(Plugin.CrawlMin.Value, Plugin.CrawlMax.Value, Plugin.CrawlSpeed);
float num3 = (Plugin.CrawlMult = Mathf.Lerp(1f, Plugin.CrawlMaxMult.Value, num2));
if (!(num3 <= 1.001f))
{
Vector3 val2 = val * (num3 - 1f);
float radius = __instance.headCollider.radius;
RaycastHit val3 = default(RaycastHit);
if (Physics.SphereCast(((Component)__instance.headCollider).transform.position, radius, ((Vector3)(ref val2)).normalized, ref val3, ((Vector3)(ref val2)).magnitude + 0.01f, ((LayerMask)(ref __instance.locomotionEnabledLayers)).value))
{
val2 = ((Vector3)(ref val2)).normalized * Mathf.Max(0f, ((RaycastHit)(ref val3)).distance - 0.01f);
}
if (!(val2 == Vector3.zero))
{
Transform transform = ((Component)__instance).transform;
transform.position += val2;
__instance.lastLeftHandPosition += val2;
__instance.lastRightHandPosition += val2;
__instance.lastHeadPosition += val2;
__instance.lastPosition += val2;
Transform leftHandFollower = __instance.leftHandFollower;
leftHandFollower.position += val2;
Transform rightHandFollower = __instance.rightHandFollower;
rightHandFollower.position += val2;
}
}
}
}
}
internal class DebugOverlay : MonoBehaviour
{
private TextMesh text;
private Rect windowRect = new Rect(20f, 20f, 330f, 0f);
private bool dirty;
private bool openSpeed = true;
private bool openText = true;
private bool openArena;
private Vector3 lastPos;
private bool hasLast;
private Vector3 velocity;
private readonly StringBuilder fullSb = new StringBuilder();
private readonly StringBuilder handSb = new StringBuilder();
private string readoutFull = "";
private static readonly string[] PresetNames = new string[9] { "Green", "White", "Cyan", "Yellow", "Orange", "Red", "Pink", "Blue", "Custom" };
private static readonly Color[] PresetColors = (Color[])(object)new Color[8]
{
new Color(0.2f, 1f, 0.2f),
Color.white,
Color.cyan,
Color.yellow,
new Color(1f, 0.55f, 0.1f),
new Color(1f, 0.25f, 0.25f),
new Color(1f, 0.4f, 0.8f),
new Color(0.4f, 0.6f, 1f)
};
private static ConfigEntry<bool>[] LineToggles => new ConfigEntry<bool>[6]
{
Plugin.ShowPosture,
Plugin.ShowVelocity,
Plugin.ShowSpeed,
Plugin.ShowSwing,
Plugin.ShowCrawl,
Plugin.ShowMove
};
private void OnGUI()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Invalid comparison between Unknown and I4
((Rect)(ref windowRect)).height = 0f;
windowRect = GUILayout.Window(18517, windowRect, new WindowFunction(DrawWindow), "hussspace", Array.Empty<GUILayoutOption>());
if (dirty && (int)Event.current.rawType == 1)
{
Plugin.SaveConfig();
dirty = false;
}
}
private void DrawWindow(int id)
{
Toggle(" Debug mode (F3)", Plugin.DebugEnabled);
if (Plugin.DebugEnabled.Value)
{
GUILayout.Label(((Object)(object)Plugin.GetPlayer() == (Object)null) ? "Player not found yet" : readoutFull, Array.Empty<GUILayoutOption>());
openSpeed = Foldout(openSpeed, "Speed tuning");
if (openSpeed)
{
DrawSpeedSection();
}
openText = Foldout(openText, "Hand text");
if (openText)
{
DrawTextSection();
}
openArena = Foldout(openArena, "Test arena");
if (openArena)
{
DrawArenaSection();
}
}
GUI.DragWindow();
}
private void DrawSpeedSection()
{
GUILayout.Label("Walk (standing, arm waving)", Array.Empty<GUILayoutOption>());
Slider("Max speed x", Plugin.WalkMaxMult, 1f, 8f);
Slider("Waving starts at", Plugin.SwingMin, 0f, 3f);
Slider("Waving max at", Plugin.SwingMax, 0.5f, 5f);
GUILayout.Space(4f);
GUILayout.Label("Crawl", Array.Empty<GUILayoutOption>());
Slider("Max speed x", Plugin.CrawlMaxMult, 1f, 10f);
Slider("Crawl starts at", Plugin.CrawlMin, 0f, 2f);
Slider("Crawl max at", Plugin.CrawlMax, 0.5f, 4f);
if (GUILayout.Button("Reset speed sliders to defaults", Array.Empty<GUILayoutOption>()))
{
ConfigEntry<float>[] array = new ConfigEntry<float>[6]
{
Plugin.WalkMaxMult,
Plugin.SwingMin,
Plugin.SwingMax,
Plugin.CrawlMaxMult,
Plugin.CrawlMin,
Plugin.CrawlMax
};
ConfigEntry<float>[] array2 = array;
foreach (ConfigEntry<float> val in array2)
{
((ConfigEntryBase)val).BoxedValue = ((ConfigEntryBase)val).DefaultValue;
}
dirty = true;
}
}
private void DrawTextSection()
{
GUILayout.Label("Show on the hand text:", Array.Empty<GUILayoutOption>());
Toggle(" Posture (standing / crawling)", Plugin.ShowPosture);
Toggle(" Velocity (x, y, z)", Plugin.ShowVelocity);
Toggle(" Speed", Plugin.ShowSpeed);
Toggle(" Arm swing + walk multiplier", Plugin.ShowSwing);
Toggle(" Crawl speed + multiplier", Plugin.ShowCrawl);
Toggle(" Walk speed (base / now)", Plugin.ShowMove);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Speed only", Array.Empty<GUILayoutOption>()))
{
ConfigEntry<bool>[] lineToggles = LineToggles;
foreach (ConfigEntry<bool> val in lineToggles)
{
val.Value = val == Plugin.ShowSpeed;
}
dirty = true;
}
if (GUILayout.Button("Show all", Array.Empty<GUILayoutOption>()))
{
ConfigEntry<bool>[] lineToggles2 = LineToggles;
foreach (ConfigEntry<bool> val2 in lineToggles2)
{
val2.Value = true;
}
dirty = true;
}
GUILayout.EndHorizontal();
GUILayout.Space(6f);
Toggle(" Keep upright (don't tilt with the hand)", Plugin.KeepUpright);
Toggle(" Only show while looking at it", Plugin.LookToShow);
Slider("Text size", Plugin.ReadoutSize, 0.004f, 0.04f);
Slider("Height above hand", Plugin.TextHeight, 0f, 0.5f);
Slider("Look angle", Plugin.LookAngle, 10f, 90f);
GUILayout.Space(6f);
GUILayout.Label("Color", Array.Empty<GUILayoutOption>());
int num = Mathf.Clamp(Plugin.ColorPreset.Value, 0, PresetNames.Length - 1);
int num2 = GUILayout.SelectionGrid(num, PresetNames, 3, Array.Empty<GUILayoutOption>());
if (num2 != num)
{
Plugin.ColorPreset.Value = num2;
dirty = true;
}
if (num2 == PresetNames.Length - 1)
{
Slider("Red", Plugin.ColorR, 0f, 1f);
Slider("Green", Plugin.ColorG, 0f, 1f);
Slider("Blue", Plugin.ColorB, 0f, 1f);
}
}
private void DrawArenaSection()
{
Slider("Vent width", Plugin.VentWidth, 0.6f, 2f);
Slider("Vent height", Plugin.VentHeight, 0.5f, 1.6f);
TestArena instance = TestArena.Instance;
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button(((Object)(object)instance != (Object)null && instance.InArena) ? "Leave arena (F4)" : "Enter arena (F4)", Array.Empty<GUILayoutOption>()) && (Object)(object)instance != (Object)null)
{
instance.Toggle();
}
if (GUILayout.Button("Rebuild vents", Array.Empty<GUILayoutOption>()) && (Object)(object)instance != (Object)null)
{
instance.Rebuild();
}
GUILayout.EndHorizontal();
}
private static bool Foldout(bool open, string title)
{
return GUILayout.Toggle(open, (open ? "[-] " : "[+] ") + title, GUI.skin.button, Array.Empty<GUILayoutOption>());
}
private void Toggle(string label, ConfigEntry<bool> entry)
{
bool flag = GUILayout.Toggle(entry.Value, label, Array.Empty<GUILayoutOption>());
if (flag != entry.Value)
{
entry.Value = flag;
dirty = true;
}
}
private void Slider(string label, ConfigEntry<float> entry, float min, float max)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(label + " " + entry.Value.ToString("F2"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) });
float num = GUILayout.HorizontalSlider(entry.Value, min, max, Array.Empty<GUILayoutOption>());
GUILayout.EndHorizontal();
if (!Mathf.Approximately(num, entry.Value))
{
entry.Value = num;
dirty = true;
}
}
private void Update()
{
Keyboard current = Keyboard.current;
if (current != null && ((ButtonControl)current.f3Key).wasPressedThisFrame)
{
Plugin.DebugEnabled.Value = !Plugin.DebugEnabled.Value;
Plugin.SaveConfig();
}
}
private static Color CurrentColor()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
int num = Mathf.Clamp(Plugin.ColorPreset.Value, 0, PresetNames.Length - 1);
if (num == PresetNames.Length - 1)
{
return new Color(Plugin.ColorR.Value, Plugin.ColorG.Value, Plugin.ColorB.Value);
}
return PresetColors[num];
}
private void AddLine(string line, ConfigEntry<bool> showOnHand)
{
if (fullSb.Length > 0)
{
fullSb.Append('\n');
}
fullSb.Append(line);
if (showOnHand.Value)
{
if (handSb.Length > 0)
{
handSb.Append('\n');
}
handSb.Append(line);
}
}
private void LateUpdate()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_0110: 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_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
Player player = Plugin.GetPlayer();
if ((Object)(object)player == (Object)null || !Plugin.DebugEnabled.Value)
{
SetVisible(visible: false);
hasLast = false;
return;
}
float deltaTime = Time.deltaTime;
Vector3 position = ((Component)player).transform.position;
if (hasLast && deltaTime > 0f)
{
velocity = Vector3.Lerp(velocity, (position - lastPos) / deltaTime, 15f * deltaTime);
}
lastPos = position;
hasLast = true;
MoveTypeController moveCtrl = Plugin.MoveCtrl;
bool flag = player.wasLeftHandTouching || player.wasRightHandTouching;
string line = ((!((Object)(object)moveCtrl != (Object)null)) ? (flag ? "Crawling" : "Unknown") : (moveCtrl.debugSwitch ? "Standing" : "Crawling"));
float magnitude = ((Vector3)(ref velocity)).magnitude;
Vector3 val = new Vector3(velocity.x, 0f, velocity.z);
float magnitude2 = ((Vector3)(ref val)).magnitude;
fullSb.Length = 0;
handSb.Length = 0;
AddLine(line, Plugin.ShowPosture);
AddLine($"Vel {velocity.x:F2}, {velocity.y:F2}, {velocity.z:F2}", Plugin.ShowVelocity);
AddLine($"Speed {magnitude:F2} m/s (flat {magnitude2:F2})", Plugin.ShowSpeed);
AddLine($"Swing {Plugin.SwingSpeed:F2} Walk x{Plugin.walkMult:F2}", Plugin.ShowSwing);
AddLine($"Crawl {Plugin.CrawlSpeed:F2} x{Plugin.CrawlMult:F2}", Plugin.ShowCrawl);
AddLine($"Move base {Plugin.BaseMoveSpeed:F2} now {Plugin.CurrentMoveSpeed:F2}", Plugin.ShowMove);
readoutFull = fullSb.ToString();
if (handSb.Length == 0)
{
SetVisible(visible: false);
return;
}
EnsureText();
text.characterSize = Plugin.ReadoutSize.Value;
text.color = CurrentColor();
text.text = handSb.ToString();
SetVisible(visible: true);
Transform rightHandTransform = player.rightHandTransform;
Transform transform = ((Component)player.headCollider).transform;
((Component)text).transform.position = rightHandTransform.position + Vector3.up * Plugin.TextHeight.Value;
Vector3 val2 = ((Component)text).transform.position - transform.position;
if (Plugin.KeepUpright.Value)
{
val2.y = 0f;
}
if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f)
{
((Component)text).transform.rotation = Quaternion.LookRotation(val2, Vector3.up);
}
if (Plugin.LookToShow.Value)
{
Transform val3 = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform : transform);
float num = Vector3.Angle(val3.forward, ((Component)text).transform.position - val3.position);
SetVisible(num < Plugin.LookAngle.Value);
}
}
private void EnsureText()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
if (!((Object)(object)text != (Object)null))
{
GameObject val = new GameObject("hussspace_debug_text");
((Object)val).hideFlags = (HideFlags)61;
text = val.AddComponent<TextMesh>();
Font builtinResource = Resources.GetBuiltinResource<Font>("Arial.ttf");
text.font = builtinResource;
((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterial = builtinResource.material;
text.fontSize = 48;
text.anchor = (TextAnchor)7;
text.alignment = (TextAlignment)1;
Plugin.Logger.LogInfo((object)"Created debug readout text object.");
}
}
private void SetVisible(bool visible)
{
if ((Object)(object)text != (Object)null && ((Component)text).gameObject.activeSelf != visible)
{
((Component)text).gameObject.SetActive(visible);
}
}
private void OnDestroy()
{
if ((Object)(object)text != (Object)null)
{
Object.Destroy((Object)(object)((Component)text).gameObject);
}
}
}
[BepInPlugin("hussspace", "huss harold", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
internal static Plugin Instance;
internal static float SwingSpeed;
internal static float CrawlSpeed;
internal static float CrawlMult = 1f;
internal static float walkMult = 1f;
internal static float BaseMoveSpeed;
internal static float CurrentMoveSpeed;
internal static ConfigEntry<float> SwingMin;
internal static ConfigEntry<float> SwingMax;
internal static ConfigEntry<float> WalkMaxMult;
internal static ConfigEntry<float> CrawlMin;
internal static ConfigEntry<float> CrawlMax;
internal static ConfigEntry<float> CrawlMaxMult;
internal static ConfigEntry<bool> DebugEnabled;
internal static ConfigEntry<bool> LookToShow;
internal static ConfigEntry<float> ReadoutSize;
internal static ConfigEntry<float> LookAngle;
internal static ConfigEntry<float> VentWidth;
internal static ConfigEntry<float> VentHeight;
internal static ConfigEntry<bool> ShowPosture;
internal static ConfigEntry<bool> ShowVelocity;
internal static ConfigEntry<bool> ShowSpeed;
internal static ConfigEntry<bool> ShowSwing;
internal static ConfigEntry<bool> ShowCrawl;
internal static ConfigEntry<bool> ShowMove;
internal static ConfigEntry<bool> KeepUpright;
internal static ConfigEntry<float> TextHeight;
internal static ConfigEntry<float> ColorR;
internal static ConfigEntry<float> ColorG;
internal static ConfigEntry<float> ColorB;
internal static ConfigEntry<int> ColorPreset;
private static MoveTypeController moveCtrl;
private static ContinuousMoveProviderBase provider;
private static float lastSetSpeed;
private float findTimer;
private float logTimer;
private static Player cachedPlayer;
private static float nextPlayerSearch;
internal static MoveTypeController MoveCtrl => moveCtrl;
internal static Player GetPlayer()
{
if ((Object)(object)cachedPlayer != (Object)null)
{
return cachedPlayer;
}
if ((Object)(object)Player.Instance != (Object)null)
{
cachedPlayer = Player.Instance;
return cachedPlayer;
}
if (Time.unscaledTime < nextPlayerSearch)
{
return null;
}
nextPlayerSearch = Time.unscaledTime + 1f;
cachedPlayer = Object.FindObjectOfType<Player>();
if ((Object)(object)cachedPlayer != (Object)null)
{
Logger.LogInfo((object)("Found Player on '" + ((Object)((Component)cachedPlayer).gameObject).name + "'"));
}
return cachedPlayer;
}
internal static void SaveConfig()
{
if ((Object)(object)Instance != (Object)null)
{
((BaseUnityPlugin)Instance).Config.Save();
}
}
private void Awake()
{
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Expected O, but got Unknown
//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
SwingMin = ((BaseUnityPlugin)this).Config.Bind<float>("Walk", "SwingMin", 0.6f, "Hand speed (m/s) below which waving gives no bonus.");
SwingMax = ((BaseUnityPlugin)this).Config.Bind<float>("Walk", "SwingMax", 2f, "Hand speed (m/s) at which the walk bonus reaches its cap.");
WalkMaxMult = ((BaseUnityPlugin)this).Config.Bind<float>("Walk", "MaxMultiplier", 2.5f, "Walk speed multiplier at the cap.");
CrawlMin = ((BaseUnityPlugin)this).Config.Bind<float>("Crawl", "CrawlMin", 0.3f, "Crawl speed (m/s) below which there is no bonus.");
CrawlMax = ((BaseUnityPlugin)this).Config.Bind<float>("Crawl", "CrawlMax", 1.5f, "Crawl speed (m/s) at which the crawl bonus reaches its cap.");
CrawlMaxMult = ((BaseUnityPlugin)this).Config.Bind<float>("Crawl", "MaxMultiplier", 3.5f, "Crawl speed multiplier at the cap.");
DebugEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Enabled", false, "Show the readout above your right hand and the tuning sliders.");
ReadoutSize = ((BaseUnityPlugin)this).Config.Bind<float>("Debug", "ReadoutSize", 0.012f, "TextMesh character size of the hand readout.");
LookToShow = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LookToShow", true, "Only show the hand readout while you are looking toward it.");
LookAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Debug", "LookAngle", 35f, "How close (degrees) to the readout your gaze must be for it to appear.");
ShowPosture = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "ShowPosture", true, "Show Standing/Crawling on the hand text.");
ShowVelocity = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "ShowVelocity", true, "Show the x, y, z velocity on the hand text.");
ShowSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "ShowSpeed", true, "Show the player's speed on the hand text.");
ShowSwing = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "ShowSwing", true, "Show arm swing speed and walk multiplier on the hand text.");
ShowCrawl = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "ShowCrawl", true, "Show crawl speed and multiplier on the hand text.");
ShowMove = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "ShowMove", true, "Show the base and current walk speed on the hand text.");
KeepUpright = ((BaseUnityPlugin)this).Config.Bind<bool>("Text", "KeepUpright", true, "Keep the text vertical no matter how the hand is tilted.");
TextHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Text", "HeightAboveHand", 0.15f, "How far (m) above the hand the text floats.");
ColorPreset = ((BaseUnityPlugin)this).Config.Bind<int>("Text", "ColorPreset", 0, "Index of the color preset (the last one is Custom).");
ColorR = ((BaseUnityPlugin)this).Config.Bind<float>("Text", "CustomRed", 0.2f, "Red of the Custom color.");
ColorG = ((BaseUnityPlugin)this).Config.Bind<float>("Text", "CustomGreen", 1f, "Green of the Custom color.");
ColorB = ((BaseUnityPlugin)this).Config.Bind<float>("Text", "CustomBlue", 0.2f, "Blue of the Custom color.");
VentWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Arena", "VentWidth", 1f, "Inner width (m) of the test arena vents.");
VentHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Arena", "VentHeight", 0.9f, "Inner height (m) of the test arena vents.");
Harmony val = new Harmony("hussspace");
val.PatchAll();
try
{
MethodInfo methodInfo = AccessTools.Method(typeof(ContinuousMoveProviderBase), "Update", (Type[])null, (Type[])null);
if (methodInfo == null)
{
Logger.LogWarning((object)"ContinuousMoveProviderBase.Update not found; falling back to per-frame setting.");
}
else
{
val.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Plugin), "WalkPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Logger.LogInfo((object)"Patched ContinuousMoveProviderBase.Update");
}
}
catch (Exception ex)
{
Logger.LogWarning((object)("Could not patch move provider: " + ex.Message));
}
((Component)this).gameObject.AddComponent<DebugOverlay>();
((Component)this).gameObject.AddComponent<TestArena>();
Logger.LogInfo((object)"Plugin hussspace is loaded!");
}
private void OnApplicationQuit()
{
((BaseUnityPlugin)this).Config.Save();
}
private void OnDisable()
{
Logger.LogWarning((object)"Plugin component was disabled.");
}
private void OnDestroy()
{
Logger.LogWarning((object)"Plugin object was destroyed.");
}
private void Update()
{
float unscaledDeltaTime = Time.unscaledDeltaTime;
float handSpeed = GetHandSpeed((XRNode)4);
float handSpeed2 = GetHandSpeed((XRNode)5);
SwingSpeed = Mathf.Lerp(SwingSpeed, (handSpeed + handSpeed2) * 0.5f, 10f * unscaledDeltaTime);
if ((Object)(object)provider == (Object)null || (Object)(object)moveCtrl == (Object)null)
{
findTimer += unscaledDeltaTime;
if (findTimer >= 2f)
{
findTimer = 0f;
FindTargets();
}
}
ApplyWalkSpeed();
logTimer += unscaledDeltaTime;
if (logTimer >= 1f)
{
logTimer = 0f;
string text = (((Object)(object)moveCtrl == (Object)null) ? "no-controller" : (moveCtrl.debugSwitch ? "standing" : "crawling"));
Logger.LogInfo((object)$"state={text} swing={SwingSpeed:F2} walkMult={walkMult:F2} moveSpeed base={BaseMoveSpeed:F2} now={CurrentMoveSpeed:F2} crawl={CrawlSpeed:F2} x{CrawlMult:F2}");
}
}
private static void FindTargets()
{
MoveTypeController val = Object.FindObjectOfType<MoveTypeController>();
if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)moveCtrl)
{
moveCtrl = val;
Logger.LogInfo((object)$"Found MoveTypeController on '{((Object)((Component)val).gameObject).name}', standingSpeed={val.standingSpeed}");
}
if ((Object)(object)moveCtrl != (Object)null && (Object)(object)moveCtrl.cmpb != (Object)null)
{
if ((Object)(object)provider != (Object)(object)moveCtrl.cmpb)
{
provider = moveCtrl.cmpb;
lastSetSpeed = provider.moveSpeed;
Logger.LogInfo((object)("Using the controller's move provider on '" + ((Object)((Component)provider).gameObject).name + "'"));
}
}
else if ((Object)(object)provider == (Object)null)
{
provider = Object.FindObjectOfType<ContinuousMoveProviderBase>();
if ((Object)(object)provider != (Object)null)
{
BaseMoveSpeed = provider.moveSpeed;
lastSetSpeed = BaseMoveSpeed;
Logger.LogInfo((object)("Using fallback move provider on '" + ((Object)((Component)provider).gameObject).name + "'"));
}
}
}
internal static void WalkPrefix(ContinuousMoveProviderBase __instance)
{
if ((Object)(object)provider != (Object)null && __instance == provider)
{
ApplyWalkSpeed();
}
}
private static void ApplyWalkSpeed()
{
if ((Object)(object)provider == (Object)null)
{
return;
}
float num = Mathf.InverseLerp(SwingMin.Value, SwingMax.Value, SwingSpeed);
if ((Object)(object)moveCtrl != (Object)null)
{
BaseMoveSpeed = moveCtrl.standingSpeed;
if (!moveCtrl.debugSwitch)
{
walkMult = 1f;
CurrentMoveSpeed = provider.moveSpeed;
return;
}
}
else
{
if (!Mathf.Approximately(provider.moveSpeed, lastSetSpeed))
{
BaseMoveSpeed = provider.moveSpeed;
}
Player player = GetPlayer();
if ((Object)(object)player != (Object)null && (player.wasLeftHandTouching || player.wasRightHandTouching))
{
num = 0f;
}
}
walkMult = Mathf.Lerp(1f, WalkMaxMult.Value, num);
lastSetSpeed = BaseMoveSpeed * walkMult;
CurrentMoveSpeed = lastSetSpeed;
provider.moveSpeed = lastSetSpeed;
}
private static float GetHandSpeed(XRNode node)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode(node);
if (!((InputDevice)(ref deviceAtXRNode)).isValid)
{
return 0f;
}
Vector3 val = default(Vector3);
if (((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.deviceVelocity, ref val))
{
return ((Vector3)(ref val)).magnitude;
}
return 0f;
}
}
internal class TestArena : MonoBehaviour
{
internal static TestArena Instance;
private static readonly Vector3 Origin = new Vector3(2000f, 0f, 2000f);
private const float FloorHalf = 40f;
private const float StandHalf = 35f;
private const float SprintLen = 60f;
private const float Wall = 0.2f;
private GameObject root;
private Vector3 returnHead;
private bool returnStanding;
private MoveTypeController savedCtrl;
private float sMinX;
private float sMaxX;
private float sMinZ;
private float sMaxZ;
private AmbientMode savedMode;
private Color savedAmbient;
internal bool InArena { get; private set; }
private void Awake()
{
Instance = this;
}
private void Update()
{
Keyboard current = Keyboard.current;
if (current != null && ((ButtonControl)current.f4Key).wasPressedThisFrame)
{
Toggle();
}
if (InArena && (Object)(object)root == (Object)null)
{
InArena = false;
savedCtrl = null;
Plugin.Logger.LogWarning((object)"Test arena was destroyed (scene change?).");
}
}
internal void Toggle()
{
if (InArena)
{
Exit();
}
else
{
Enter();
}
}
internal void Rebuild()
{
bool inArena = InArena;
if (inArena)
{
Exit();
}
if ((Object)(object)root != (Object)null)
{
Object.Destroy((Object)(object)root);
}
root = null;
if (inArena)
{
Enter();
}
}
internal void Enter()
{
//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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_00bf: 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_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
if (InArena)
{
return;
}
Player player = Plugin.GetPlayer();
if ((Object)(object)player == (Object)null)
{
Plugin.Logger.LogWarning((object)"Can't enter the test arena: Player not found yet.");
return;
}
if ((Object)(object)root == (Object)null)
{
Build();
}
MoveTypeController moveCtrl = Plugin.MoveCtrl;
Transform transform = ((Component)player.headCollider).transform;
bool flag = (Object)(object)moveCtrl != (Object)null && moveCtrl.debugSwitch;
float num = (flag ? 1.6f : 0.6f);
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(transform.position, Vector3.down, ref val, 5f, ((LayerMask)(ref player.locomotionEnabledLayers)).value))
{
num = transform.position.y - ((RaycastHit)(ref val)).point.y;
}
returnHead = transform.position;
returnStanding = flag;
if ((Object)(object)moveCtrl != (Object)null)
{
savedCtrl = moveCtrl;
sMinX = moveCtrl.standminX;
sMaxX = moveCtrl.standmaxX;
sMinZ = moveCtrl.standminZ;
sMaxZ = moveCtrl.standmaxZ;
moveCtrl.standminX = Origin.x - 35f;
moveCtrl.standmaxX = Origin.x + 35f;
moveCtrl.standminZ = Origin.z - 35f;
moveCtrl.standmaxZ = Origin.z + 35f;
}
savedMode = RenderSettings.ambientMode;
savedAmbient = RenderSettings.ambientLight;
RenderSettings.ambientMode = (AmbientMode)3;
RenderSettings.ambientLight = new Color(0.45f, 0.45f, 0.5f);
TeleportHeadTo(player, new Vector3(Origin.x, Origin.y + num + 0.05f, Origin.z));
InArena = true;
Plugin.Logger.LogInfo((object)"Entered test arena.");
}
internal void Exit()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
if (InArena)
{
Player player = Plugin.GetPlayer();
if ((Object)(object)player != (Object)null)
{
TeleportHeadTo(player, returnHead);
}
if ((Object)(object)savedCtrl != (Object)null)
{
savedCtrl.standminX = sMinX;
savedCtrl.standmaxX = sMaxX;
savedCtrl.standminZ = sMinZ;
savedCtrl.standmaxZ = sMaxZ;
savedCtrl.debugSwitch = returnStanding;
savedCtrl = null;
}
RenderSettings.ambientMode = savedMode;
RenderSettings.ambientLight = savedAmbient;
InArena = false;
Plugin.Logger.LogInfo((object)"Left test arena.");
}
}
private static void TeleportHeadTo(Player p, Vector3 target)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = target - ((Component)p.headCollider).transform.position;
Transform transform = ((Component)p).transform;
transform.position += val;
Rigidbody component = ((Component)p).GetComponent<Rigidbody>();
if ((Object)(object)component != (Object)null)
{
component.velocity = Vector3.zero;
}
Physics.SyncTransforms();
p.InitializeValues();
}
private GameObject Box(string name, Vector3 center, Vector3 size, Color color, bool solid = true)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
((Object)val).name = name;
val.layer = 0;
val.transform.SetParent(root.transform, false);
val.transform.position = Origin + center;
val.transform.localScale = size;
Renderer component = val.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
component.material.color = color;
}
if (!solid)
{
Object.Destroy((Object)(object)val.GetComponent<Collider>());
}
return val;
}
private void Build()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: 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_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: 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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
//IL_04be: Unknown result type (might be due to invalid IL or missing references)
//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
//IL_04db: Unknown result type (might be due to invalid IL or missing references)
//IL_042a: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
//IL_052f: Unknown result type (might be due to invalid IL or missing references)
//IL_0540: Unknown result type (might be due to invalid IL or missing references)
//IL_0545: Unknown result type (might be due to invalid IL or missing references)
//IL_0553: Unknown result type (might be due to invalid IL or missing references)
//IL_0558: Unknown result type (might be due to invalid IL or missing references)
//IL_0566: Unknown result type (might be due to invalid IL or missing references)
//IL_057b: Unknown result type (might be due to invalid IL or missing references)
//IL_0580: Unknown result type (might be due to invalid IL or missing references)
//IL_058a: Unknown result type (might be due to invalid IL or missing references)
//IL_058f: Unknown result type (might be due to invalid IL or missing references)
//IL_045a: Unknown result type (might be due to invalid IL or missing references)
//IL_045c: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_0463: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_0698: Unknown result type (might be due to invalid IL or missing references)
//IL_069f: Expected O, but got Unknown
//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0476: Unknown result type (might be due to invalid IL or missing references)
//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Unknown result type (might be due to invalid IL or missing references)
//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0608: Unknown result type (might be due to invalid IL or missing references)
//IL_060d: Unknown result type (might be due to invalid IL or missing references)
//IL_0627: Unknown result type (might be due to invalid IL or missing references)
//IL_061c: Unknown result type (might be due to invalid IL or missing references)
//IL_062c: Unknown result type (might be due to invalid IL or missing references)
//IL_0634: Unknown result type (might be due to invalid IL or missing references)
//IL_0636: Unknown result type (might be due to invalid IL or missing references)
//IL_0638: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Unknown result type (might be due to invalid IL or missing references)
//IL_0653: Unknown result type (might be due to invalid IL or missing references)
//IL_0658: Unknown result type (might be due to invalid IL or missing references)
//IL_065a: Unknown result type (might be due to invalid IL or missing references)
root = new GameObject("hussspace_test_arena");
float value = Plugin.VentWidth.Value;
float value2 = Plugin.VentHeight.Value;
float num = 0.2f;
Color color = default(Color);
((Color)(ref color))..ctor(0.35f, 0.35f, 0.38f);
Color color2 = default(Color);
((Color)(ref color2))..ctor(0.55f, 0.55f, 0.6f);
Color color3 = default(Color);
((Color)(ref color3))..ctor(0.3f, 0.3f, 0.34f);
Color val = default(Color);
((Color)(ref val))..ctor(0.9f, 0.9f, 0.9f);
Color val2 = default(Color);
((Color)(ref val2))..ctor(0.12f, 0.12f, 0.12f);
Color color4 = default(Color);
((Color)(ref color4))..ctor(0.85f, 0.15f, 0.15f);
Box("Floor", new Vector3(0f, -0.5f, 0f), new Vector3(80f, 1f, 80f), color);
for (int i = -3; i <= 3; i++)
{
float num2 = (float)i * 10f;
Color color5 = ((i == 0) ? val : val2);
Box("GridZ", new Vector3(num2, 0.011f, 0f), new Vector3(0.1f, 0.02f, 80f), color5, solid: false);
Box("GridX", new Vector3(0f, 0.011f, num2), new Vector3(80f, 0.02f, 0.1f), color5, solid: false);
}
float num3 = 70f;
Box("StandN", new Vector3(0f, 0.012f, 35f), new Vector3(num3, 0.02f, 0.15f), color4, solid: false);
Box("StandS", new Vector3(0f, 0.012f, -35f), new Vector3(num3, 0.02f, 0.15f), color4, solid: false);
Box("StandE", new Vector3(35f, 0.012f, 0f), new Vector3(0.15f, 0.02f, num3), color4, solid: false);
Box("StandW", new Vector3(-35f, 0.012f, 0f), new Vector3(0.15f, 0.02f, num3), color4, solid: false);
float num4 = 40f;
float num5 = num4 + 60f;
float num6 = (num4 + num5) * 0.5f;
Box("SprintFloor", new Vector3(0f, -0.5f, num6), new Vector3(value + 2f * num, 1f, 60f), color);
Box("SprintCeil", new Vector3(0f, value2 + num * 0.5f, num6), new Vector3(value + 2f * num, num, 60f), color3);
Box("SprintL", new Vector3(0f - (value * 0.5f + num * 0.5f), value2 * 0.5f, num6), new Vector3(num, value2, 60f), color2);
Box("SprintR", new Vector3(value * 0.5f + num * 0.5f, value2 * 0.5f, num6), new Vector3(num, value2, 60f), color2);
for (int j = 5; j < 60; j += 5)
{
Box("Mark", new Vector3(0f, 0.011f, num4 + (float)j), new Vector3(value, 0.02f, 0.1f), (j / 5 % 2 == 0) ? val : val2, solid: false);
}
float num7 = value;
List<Vector2Int> list = new List<Vector2Int>();
HashSet<Vector2Int> hashSet = new HashSet<Vector2Int>();
Vector2Int val3 = Vector2Int.zero;
list.Add(val3);
hashSet.Add(val3);
string text = "N6 E6 N6 W6 N6 E6 N4";
string[] array = text.Split(new char[1] { ' ' });
foreach (string text2 in array)
{
Vector2Int val4 = (Vector2Int)(text2[0] switch
{
'E' => Vector2Int.right,
'W' => Vector2Int.left,
_ => Vector2Int.up,
});
int num8 = int.Parse(text2.Substring(1));
for (int l = 0; l < num8; l++)
{
val3 += val4;
if (hashSet.Add(val3))
{
list.Add(val3);
}
}
}
Vector2Int down = Vector2Int.down;
Vector2Int[] array2 = (Vector2Int[])(object)new Vector2Int[4]
{
Vector2Int.right,
Vector2Int.left,
Vector2Int.up,
Vector2Int.down
};
Vector3 val5 = default(Vector3);
foreach (Vector2Int item in list)
{
Vector2Int current = item;
((Vector3)(ref val5))..ctor((float)((Vector2Int)(ref current)).x * num7, 0f, num5 + num7 * 0.5f + (float)((Vector2Int)(ref current)).y * num7);
Box("VFloor", val5 + new Vector3(0f, -0.5f, 0f), new Vector3(num7, 1f, num7), color);
Box("VCeil", val5 + new Vector3(0f, value2 + num * 0.5f, 0f), new Vector3(num7, num, num7), color3);
Vector2Int[] array3 = array2;
for (int m = 0; m < array3.Length; m++)
{
Vector2Int val6 = array3[m];
Vector2Int val7 = current + val6;
if (!hashSet.Contains(val7) && !(val7 == down))
{
Vector3 val8 = new Vector3((float)((Vector2Int)(ref val6)).x, 0f, (float)((Vector2Int)(ref val6)).y) * (num7 * 0.5f + num * 0.5f);
Vector3 size = ((((Vector2Int)(ref val6)).x != 0) ? new Vector3(num, value2, num7) : new Vector3(num7, value2, num));
Box("VWall", val5 + val8 + new Vector3(0f, value2 * 0.5f, 0f), size, color2);
}
}
}
GameObject val9 = new GameObject("arena_light");
val9.transform.SetParent(root.transform, false);
Light val10 = val9.AddComponent<Light>();
val10.type = (LightType)1;
val10.intensity = 1f;
val10.shadows = (LightShadows)0;
val9.transform.rotation = Quaternion.Euler(60f, 30f, 0f);
Plugin.Logger.LogInfo((object)$"Built test arena ({list.Count} vent cells, vent {value:F2} x {value2:F2} m).");
}
private void OnDestroy()
{
if (InArena)
{
Exit();
}
if ((Object)(object)root != (Object)null)
{
Object.Destroy((Object)(object)root);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "hussspace";
public const string PLUGIN_NAME = "huss harold";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}