Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Repo Native ThirdPerson ActionMovement v1.3.5
RepoThirdPerson.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("RepoThirdPerson")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.5.0")] [assembly: AssemblyInformationalVersion("1.3.5")] [assembly: AssemblyProduct("RepoThirdPerson")] [assembly: AssemblyTitle("RepoThirdPerson")] [assembly: AssemblyVersion("1.3.5.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 RepoThirdPerson { [BepInPlugin("com.reponativemods.thirdperson", "REPO Native Third Person", "1.3.5")] public sealed class Plugin : BaseUnityPlugin { private static class RepoUpdatePatches { [CompilerGenerated] private sealed class <PlayerControllerFixedUpdateTranspiler>d__2 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private List<CodeInstruction> <list>5__2; private FieldInfo <vector3Y>5__3; private MethodInfo <euler>5__4; private MethodInfo <resolveYaw>5__5; private bool <patched>5__6; private int <i>5__7; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PlayerControllerFixedUpdateTranspiler>d__2(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <list>5__2 = null; <vector3Y>5__3 = null; <euler>5__4 = null; <resolveYaw>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <list>5__2 = new List<CodeInstruction>(instructions); <vector3Y>5__3 = AccessTools.Field(typeof(Vector3), "y"); <euler>5__4 = AccessTools.Method(typeof(Quaternion), "Euler", new Type[3] { typeof(float), typeof(float), typeof(float) }, (Type[])null); <resolveYaw>5__5 = AccessTools.Method(typeof(RepoUpdatePatches), "ResolveActionMovementYaw", (Type[])null, (Type[])null); <patched>5__6 = false; <i>5__7 = 0; break; case 1: <>1__state = -1; if (!<patched>5__6 && <list>5__2[<i>5__7].opcode == OpCodes.Ldfld && object.Equals(<list>5__2[<i>5__7].operand, <vector3Y>5__3)) { for (int i = <i>5__7 + 1; i < <list>5__2.Count && i <= <i>5__7 + 4; i++) { if (Calls(<list>5__2[i], <euler>5__4)) { <>2__current = new CodeInstruction(OpCodes.Call, (object)<resolveYaw>5__5); <>1__state = 2; return true; } } } goto IL_01ae; case 2: { <>1__state = -1; <patched>5__6 = true; goto IL_01ae; } IL_01ae: <i>5__7++; break; } if (<i>5__7 < <list>5__2.Count) { <>2__current = <list>5__2[<i>5__7]; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <PlayerControllerFixedUpdateTranspiler>d__2 <PlayerControllerFixedUpdateTranspiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <PlayerControllerFixedUpdateTranspiler>d__ = this; } else { <PlayerControllerFixedUpdateTranspiler>d__ = new <PlayerControllerFixedUpdateTranspiler>d__2(0); } <PlayerControllerFixedUpdateTranspiler>d__.instructions = <>3__instructions; return <PlayerControllerFixedUpdateTranspiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerController), "Update")] private static void PlayerControllerUpdatePostfix() { Instance?.TickInput(); } [HarmonyPrefix] [HarmonyPriority(800)] [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private static void PlayerControllerFixedUpdatePrefix(PlayerController __instance) { Instance?.BeginActionMovementRewrite(__instance); } [IteratorStateMachine(typeof(<PlayerControllerFixedUpdateTranspiler>d__2))] [HarmonyTranspiler] [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private static IEnumerable<CodeInstruction> PlayerControllerFixedUpdateTranspiler(IEnumerable<CodeInstruction> instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PlayerControllerFixedUpdateTranspiler>d__2(-2) { <>3__instructions = instructions }; } private static bool Calls(CodeInstruction instruction, MethodInfo method) { if (instruction.opcode == OpCodes.Call) { return object.Equals(instruction.operand, method); } return false; } private static float ResolveActionMovementYaw(float originalYaw) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown if ((Object)Instance == (Object)null) { return originalYaw; } if (Instance.IsLocalGrabActive() && Instance.TryGetGameplayAimYaw(out var yaw)) { _hasRewriteTurnYaw = true; _lastRewriteTurnYaw = yaw; return yaw; } if ((IsActionMovementCameraLockHeld() || Instance.IsMapAimLockActive()) && Instance.TryGetGameplayAimYaw(out var yaw2)) { _hasRewriteTurnYaw = true; _lastRewriteTurnYaw = yaw2; return yaw2; } if (!Instance.CanAcceptActionMovementInput()) { return originalYaw; } if (_rewriteMovementInput) { return _rewriteTurnYaw; } if (!_hasRewriteTurnYaw) { return originalYaw; } return _lastRewriteTurnYaw; } internal static bool IsActionMovementCameraLockHeld() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown if ((Object)Instance != (Object)null && Instance.IsCameraLockTemporarilySuppressed()) { return false; } if (Mouse.current != null && Mouse.current.rightButton != null) { return Mouse.current.rightButton.isPressed; } return Input.GetMouseButton(1); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private static void PlayerControllerFixedUpdatePostfix(PlayerController __instance) { Instance?.TickActionMovementAfterFixedUpdate(__instance); } [HarmonyFinalizer] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private static void PlayerControllerFixedUpdateFinalizer() { Instance?.EndActionMovementRewrite(); } [HarmonyPostfix] [HarmonyPatch(typeof(SemiFunc), "InputMovementX")] private static void SemiFuncInputMovementXPostfix(ref float __result) { if (_rewriteMovementInput) { __result = _rewriteMovementX; } } [HarmonyPostfix] [HarmonyPatch(typeof(SemiFunc), "InputMovementY")] private static void SemiFuncInputMovementYPostfix(ref float __result) { if (_rewriteMovementInput) { __result = _rewriteMovementY; } } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerAvatarVisuals), "Update")] private static void PlayerAvatarVisualsUpdatePostfix(PlayerAvatarVisuals __instance) { Instance?.TickActionMovementVisuals(__instance); } [HarmonyPriority(0)] private static void ModdedModelPlayerAvatarUpdatePostfix(object __instance) { Instance?.TickModdedModelPlayerAvatarPostUpdate(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(CameraPosition), "Update")] private static void CameraPositionUpdatePostfix(CameraPosition __instance) { Instance?.ApplyFirstPersonCrouchLocalOffset(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(CameraCrouchPosition), "Update")] private static void CameraCrouchPositionUpdatePostfix(CameraCrouchPosition __instance) { Instance?.ForceCameraCrouchLocalPosition(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(CameraCrawlPosition), "Update")] private static void CameraCrawlPositionUpdatePostfix(CameraCrawlPosition __instance) { Instance?.ForceCameraCrawlLocalPosition(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerLocalCamera), "GetOverrideTransform")] private static void PlayerLocalCameraGetOverrideTransformPostfix(PlayerLocalCamera __instance, ref Transform __result) { Instance?.TryGetSelectionOverride(__instance, ref __result); Instance?.NormalizeFirstPersonOverrideTransform(__instance, ref __result); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerLocalCamera), "GetOverrideActive")] private static void PlayerLocalCameraGetOverrideActivePostfix(PlayerLocalCamera __instance, ref bool __result) { Instance?.TryGetSelectionOverrideActive(__instance, ref __result); Instance?.NormalizeFirstPersonOverrideActive(__instance, ref __result); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(FlashlightController), "Update")] private static void FlashlightControllerUpdatePostfix(FlashlightController __instance) { Instance?.TickFlashlightControllerPostUpdate(__instance); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerAvatarRightArm), "Update")] private static void PlayerAvatarRightArmUpdatePostfix(PlayerAvatarRightArm __instance) { Instance?.ForceLocalThirdPersonRightArmPose(__instance); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerAvatarLeftArm), "Update")] private static void PlayerAvatarLeftArmUpdatePostfix(PlayerAvatarLeftArm __instance) { Instance?.ForceLocalThirdPersonLeftArmPose(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyOnScreen), "Awake")] private static void EnemyOnScreenAwakePostfix(EnemyOnScreen __instance) { Instance?.EnableEnemyOnScreenDuringThirdPerson(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyOnScreen), "OnEnable")] private static void EnemyOnScreenOnEnablePostfix(EnemyOnScreen __instance) { Instance?.EnableEnemyOnScreenDuringThirdPerson(__instance); } [HarmonyPrefix] [HarmonyPatch(typeof(SemiPuke), "PukeActive")] private static void SemiPukePukeActivePrefix(ref Quaternion _direction) { Instance?.OverridePukeDirection(ref _direction); } } private struct ClipPlaneState { public float Near; public float Far; } public const string PluginGuid = "com.reponativemods.thirdperson"; public const string PluginName = "REPO Native Third Person"; public const string PluginVersion = "1.3.5"; private const string SelectionTransformName = "REPO Native Third Person Selection Transform"; private const string ToggleActionName = "REPO Native Third Person Toggle"; private const string ZoomInActionName = "REPO Native Third Person Zoom In"; private const string ZoomOutActionName = "REPO Native Third Person Zoom Out"; private const string DefaultLayerName = "Default"; private const string GroundLayerName = "Ground"; private const string WallLayerName = "Wall"; private const string PlayerLayerName = "Player"; private const float InputDeadZone = 0.001f; private const float MinimumCameraCastDistance = 0.001f; private const float MinimumSelectionDirectionSqrMagnitude = 0.0001f; private const float MinimumConfiguredDistance = 0.1f; private const float CameraPositionOverrideDuration = 0.1f; private const float ShowSelfOverrideDuration = 0.15f; private const float ObstructedMinimumDistance = 0.05f; private const float NearFadeStartDistance = 2.6f; private const float NearFadeEndDistance = 1.15f; private ConfigEntry<KeyCode> _toggleKey; private ConfigEntry<KeyCode> _zoomInKey; private ConfigEntry<KeyCode> _zoomOutKey; private ConfigEntry<KeyCode> _resetOffsetsKey; private ConfigEntry<float> _scrollSensitivity; private ConfigEntry<float> _keyZoomSpeed; private ConfigEntry<float> _offsetAdjustSpeed; private ConfigEntry<float> _offsetX; private ConfigEntry<float> _offsetY; private ConfigEntry<float> _defaultDistance; private ConfigEntry<float> _minDistance; private ConfigEntry<float> _maxDistance; private ConfigEntry<float> _collisionRadius; private ConfigEntry<float> _collisionPadding; private ConfigEntry<float> _minimumFarClipPlane; private ConfigEntry<float> _nearClipPlane; private ConfigEntry<bool> _cameraCenteredSelection; private ConfigEntry<string> _selectionOriginMode; private ConfigEntry<float> _selectionMaxDistance; private ConfigEntry<bool> _actionMovementEnabled; private ConfigEntry<float> _actionTurnSpeed; private ConfigEntry<bool> _actionMovementWhileGrabbing; private ConfigEntry<bool> _forceLocalModdedModel; private ConfigEntry<float> _cameraCloseSmoothTime; private ConfigEntry<float> _cameraFarSmoothTime; private ConfigEntry<float> _grabCameraDistance; private ConfigEntry<float> _grabCameraOffsetX; private ConfigEntry<float> _nearFadeStartZoomRatio; private ConfigEntry<float> _nearFadeMinAlpha; private ConfigEntry<bool> _lockRuntimeCameraTuning; private ConfigEntry<string> _localTransparencyMode; private ConfigEntry<float> _silhouetteScale; private ConfigEntry<float> _outlineWidth; private ConfigEntry<float> _outlineColorR; private ConfigEntry<float> _outlineColorG; private ConfigEntry<float> _outlineColorB; private ConfigEntry<float> _outlineColorA; private ConfigEntry<bool> _thirdPersonMapOverlay; private ConfigEntry<float> _mapOverlayX; private ConfigEntry<float> _mapOverlayY; private ConfigEntry<float> _mapOverlayZ; private ConfigEntry<float> _mapOverlayScale; private ConfigEntry<float> _mapOverlayPitch; private ConfigEntry<float> _mapOverlayYaw; private ConfigEntry<float> _mapOverlayRoll; private ConfigEntry<bool> _debugShowCameraPoints; private ConfigEntry<bool> _debugShowGrabSelection; private ConfigEntry<bool> _debugLogCameraSettings; private ConfigEntry<float> _debugCameraLogInterval; private readonly Dictionary<Camera, ClipPlaneState> _originalClipPlanes = new Dictionary<Camera, ClipPlaneState>(); private readonly Dictionary<Renderer, MotionVectorGenerationMode> _originalRendererMotionVectors = new Dictionary<Renderer, MotionVectorGenerationMode>(); private readonly Dictionary<GameObject, int> _originalRendererLayers = new Dictionary<GameObject, int>(); private readonly Dictionary<Renderer, Material[]> _originalRendererMaterials = new Dictionary<Renderer, Material[]>(); private readonly Dictionary<Renderer, Material[]> _transparentRendererMaterials = new Dictionary<Renderer, Material[]>(); private readonly Dictionary<Renderer, bool> _originalRendererEnabledStates = new Dictionary<Renderer, bool>(); private readonly Dictionary<Renderer, ShadowCastingMode> _originalRendererShadowModes = new Dictionary<Renderer, ShadowCastingMode>(); private readonly Dictionary<Renderer, Renderer> _silhouetteRenderers = new Dictionary<Renderer, Renderer>(); private readonly Dictionary<Renderer, LineRenderer[]> _outlineRenderers = new Dictionary<Renderer, LineRenderer[]>(); private readonly Dictionary<Renderer, Renderer> _contourDepthRenderers = new Dictionary<Renderer, Renderer>(); private readonly Dictionary<Renderer, Renderer> _contourOutlineRenderers = new Dictionary<Renderer, Renderer>(); private readonly HashSet<Renderer> _activeTransparentRenderers = new HashSet<Renderer>(); private readonly HashSet<Renderer> _activeObstructionTransparentRenderers = new HashSet<Renderer>(); private readonly MaterialPropertyBlock _transparencyPropertyBlock = new MaterialPropertyBlock(); private readonly List<Camera> _cameraBuffer = new List<Camera>(16); private bool _thirdPersonActive; private float _currentDistance; private float _resolvedDistance; private float _resolvedDistanceVelocity; private Vector3 _gameplayCameraPosition; private Vector3 _stableGrabOrigin; private float _grabCameraBlend; private float _grabCameraBlendVelocity; private bool _wasLocalGrabActive; private bool _hasGrabAimLockTarget; private Vector3 _grabAimLockTarget; private float _grabAimLockUntilTime; private float _thirdPersonCrouchYOffset; private float _thirdPersonCrouchYOffsetVelocity; private int _collisionMask; private InputAction _toggleAction; private InputAction _zoomInAction; private InputAction _zoomOutAction; private Harmony _harmony; private Transform _selectionTransform; private int _lastInputTickFrame = -1; private int _lastCameraTickFrame = -1; private bool _temporarilyFirstPerson; private float _forceFirstPersonLocalModelHiddenUntil; private float _cameraLockSuppressUntilTime; private float _startingOffsetX; private float _startingOffsetY; private float _runtimeOffsetX; private float _runtimeOffsetY; private int _lastActionMovementTickFrame = -1; private Vector3 _lastActionMoveDirection = Vector3.zero; private float _lastActionMoveDirectionTime; private bool _loggedModelCompatibility; private bool _loggedModelCompatibilityMissing; private Type _moddedModelPlayerAvatarType; private FieldInfo _forceShowLocalModelField; private FieldInfo _currentModelInstanceField; private FieldInfo _cachedModelRenderersField; private MethodInfo _applyModelToVisualMethod; private MethodInfo _rightArmGrabberPoseOverrideMethod; private MethodInfo _rightArmSetPoseMethod; private MethodInfo _rightArmAnimatePoseMethod; private MethodInfo _leftArmSetPoseMethod; private MethodInfo _leftArmAnimatePoseMethod; private FieldInfo _physGrabBeamActiveField; private FieldInfo _playerAvatarRightArmField; private bool _moddedModelUpdatePatched; private PlayerAvatar _cachedModelAvatar; private Component _cachedModelComponent; private GameObject _cachedModelInstance; private Renderer[] _cachedForcedRenderers; private bool _localModdedModelVisible; private PlayerAvatarVisuals _cachedAvatarVisualsForMotionVectors; private Renderer[] _cachedAvatarVisualRenderers; private float _nextModelCompatibilityRetryTime; private float _nextRendererRefreshTime; private float _nextAvatarRendererRefreshTime; private float _nextCameraDebugLogTime; private float _nextTransparencyDebugLogTime; private float _nextCameraSettingsLogTime; private float _nextMapOverlayLogTime; private GameObject _localMapOverlayClone; private Transform _localMapOverlayVisualRoot; private MapToolController _localMapOverlaySource; private Material _silhouetteMaterial; private Material _outlineMaterial; private Material _contourDepthMaterial; private Material _contourOutlineMaterial; private bool _contourPreferSkinnedRenderers; private float _contourBodyVolumeThreshold; private bool _motionBlurOverrideActive; private bool _motionBlurOriginalActive; private float _motionBlurOriginalShutterAngle; private static FieldInfo _menuCurrentPageField; private static bool _rewriteMovementInput; private static float _rewriteMovementX; private static float _rewriteMovementY; private static float _rewriteTurnYaw; private static float _lastRewriteTurnYaw; private static bool _hasRewriteTurnYaw; private static Quaternion _visualFacingRotation = Quaternion.identity; private static bool _hasVisualFacingRotation; private PlayerAvatar _lastPlayerAvatar; private int _lastGameState = -1; private FieldInfo _avatarIsDisabledField; private FieldInfo _avatarDeadSetField; private FieldInfo _postProcessingMotionBlurField; private FieldInfo _avatarVisualPositionField; private FieldInfo _avatarVisualFollowLerpField; private FieldInfo _avatarVisualBodySpringTargetField; private FieldInfo _cameraPositionOverrideTimerField; private FieldInfo _cameraPositionOverrideTargetField; private FieldInfo _cameraCrouchLerpField; private FieldInfo _cameraCrawlLerpField; private FieldInfo _playerAvatarVisionTargetField; private FieldInfo _visionTargetCurrentPositionField; private FieldInfo _visionTargetStandPositionField; private Transform _debugAnchorPoint; private Transform _debugHeadPoint; private Transform _debugGrabOriginPoint; private Transform _debugGrabCameraHitPoint; private Transform _debugGrabTargetPoint; private LineRenderer _debugGrabCameraRayLine; private LineRenderer _debugGrabCharacterRayLine; private LineRenderer _debugGrabRangeLine; private Material _debugGrabCameraRayMaterial; private Material _debugGrabCharacterRayMaterial; private Material _debugGrabRangeMaterial; internal static Plugin Instance { get; private set; } internal void TickFlashlightControllerPostUpdate(FlashlightController controller) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_004b: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && !((Object)controller == (Object)null) && !((Object)controller.PlayerAvatar == (Object)null) && !((Object)controller.PlayerAvatar != (Object)PlayerAvatar.instance)) { controller.SetThirdPerson(true); AlignLocalThirdPersonFlashlight(controller); if ((Object)controller.halo != (Object)null) { controller.halo.enabled = false; } } } private void AlignLocalThirdPersonFlashlight(FlashlightController controller) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_008c: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00b5: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar playerAvatar = controller.PlayerAvatar; if ((Object)playerAvatar == (Object)null) { return; } Vector3 val = (_hasVisualFacingRotation ? (_visualFacingRotation * Vector3.forward) : ((!((Object)playerAvatar.playerAvatarVisuals != (Object)null)) ? ((Component)playerAvatar).transform.forward : ((Component)playerAvatar.playerAvatarVisuals).transform.forward)); val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref val)).Normalize(); Transform transform = ((Component)controller).transform; transform.rotation = Quaternion.LookRotation(val, Vector3.up); if ((Object)playerAvatar.flashlightLightAim != (Object)null) { playerAvatar.flashlightLightAim.clientAimPoint = transform.position + val * 100f; } } } internal void ForceLocalThirdPersonRightArmPose(PlayerAvatarRightArm arm) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: 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_0038: Expected O, but got Unknown //IL_0038: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (!_thirdPersonActive || _temporarilyFirstPerson || (Object)arm == (Object)null || (Object)arm.playerAvatar != (Object)PlayerAvatar.instance) { return; } PhysGrabber physGrabber = arm.playerAvatar.physGrabber; if (!((Object)physGrabber == (Object)null) && (IsPhysGrabBeamActive(physGrabber) || physGrabber.grabbed)) { if (_rightArmGrabberPoseOverrideMethod == null) { _rightArmGrabberPoseOverrideMethod = typeof(PlayerAvatarRightArm).GetMethod("GrabberPoseOverride", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _rightArmGrabberPoseOverrideMethod?.Invoke(arm, new object[1] { 0.2f }); ForceRightArmPoseNow(arm, arm.grabberPose); } } internal void ForceLocalThirdPersonLeftArmPose(PlayerAvatarLeftArm arm) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: 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_0038: Expected O, but got Unknown //IL_0038: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_007c: 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_0069: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && !((Object)arm == (Object)null) && !((Object)arm.playerAvatar != (Object)PlayerAvatar.instance)) { FlashlightController flashlightController = arm.flashlightController; if (!((Object)flashlightController == (Object)null) && (flashlightController.LightActive || (!((Object)flashlightController.spotlight == (Object)null) && ((Behaviour)flashlightController.spotlight).enabled))) { ForceLeftArmPoseNow(arm, arm.flashlightPose); } } } private void ForceRightArmPoseNow(PlayerAvatarRightArm arm, Vector3 pose) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!((Object)arm == (Object)null)) { if (_rightArmSetPoseMethod == null) { _rightArmSetPoseMethod = typeof(PlayerAvatarRightArm).GetMethod("SetPose", BindingFlags.Instance | BindingFlags.NonPublic); } if (_rightArmAnimatePoseMethod == null) { _rightArmAnimatePoseMethod = typeof(PlayerAvatarRightArm).GetMethod("AnimatePose", BindingFlags.Instance | BindingFlags.NonPublic); } _rightArmSetPoseMethod?.Invoke(arm, new object[1] { pose }); _rightArmAnimatePoseMethod?.Invoke(arm, null); } } private void ForceLeftArmPoseNow(PlayerAvatarLeftArm arm, Vector3 pose) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!((Object)arm == (Object)null)) { if (_leftArmSetPoseMethod == null) { _leftArmSetPoseMethod = typeof(PlayerAvatarLeftArm).GetMethod("SetPose", BindingFlags.Instance | BindingFlags.NonPublic); } if (_leftArmAnimatePoseMethod == null) { _leftArmAnimatePoseMethod = typeof(PlayerAvatarLeftArm).GetMethod("AnimatePose", BindingFlags.Instance | BindingFlags.NonPublic); } _leftArmSetPoseMethod?.Invoke(arm, new object[1] { pose }); _leftArmAnimatePoseMethod?.Invoke(arm, null); } } private bool IsPhysGrabBeamActive(PhysGrabber physGrabber) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)physGrabber == (Object)null) { return false; } if (_physGrabBeamActiveField == null) { _physGrabBeamActiveField = typeof(PhysGrabber).GetField("physGrabBeamActive", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } bool flag = default(bool); int num; if (_physGrabBeamActiveField != null) { object value = _physGrabBeamActiveField.GetValue(physGrabber); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private PlayerAvatarRightArm GetPlayerAvatarRightArm(PlayerAvatarVisuals visuals) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if ((Object)visuals == (Object)null) { return null; } if (_playerAvatarRightArmField == null) { _playerAvatarRightArmField = typeof(PlayerAvatarVisuals).GetField("playerAvatarRightArm", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj = _playerAvatarRightArmField?.GetValue(visuals); PlayerAvatarRightArm val = (PlayerAvatarRightArm)((obj is PlayerAvatarRightArm) ? obj : null); if (!((Object)val != (Object)null)) { return ((Component)visuals).GetComponentInChildren<PlayerAvatarRightArm>(true); } return val; } private static Transform CreateDebugPoint(string objectName, Color color, float scale) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0024: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); if ((Object)val == (Object)null) { return null; } ((Object)val).name = objectName; val.transform.localScale = Vector3.one * Mathf.Max(0.01f, scale); int num = LayerMask.NameToLayer("TopLayer"); if (num >= 0) { val.layer = num; } Collider component = val.GetComponent<Collider>(); if ((Object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = val.GetComponent<Renderer>(); if ((Object)component2 != (Object)null) { Material material = component2.material; if ((Object)material != (Object)null) { material.color = color; } } KeepAliveOutsideScene(val); val.SetActive(false); return val.transform; } private LineRenderer GetOrCreateDebugLine(ref LineRenderer line, ref Material material, string objectName, Color color, float width) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if ((Object)line != (Object)null) { return line; } GameObject val = new GameObject(objectName); KeepAliveOutsideScene(val); int num = LayerMask.NameToLayer("TopLayer"); if (num >= 0) { val.layer = num; } line = val.AddComponent<LineRenderer>(); line.positionCount = 2; line.useWorldSpace = true; line.loop = false; ((Renderer)line).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)line).receiveShadows = false; line.widthMultiplier = Mathf.Max(0.002f, width); material = CreateDebugLineMaterial(objectName + " Material", color); if ((Object)material != (Object)null) { ((Renderer)line).material = material; } line.startColor = color; line.endColor = color; val.SetActive(false); return line; } private static Material CreateDebugLineMaterial(string name, Color color) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Hidden/Internal-Colored") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Standard"); if ((Object)val == (Object)null) { return null; } Material val2 = new Material(val); ((Object)val2).name = name; if (val2.HasProperty("_Color")) { val2.SetColor("_Color", color); } if (val2.HasProperty("_SrcBlend")) { val2.SetFloat("_SrcBlend", 5f); } if (val2.HasProperty("_DstBlend")) { val2.SetFloat("_DstBlend", 10f); } if (val2.HasProperty("_ZWrite")) { val2.SetFloat("_ZWrite", 0f); } val2.renderQueue = 5000; val2.SetOverrideTag("RenderType", "Transparent"); return val2; } private void HideDebugPoints() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if ((Object)_debugAnchorPoint != (Object)null) { ((Component)_debugAnchorPoint).gameObject.SetActive(false); } if ((Object)_debugHeadPoint != (Object)null) { ((Component)_debugHeadPoint).gameObject.SetActive(false); } HideGrabDebugVisuals(); } private void UpdateDebugPoints(Vector3 anchor, Vector3 headCenter) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) bool flag = _debugShowCameraPoints != null && _debugShowCameraPoints.Value && _thirdPersonActive && !_temporarilyFirstPerson; if ((Object)_debugAnchorPoint != (Object)null) { ((Component)_debugAnchorPoint).gameObject.SetActive(false); } if ((Object)_debugHeadPoint != (Object)null) { ((Component)_debugHeadPoint).gameObject.SetActive(flag); if (flag) { _debugHeadPoint.position = headCenter; } } if (flag && Time.time >= _nextCameraDebugLogTime) { _nextCameraDebugLogTime = Time.time + 0.5f; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[ThirdPersonDebug] head={headCenter} currentDistance={_currentDistance:0.00} resolvedDistance={_resolvedDistance:0.00}"); } } private static Vector3 GetCharacterBodyDebugOrigin(PlayerAvatar avatar, Vector3 grabOrigin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_000e: Unknown result type (might be due to invalid IL or missing references) if ((Object)avatar == (Object)null) { return grabOrigin; } return Vector3.Lerp(((Component)avatar).transform.position, grabOrigin, 0.45f); } private void UpdateGrabDebugVisuals(Vector3 grabOrigin, Vector3 cameraRayDebugOrigin, Vector3 cameraHitPoint, Vector3 grabTarget, float grabRange, bool hasCameraHit, bool hitIsReachable) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0097: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00e6: 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_0108: 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_0116: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_0165: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_0191: 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_01a2: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_01cd: 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) if (_debugShowGrabSelection == null || !_debugShowGrabSelection.Value || !_thirdPersonActive || _temporarilyFirstPerson) { HideGrabDebugVisuals(); return; } Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.85f, 0.05f, 0.95f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.2f, 1f, 0.25f, 0.95f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.25f, 0.95f, 1f, 0.95f); Color val4 = default(Color); ((Color)(ref val4))..ctor(1f, 0.1f, 0.08f, 0.95f); Color color = default(Color); ((Color)(ref color))..ctor(1f, 1f, 1f, 0.45f); Color val5 = ((!hasCameraHit) ? val3 : (hitIsReachable ? val2 : val4)); SetDebugPoint(_debugGrabOriginPoint, grabOrigin, val3, active: true); SetDebugPoint(_debugGrabCameraHitPoint, cameraHitPoint, hasCameraHit ? val5 : val, active: true); SetDebugPoint(_debugGrabTargetPoint, grabTarget, val5, active: true); SetDebugLine(GetOrCreateDebugLine(ref _debugGrabCameraRayLine, ref _debugGrabCameraRayMaterial, "REPO Native Third Person Grab Camera Ray Debug", val, 0.018f), cameraRayDebugOrigin, cameraHitPoint, val, active: true); SetDebugLine(GetOrCreateDebugLine(ref _debugGrabCharacterRayLine, ref _debugGrabCharacterRayMaterial, "REPO Native Third Person Grab Character Ray Debug", val5, 0.028f), grabOrigin, grabTarget, val5, active: true); Vector3 val6 = grabTarget - grabOrigin; Vector3 end = grabOrigin + ((((Vector3)(ref val6)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val6)).normalized : Vector3.forward) * Mathf.Max(0.1f, grabRange); SetDebugLine(GetOrCreateDebugLine(ref _debugGrabRangeLine, ref _debugGrabRangeMaterial, "REPO Native Third Person Grab Range Debug", color, 0.012f), grabOrigin, end, color, active: true); } private static void SetDebugPoint(Transform point, Vector3 position, Color color, bool active) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)point == (Object)null) { return; } GameObject gameObject = ((Component)point).gameObject; gameObject.SetActive(active); if (active) { point.position = position; Renderer component = gameObject.GetComponent<Renderer>(); if ((Object)component != (Object)null && (Object)component.material != (Object)null) { component.material.color = color; } } } private static void SetDebugLine(LineRenderer line, Vector3 start, Vector3 end, Color color, bool active) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0021: 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_0030: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) if ((Object)line == (Object)null) { return; } ((Component)line).gameObject.SetActive(active); if (active) { line.startColor = color; line.endColor = color; line.SetPosition(0, start); line.SetPosition(1, end); if ((Object)((Renderer)line).material != (Object)null && ((Renderer)line).material.HasProperty("_Color")) { ((Renderer)line).material.SetColor("_Color", color); } } } private void HideGrabDebugVisuals() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_007e: 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_0088: Unknown result type (might be due to invalid IL or missing references) SetDebugPoint(_debugGrabOriginPoint, Vector3.zero, Color.clear, active: false); SetDebugPoint(_debugGrabCameraHitPoint, Vector3.zero, Color.clear, active: false); SetDebugPoint(_debugGrabTargetPoint, Vector3.zero, Color.clear, active: false); SetDebugLine(_debugGrabCameraRayLine, Vector3.zero, Vector3.zero, Color.clear, active: false); SetDebugLine(_debugGrabCharacterRayLine, Vector3.zero, Vector3.zero, Color.clear, active: false); SetDebugLine(_debugGrabRangeLine, Vector3.zero, Vector3.zero, Color.clear, active: false); } internal void EnableEnemyOnScreenDuringThirdPerson(EnemyOnScreen enemyOnScreen) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)enemyOnScreen == (Object)null)) { enemyOnScreen.enableOnCameraOverride = true; } } private void Awake() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Expected O, but got Unknown //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Expected O, but got Unknown //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Expected O, but got Unknown //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Expected O, but got Unknown //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Expected O, but got Unknown //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Expected O, but got Unknown //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Expected O, but got Unknown //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Expected O, but got Unknown //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Expected O, but got Unknown //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Expected O, but got Unknown //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Expected O, but got Unknown //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Expected O, but got Unknown //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Expected O, but got Unknown //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Expected O, but got Unknown //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Expected O, but got Unknown //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Expected O, but got Unknown //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_0829: Expected O, but got Unknown //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Expected O, but got Unknown //IL_08bc: Unknown result type (might be due to invalid IL or missing references) //IL_08c6: Expected O, but got Unknown //IL_08fa: Unknown result type (might be due to invalid IL or missing references) //IL_0904: Expected O, but got Unknown //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_0942: Expected O, but got Unknown //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_0980: Expected O, but got Unknown //IL_09b4: Unknown result type (might be due to invalid IL or missing references) //IL_09be: Expected O, but got Unknown //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_09fc: Expected O, but got Unknown //IL_0aa5: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: Expected O, but got Unknown //IL_0ae3: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Unknown result type (might be due to invalid IL or missing references) //IL_0aee: Unknown result type (might be due to invalid IL or missing references) //IL_0af3: Unknown result type (might be due to invalid IL or missing references) //IL_0bbe: Unknown result type (might be due to invalid IL or missing references) //IL_0bec: Unknown result type (might be due to invalid IL or missing references) //IL_0c1a: Unknown result type (might be due to invalid IL or missing references) //IL_0c48: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0c96: Unknown result type (might be due to invalid IL or missing references) //IL_0ca0: Expected O, but got Unknown //IL_0ccf: Unknown result type (might be due to invalid IL or missing references) Instance = this; KeepAliveOutsideScene(((Component)this).gameObject); _toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)120, "Key to toggle third-person mode."); _offsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "OffsetX", 0.45f, "Always-on third-person right shoulder offset."); _offsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "OffsetY", 1.965f, "Vertical offset from the local player origin."); _defaultDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "DefaultDistance", 3f, new ConfigDescription("Default distance behind the player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 25f), Array.Empty<object>())); _minDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "MinDistance", 1f, new ConfigDescription("Minimum zoom distance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 25f), Array.Empty<object>())); _maxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "MaxDistance", 3.33f, new ConfigDescription("Maximum zoom distance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 50f), Array.Empty<object>())); _collisionRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "CollisionRadius", 0.035f, new ConfigDescription("Very small spherecast radius used to keep the camera out of walls while avoiding false pull-in near doors.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.005f, 0.25f), Array.Empty<object>())); _collisionPadding = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "CollisionPadding", 0.15f, new ConfigDescription("Distance kept between the camera and collision surfaces.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); _nearClipPlane = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "NearClipPlane", 0.03f, new ConfigDescription("Near clip plane while third-person is active. Lower values reduce close zoom clipping.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>())); _minimumFarClipPlane = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "MinimumFarClipPlane", 1000f, new ConfigDescription("Minimum far clip plane while third-person is active. The mod also preserves any larger original far clip value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 100000f), Array.Empty<object>())); _cameraCenteredSelection = ((BaseUnityPlugin)this).Config.Bind<bool>("Interaction", "CameraCenteredSelection", true, "Aim selection/grabbing at the object centered by the third-person camera while keeping the origin at the player vision transform."); _selectionOriginMode = ((BaseUnityPlugin)this).Config.Bind<string>("Interaction", "SelectionOriginMode", "Camera", new ConfigDescription("Origin used by third-person selection/grab override. Camera projects the third-person crosshair through the character grab range; PlayerVision is a legacy fallback.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Camera", "PlayerVision" }), Array.Empty<object>())); _selectionMaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Interaction", "SelectionMaxDistance", 100f, new ConfigDescription("Maximum distance used when converting the third-person camera center ray into a player-origin selection ray.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 500f), Array.Empty<object>())); _zoomInKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ZoomInKey", (KeyCode)270, "Key to zoom in."); _zoomOutKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ZoomOutKey", (KeyCode)269, "Key to zoom out."); _resetOffsetsKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ResetOffsetsKey", (KeyCode)278, "Key to reset runtime camera offsets to the loaded config values."); _scrollSensitivity = ((BaseUnityPlugin)this).Config.Bind<float>("Controls", "ScrollSensitivity", 1f, new ConfigDescription("Mouse wheel zoom sensitivity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); _keyZoomSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Controls", "KeyZoomSpeed", 5f, new ConfigDescription("Zoom speed when using zoom keys.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f), Array.Empty<object>())); _offsetAdjustSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Controls", "OffsetAdjustSpeed", 1f, new ConfigDescription("Offset adjustment speed when holding arrow keys, in world units per second.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 10f), Array.Empty<object>())); _actionMovementEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Action Movement", "Enabled", true, "When third-person is active, turn the avatar toward the camera-relative WASD direction."); _actionTurnSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Action Movement", "TurnSpeed", 14f, new ConfigDescription("How quickly the avatar turns toward the camera-relative movement direction.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 40f), Array.Empty<object>())); _actionMovementWhileGrabbing = ((BaseUnityPlugin)this).Config.Bind<bool>("Action Movement", "WhileGrabbing", false, "Keep action movement active while grabbing. Disabled by default so grab aim keeps vanilla behavior."); _forceLocalModdedModel = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "ForceLocalModdedModel", true, "While third-person is active, ask known model-swap mods to show the local custom model."); _cameraCloseSmoothTime = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "CloseSmoothTime", 0.35f, new ConfigDescription("Seconds used to smooth camera distance when moving closer due to collision.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>())); _cameraFarSmoothTime = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "FarSmoothTime", 0.35f, new ConfigDescription("Seconds used to smooth camera distance when moving farther away after collision clears.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>())); _grabCameraDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "GrabCameraDistance", 1.65f, new ConfigDescription("Temporary third-person camera distance while grabbing so heavy objects remain visible.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 4f), Array.Empty<object>())); _grabCameraOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "GrabCameraOffsetX", 0.45f, new ConfigDescription("Temporary right shoulder camera offset while grabbing.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1.5f), Array.Empty<object>())); _nearFadeStartZoomRatio = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "NearFadeStartZoomRatio", 0.67f, new ConfigDescription("Start model fade only after zooming in this much of the zoom range (0-1). 0.67 means starts after zooming in about two-thirds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); _nearFadeMinAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "NearFadeMinAlpha", 0.1f, new ConfigDescription("Minimum model alpha when camera is very close. 0.1 = about 90% transparent.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.02f, 1f), Array.Empty<object>())); _lockRuntimeCameraTuning = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "LockRuntimeTuning", true, "Lock mouse wheel zoom and runtime camera offset keys to the current config values."); _localTransparencyMode = ((BaseUnityPlugin)this).Config.Bind<string>("Camera", "LocalTransparencyMode", "Disabled", new ConfigDescription("Local player near-camera visibility mode. Disabled keeps the local player model visible at all third-person camera distances.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[9] { "Disabled", "ContourOnly", "BoundsOutlineDebug", "SilhouetteClone", "MaterialAndPropertyBlock", "MaterialAlpha", "PropertyBlockOnly", "RendererDisable", "ShadowsOnly" }), Array.Empty<object>())); _silhouetteScale = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "SilhouetteScale", 1.035f, new ConfigDescription("Scale multiplier for the local-only silhouette clone when Camera.LocalTransparencyMode is SilhouetteClone.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1.2f), Array.Empty<object>())); _outlineWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "OutlineWidth", 0.025f, new ConfigDescription("Thickness for ContourOnly local player near-camera mode. BoundsOutlineDebug also uses this as line width.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.002f, 0.12f), Array.Empty<object>())); _outlineColorR = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "OutlineColorR", 0.25f, new ConfigDescription("ContourOnly outline red channel.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); _outlineColorG = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "OutlineColorG", 0.95f, new ConfigDescription("ContourOnly outline green channel.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); _outlineColorB = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "OutlineColorB", 1f, new ConfigDescription("ContourOnly outline blue channel.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); _outlineColorA = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "OutlineColorA", 0.9f, new ConfigDescription("ContourOnly outline alpha channel.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); _thirdPersonMapOverlay = ((BaseUnityPlugin)this).Config.Bind<bool>("Map", "ThirdPersonScreenOverlay", true, "Show a local-only first-person-style map model in front of the camera while the map is open in third-person."); _mapOverlayX = ((BaseUnityPlugin)this).Config.Bind<float>("Map", "OverlayX", 0f, new ConfigDescription("Local-only third-person map overlay X offset from the camera.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-2f, 2f), Array.Empty<object>())); _mapOverlayY = ((BaseUnityPlugin)this).Config.Bind<float>("Map", "OverlayY", -0.55f, new ConfigDescription("Local-only third-person map overlay Y offset from the camera.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-2f, 2f), Array.Empty<object>())); _mapOverlayZ = ((BaseUnityPlugin)this).Config.Bind<float>("Map", "OverlayZ", 0.73f, new ConfigDescription("Local-only third-person map overlay Z offset from the camera.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>())); _mapOverlayScale = ((BaseUnityPlugin)this).Config.Bind<float>("Map", "OverlayScale", 1.55f, new ConfigDescription("Local-only third-person map overlay scale.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 3f), Array.Empty<object>())); _mapOverlayPitch = ((BaseUnityPlugin)this).Config.Bind<float>("Map", "OverlayPitch", -90f, new ConfigDescription("Local-only third-person map overlay pitch.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-90f, 90f), Array.Empty<object>())); _mapOverlayYaw = ((BaseUnityPlugin)this).Config.Bind<float>("Map", "OverlayYaw", 0f, new ConfigDescription("Local-only third-person map overlay yaw.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-90f, 90f), Array.Empty<object>())); _mapOverlayRoll = ((BaseUnityPlugin)this).Config.Bind<float>("Map", "OverlayRoll", 0f, new ConfigDescription("Local-only third-person map overlay roll.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), Array.Empty<object>())); LockAcceptedMapOverlaySettings(); LockAcceptedCameraCollisionSettings(); LockAcceptedGrabCameraSettings(); _debugShowCameraPoints = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "ShowCameraPoints", false, "Show debug dots for camera anchor (green) and head center point (red)."); _debugShowGrabSelection = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "ShowGrabSelection", true, "Show third-person grab debug lines and points. Yellow = camera crosshair ray, cyan/green = character grab ray/valid target, red = unreachable camera hit."); _debugLogCameraSettings = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogCameraSettings", false, "Log camera distance, resolved collision distance, offsets, and aim/camera angles only when camera settings are adjusted."); _debugCameraLogInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Debug", "CameraLogInterval", 1f, new ConfigDescription("Seconds between camera setting logs when Debug.LogCameraSettings is enabled.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 10f), Array.Empty<object>())); _currentDistance = ClampDistance(_defaultDistance.Value); _resolvedDistance = _currentDistance; _resolvedDistanceVelocity = 0f; _gameplayCameraPosition = Vector3.zero; _stableGrabOrigin = Vector3.zero; _grabCameraBlend = 0f; _grabCameraBlendVelocity = 0f; _wasLocalGrabActive = false; _hasGrabAimLockTarget = false; _startingOffsetX = Mathf.Max(0f, _offsetX?.Value ?? 0.45f); _startingOffsetY = _offsetY.Value; _runtimeOffsetX = _startingOffsetX; _runtimeOffsetY = _startingOffsetY; _collisionMask = LayerMask.GetMask(new string[3] { "Default", "Ground", "Wall" }); _selectionTransform = CreatePersistentTransform("REPO Native Third Person Selection Transform"); _debugAnchorPoint = CreateDebugPoint("REPO Native Third Person Anchor Debug", new Color(0.2f, 1f, 0.2f, 0.9f), 0.18f); _debugHeadPoint = CreateDebugPoint("REPO Native Third Person Head Debug", new Color(1f, 0.2f, 0.2f, 0.9f), 0.18f); _debugGrabOriginPoint = CreateDebugPoint("REPO Native Third Person Grab Origin Debug", new Color(0.25f, 0.95f, 1f, 0.95f), 0.16f); _debugGrabCameraHitPoint = CreateDebugPoint("REPO Native Third Person Grab Camera Hit Debug", new Color(1f, 0.85f, 0.1f, 0.95f), 0.14f); _debugGrabTargetPoint = CreateDebugPoint("REPO Native Third Person Grab Target Debug", new Color(0.2f, 1f, 0.2f, 0.95f), 0.18f); CreateInputActions(); _harmony = new Harmony("com.reponativemods.thirdperson"); _harmony.PatchAll(typeof(RepoUpdatePatches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Loaded action-movement build 56 with targeted grab and puke hotfixes. ToggleKey={_toggleKey.Value}, CollisionRadius={_collisionRadius.Value:0.###}, OffsetX={_runtimeOffsetX:0.###}, GrabOffset={_grabCameraOffsetX.Value:0.###}, DebugPoints={_debugShowCameraPoints.Value}, GrabDebug={_debugShowGrabSelection.Value}, TransparencyMode={_localTransparencyMode.Value}, SelectionOrigin={_selectionOriginMode.Value}, RuntimeTuningLocked={_lockRuntimeCameraTuning.Value}"); } private void LockAcceptedMapOverlaySettings() { if (_mapOverlayX != null) { _mapOverlayX.Value = 0f; } if (_mapOverlayY != null) { _mapOverlayY.Value = -0.55f; } if (_mapOverlayZ != null) { _mapOverlayZ.Value = 0.73f; } if (_mapOverlayScale != null) { _mapOverlayScale.Value = 1.55f; } if (_mapOverlayPitch != null) { _mapOverlayPitch.Value = -90f; } if (_mapOverlayYaw != null) { _mapOverlayYaw.Value = 0f; } if (_mapOverlayRoll != null) { _mapOverlayRoll.Value = 0f; } } private void LockAcceptedCameraCollisionSettings() { if (_collisionRadius != null) { _collisionRadius.Value = Mathf.Min(_collisionRadius.Value, 0.035f); } } private void LockAcceptedGrabCameraSettings() { if (_offsetX != null) { _offsetX.Value = 0.45f; } if (_grabCameraOffsetX != null) { _grabCameraOffsetX.Value = 0f; } } private static Transform CreatePersistentTransform(string objectName) { //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_000c: Expected O, but got Unknown GameObject val = new GameObject(objectName); KeepAliveOutsideScene(val); return val.transform; } private static void KeepAliveOutsideScene(GameObject owner) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)owner != (Object)null) { owner.transform.SetParent((Transform)null, true); ((Object)owner).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)owner); } } private void Update() { TickInput(); EnforceFirstPersonLocalModelHidden(); } internal void TickInput() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (_lastInputTickFrame != Time.frameCount) { _lastInputTickFrame = Time.frameCount; if ((IsActionPressedThisFrame(_toggleAction) || IsKeyPressedThisFrame(_toggleKey.Value)) && CanToggleThirdPerson()) { SetThirdPersonActive(!_thirdPersonActive, preserveCrosshair: true); } if (_thirdPersonActive) { HandleZoomInput(); HandleOffsetInput(); } } } internal void TickActionMovement() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0051: 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) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) if (_lastActionMovementTickFrame == Time.frameCount) { return; } _lastActionMovementTickFrame = Time.frameCount; if (!CanAcceptActionMovementInput()) { return; } PlayerAvatar instance = PlayerAvatar.instance; CameraAim instance2 = CameraAim.Instance; if ((Object)instance != (Object)null && (Object)instance2 != (Object)null) { Vector3 val = ReadCameraRelativeMoveDirection(((Component)instance2).transform); if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { _lastActionMoveDirection = val; _lastActionMoveDirectionTime = Time.time; RotateAvatarTowardMovement(instance, val); } } } internal void TickActionMovementVisuals(PlayerAvatarVisuals visuals) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003b: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0053: 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_0068: Expected O, but got Unknown //IL_0068: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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) if ((Object)visuals == (Object)null || (Object)visuals.playerAvatar == (Object)null || (Object)visuals.playerAvatar != (Object)PlayerAvatar.instance) { return; } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance == (Object)null || (Object)visuals != (Object)instance.playerAvatarVisuals || visuals.isMenuAvatar || (Object)visuals.playerAvatarMenu != (Object)null) { return; } Quaternion rotation2; if (IsLocalGrabActive() && TryGetGameplayAimRotation(out var rotation)) { Quaternion val = (_hasVisualFacingRotation ? _visualFacingRotation : ((Component)visuals).transform.rotation); float num = Mathf.Max(1f, (_actionTurnSpeed?.Value ?? 14f) * 1.5f); float num2 = 1f - Mathf.Exp(0f - num * Mathf.Max(0f, Time.deltaTime)); _visualFacingRotation = Quaternion.Slerp(val, rotation, num2); _hasVisualFacingRotation = true; ApplyVisualFacingRotation(visuals); } else if ((RepoUpdatePatches.IsActionMovementCameraLockHeld() || IsMapAimLockActive()) && TryGetGameplayAimRotation(out rotation2)) { Quaternion val2 = (_hasVisualFacingRotation ? _visualFacingRotation : ((Component)visuals).transform.rotation); float num3 = Mathf.Max(1f, _actionTurnSpeed?.Value ?? 14f); float num4 = 1f - Mathf.Exp(0f - num3 * Mathf.Max(0f, Time.deltaTime)); _visualFacingRotation = Quaternion.Slerp(val2, rotation2, num4); _hasVisualFacingRotation = true; ApplyVisualFacingRotation(visuals); } else { if (!CanAcceptActionMovementInput()) { return; } CameraAim instance2 = CameraAim.Instance; if ((Object)instance2 == (Object)null) { return; } Vector3 moveDirection = ReadGameInputCameraRelativeMoveDirection(((Component)instance2).transform); if (((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f) { if (Time.time - _lastActionMoveDirectionTime > 0.2f) { return; } moveDirection = _lastActionMoveDirection; } if (!(((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f)) { RotateTransformToward(((Component)visuals).transform, moveDirection); } } } private bool IsMapAimLockActive() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && (Object)Map.Instance != (Object)null) { return Map.Instance.Active; } return false; } private bool IsLocalGrabActive() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (!_thirdPersonActive || _temporarilyFirstPerson) { return false; } if ((Object)PhysGrabber.instance != (Object)null && PhysGrabber.instance.grabbed) { return true; } if ((Object)PlayerController.instance != (Object)null) { return PlayerController.instance.physGrabActive; } return false; } internal void BeginActionMovementRewrite(PlayerController controller) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0015: 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_0029: Expected O, but got Unknown //IL_0029: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0081: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) _rewriteMovementInput = false; if ((Object)controller == (Object)null || (Object)controller != (Object)PlayerController.instance || !CanAcceptActionMovementInput()) { return; } CameraAim instance = CameraAim.Instance; if ((Object)instance == (Object)null || RepoUpdatePatches.IsActionMovementCameraLockHeld()) { return; } float num = SemiFunc.InputMovementX(); float num2 = SemiFunc.InputMovementY(); if (!(Mathf.Abs(num) <= 0.001f) || !(Mathf.Abs(num2) <= 0.001f)) { Vector3 val = ReadCameraRelativeMoveDirection(((Component)instance).transform, num, num2); if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { _lastActionMoveDirection = val; _lastActionMoveDirectionTime = Time.time; Quaternion val2 = ExactLookRotation(val, ((Component)controller).transform.rotation); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(num, num2); float num3 = Mathf.Clamp01(((Vector2)(ref val3)).magnitude); _rewriteMovementX = 0f; _rewriteMovementY = Mathf.Max(0.01f, num3); _rewriteTurnYaw = ((Quaternion)(ref val2)).eulerAngles.y; _lastRewriteTurnYaw = _rewriteTurnYaw; _hasRewriteTurnYaw = true; _rewriteMovementInput = true; } } } internal void EndActionMovementRewrite() { _rewriteMovementInput = false; } internal void TickActionMovementAfterFixedUpdate(PlayerController controller) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0016: 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) //IL_002a: Expected O, but got Unknown //IL_002a: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0048: 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_005d: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!_rewriteMovementInput || (Object)controller == (Object)null || (Object)controller != (Object)PlayerController.instance || !CanAcceptActionMovementInput() || (Object)CameraAim.Instance == (Object)null) { return; } Vector3 lastActionMoveDirection = _lastActionMoveDirection; if (!(((Vector3)(ref lastActionMoveDirection)).sqrMagnitude < 0.0001f)) { _lastActionMoveDirection = lastActionMoveDirection; _lastActionMoveDirectionTime = Time.time; PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance != (Object)null && (Object)instance.playerAvatarVisuals != (Object)null) { RotateVisualsTowardMovement(instance.playerAvatarVisuals, lastActionMoveDirection, Time.fixedDeltaTime); } } } internal void TickModdedModelPlayerAvatarPostUpdate(object moddedModelPlayerAvatar) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && moddedModelPlayerAvatar != null && IsLocalModdedModelPlayerAvatar(moddedModelPlayerAvatar)) { object obj = _currentModelInstanceField?.GetValue(moddedModelPlayerAvatar); GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (!((Object)val == (Object)null)) { StabilizeLocalModdedModel(val); } } } private bool CanAcceptActionMovementInput() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown if (!_thirdPersonActive || _temporarilyFirstPerson || _actionMovementEnabled == null || !_actionMovementEnabled.Value) { return false; } if (!CanAcceptGameplayCameraInput()) { return false; } if (_actionMovementWhileGrabbing == null || !_actionMovementWhileGrabbing.Value) { if ((Object)PhysGrabber.instance != (Object)null && PhysGrabber.instance.grabbed) { return false; } if ((Object)PlayerController.instance != (Object)null && PlayerController.instance.physGrabActive) { return false; } } return true; } private static bool CanAcceptGameplayCameraInput() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Invalid comparison between Unknown and I4 if (!((Object)GameDirector.instance != (Object)null) || (int)GameDirector.instance.currentState != 2) { return false; } if (!((Object)PlayerController.instance != (Object)null) || !((Object)PlayerAvatar.instance != (Object)null) || !((Object)CameraAim.Instance != (Object)null)) { return false; } bool flag = (Object)Map.Instance != (Object)null && Map.Instance.Active; if (!flag && (int)Cursor.lockState != 1) { return false; } if (!flag && (IsAnyMenuPageOpen() || SemiFunc.MenuLevel() || !SemiFunc.NoTextInputsActive())) { return false; } return true; } private static bool CanToggleThirdPerson() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown if (!((Object)GameDirector.instance != (Object)null) || (int)GameDirector.instance.currentState != 2) { return false; } if (!((Object)PlayerController.instance != (Object)null) || !((Object)PlayerAvatar.instance != (Object)null) || !((Object)CameraAim.Instance != (Object)null)) { return false; } if (IsAnyMenuPageOpen() || SemiFunc.MenuLevel() || !SemiFunc.NoTextInputsActive()) { return false; } return true; } private static bool IsAnyMenuPageOpen() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown MenuManager instance = MenuManager.instance; if (!((Object)instance != (Object)null)) { return false; } if (_menuCurrentPageField == null) { _menuCurrentPageField = typeof(MenuManager).GetField("currentMenuPage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj = _menuCurrentPageField?.GetValue(instance); Object val = (Object)((obj is Object) ? obj : null); if (val != (Object)null) { return val != (Object)null; } return false; } private Vector3 ReadCameraRelativeMoveDirection(Transform cameraTransform) { //IL_0073: 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) float num = 0f; float num2 = 0f; if (IsKeyHeld((KeyCode)119)) { num2 += 1f; } if (IsKeyHeld((KeyCode)115)) { num2 -= 1f; } if (IsKeyHeld((KeyCode)100)) { num += 1f; } if (IsKeyHeld((KeyCode)97)) { num -= 1f; } if (Mathf.Abs(num) <= 0.001f && Mathf.Abs(num2) <= 0.001f) { return Vector3.zero; } return ReadCameraRelativeMoveDirection(cameraTransform, num, num2); } private static Vector3 ReadGameInputCameraRelativeMoveDirection(Transform cameraTransform) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ReadCameraRelativeMoveDirection(cameraTransform, SemiFunc.InputMovementX(), SemiFunc.InputMovementY()); } private static Vector3 ReadCameraRelativeMoveDirection(Transform cameraTransform, float horizontal, float vertical) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_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_005a: 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) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if ((Object)cameraTransform == (Object)null || (Mathf.Abs(horizontal) <= 0.001f && Mathf.Abs(vertical) <= 0.001f)) { return Vector3.zero; } Vector3 val = cameraTransform.forward; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = cameraTransform.rotation * Vector3.forward; val.y = 0f; } val = ((Vector3)(ref val)).normalized; Vector3 val2 = cameraTransform.right; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = Vector3.Cross(Vector3.up, val); } val2 = ((Vector3)(ref val2)).normalized; Vector3 result = val * vertical + val2 * horizontal; if (((Vector3)(ref result)).sqrMagnitude > 1f) { result = ((Vector3)(ref result)).normalized; } return result; } private Vector3 ReadActionMovementDirectionFromCamera() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //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_0014: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) CameraAim instance = CameraAim.Instance; if ((Object)instance == (Object)null) { return Vector3.zero; } Vector3 val = ReadCameraRelativeMoveDirection(((Component)instance).transform); if (((Vector3)(ref val)).sqrMagnitude >= 0.0001f) { _lastActionMoveDirection = val; _lastActionMoveDirectionTime = Time.time; } return val; } private void RotateAvatarTowardMovement(PlayerAvatar avatar, Vector3 moveDirection) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) Transform actionMovementRotationTarget = GetActionMovementRotationTarget(avatar); if ((Object)actionMovementRotationTarget != (Object)null) { RotateTransformToward(actionMovementRotationTarget, moveDirection); } } private void RotateTransformToward(Transform target, Vector3 moveDirection) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) RotateTransformToward(target, moveDirection, Time.deltaTime); } private void RotateTransformToward(Transform target, Vector3 moveDirection, float deltaTime) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)target == (Object)null)) { moveDirection.y = 0f; if (!(((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f)) { target.rotation = SmoothedLookRotation(target.rotation, moveDirection, deltaTime); } } } private void RotateVisualsTowardMovement(PlayerAvatarVisuals visuals, Vector3 moveDirection, float deltaTime) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003c: 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_0041: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) if (!((Object)visuals == (Object)null)) { moveDirection.y = 0f; if (!(((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f)) { Quaternion currentRotation = (_hasVisualFacingRotation ? _visualFacingRotation : ((Component)visuals).transform.rotation); _visualFacingRotation = SmoothedLookRotation(currentRotation, moveDirection, deltaTime); _hasVisualFacingRotation = true; ApplyVisualFacingRotation(visuals); } } } private void ApplyVisualFacingRotation(PlayerAvatarVisuals visuals) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (_hasVisualFacingRotation && !((Object)visuals == (Object)null)) { ((Component)visuals).transform.rotation = _visualFacingRotation; SetPlayerAvatarVisualsBodySpringTarget(visuals, _visualFacingRotation); } } private void SetPlayerAvatarVisualsBodySpringTarget(PlayerAvatarVisuals visuals, Quaternion rotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!((Object)visuals == (Object)null)) { if (_avatarVisualBodySpringTargetField == null) { _avatarVisualBodySpringTargetField = typeof(PlayerAvatarVisuals).GetField("bodySpringTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _avatarVisualBodySpringTargetField?.SetValue(visuals, rotation); } } private Quaternion SmoothedLookRotation(Quaternion currentRotation, Vector3 moveDirection, float deltaTime) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0071: Unknown result type (might be due to invalid IL or missing references) moveDirection.y = 0f; if (((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f) { return currentRotation; } Quaternion val = Quaternion.LookRotation(((Vector3)(ref moveDirection)).normalized, Vector3.up); float num = Mathf.Max(1f, _actionTurnSpeed?.Value ?? 14f); float num2 = 1f - Mathf.Exp(0f - num * Mathf.Max(0f, deltaTime)); return Quaternion.Slerp(currentRotation, val, num2); } private void StabilizeCachedLocalModdedModel() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && !((Object)_cachedModelInstance == (Object)null)) { StabilizeLocalModdedModel(_cachedModelInstance); } } private void StabilizeLocalModdedModel(GameObject model) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_001b: 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) if (!((Object)model == (Object)null)) { model.transform.rotation = GetStableLocalModelRotation(model.transform.rotation); } } private void LockLocalAvatarVisualsToRoot() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if (!_thirdPersonActive || _temporarilyFirstPerson) { return; } PlayerAvatar instance = PlayerAvatar.instance; if (!((Object)instance == (Object)null) && !((Object)instance.playerAvatarVisuals == (Object)null) && !IsAvatarDeadOrDisabled(instance)) { PlayerAvatarVisuals playerAvatarVisuals = instance.playerAvatarVisuals; Vector3 position = ((Component)instance).transform.position; ((Component)playerAvatarVisuals).transform.position = position; ApplyVisualFacingRotation(playerAvatarVisuals); if (_avatarVisualPositionField == null) { _avatarVisualPositionField = typeof(PlayerAvatarVisuals).GetField("visualPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_avatarVisualFollowLerpField == null) { _avatarVisualFollowLerpField = typeof(PlayerAvatarVisuals).GetField("visualFollowLerp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _avatarVisualPositionField?.SetValue(playerAvatarVisuals, position); _avatarVisualFollowLerpField?.SetValue(playerAvatarVisuals, 1f); } } private Quaternion GetStableLocal