Decompiled source of Doppel v1.0.1
Mods/Doppel.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Loader; using System.Runtime.Versioning; using System.Text; using System.Text.Json; using BoneLib; using BoneLib.BoneMenu; using BoneLib.Notifications; using DoppelMod; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Bonelab; using Il2CppSLZ.Data; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.Audio; using Il2CppSLZ.Marrow.Combat; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.Interaction; using Il2CppSLZ.Marrow.Pool; using Il2CppSLZ.Marrow.SceneStreaming; using Il2CppSLZ.Marrow.Utilities; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSLZ.VRMK; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Il2CppTMPro; using MelonLoader; using MelonLoader.Utils; using Portals.MonoBehaviours; using ThirdEyeBonelabMod; using ThirdEyeBonelabMod.Bots; using UnityEngine; using UnityEngine.AI; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Mod), "Doppel", "1.0.1", "RUDYHILL", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Doppel")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Doppel")] [assembly: AssemblyTitle("Doppel")] [assembly: AssemblyVersion("1.0.0.0")] namespace DoppelMod { public class Mod : MelonMod { private static bool started; private static float errorSaidAt = -10f; public override void OnInitializeMelon() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) AssetFiles.Root = "Bot Player"; try { Entry.Start(Page.Root.CreatePage("Doppel", Color.cyan, 0, true)); started = true; MelonLogger.Msg("Doppel ready (BoneMenu > Doppel)"); } catch (Exception ex) { MelonLogger.Error("Doppel could not start: " + ex); } } public override void OnUpdate() { Run(Entry.Update); } public override void OnFixedUpdate() { Run(Entry.FixedUpdate); } public override void OnDeinitializeMelon() { if (started) { Run(Entry.Stop); } } private static void Run(Action step) { if (!started) { return; } try { step(); } catch (Exception ex) { if (Time.realtimeSinceStartup - errorSaidAt > 5f) { errorSaidAt = Time.realtimeSinceStartup; MelonLogger.Error("Doppel: " + ex); } } } } } namespace ThirdEyeBonelabMod { public static class AssetFiles { public static string Root = "Mod"; public static string SaveFolder(string name) { return Path.Combine(MelonEnvironment.UserDataDirectory, Root, name); } } public static class Spawnables { public static void Notify(string message) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //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_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown MelonLogger.Msg(message); Notifier.Send(new Notification { Title = NotificationText.op_Implicit("Doppel"), Message = NotificationText.op_Implicit(message), Type = (NotificationType)0, PopupLength = 1.5f, ShowTitleOnPopup = true }); } } } namespace ThirdEyeBonelabMod.Bots { public class Bot { public enum Mode { Stand, Follow, Wander, Gunplay, Brain, Fists, Clone, Copy, Replay } public enum Goal { Idle, Fight, Retreat, TakeCover, ArmUp, Investigate, Explore, Follow, Guard, Play, Practice, Brawl } private enum Fid { None, Hand, Scratch, Neck, Stretch, Hips, Shake, Down, Behind } private enum Hold { Aimed, Low, Reload } private enum Step { OneHand, Reach, Settle, Ready } private enum Play { None, GoTo, Reach, Hold, WindUp, Throw, Drop, Shoot, Tinker, Melee } private enum Then { Throw, TossToYou, Drop } private enum Act { Idle, Stroll, Jog, Sprint, Climb, Play, Shoot, Visit, Explore, Use, Tinker, Go } private enum Reload { None, Eject, Fetch, Insert, Rack } public struct Pose { public Vector3 position; public Quaternion rotation; public static readonly Pose identity = new Pose(Vector3.zero, Quaternion.identity); public Pose(Vector3 position, Quaternion rotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) this.position = position; this.rotation = rotation; } public static Pose Of(Transform t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return new Pose(t.position, t.rotation); } public static Pose operator *(Pose a, Pose b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) return new Pose(a.position + a.rotation * b.position, a.rotation * b.rotation); } public Pose Inverse() { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Inverse(rotation); return new Pose(val * -position, val); } public static Pose Lerp(Pose a, Pose b, float k) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) return new Pose(Vector3.Lerp(a.position, b.position, k), Quaternion.Slerp(a.rotation, b.rotation, k)); } } private enum Sight { Open, Thing, High, Bot, New, You, Tall, Drive } private struct Eased { public Vector3 from; public Quaternion turnFrom; public float at; public float turnAt; public bool turning; public bool moving; } public readonly RigManager rig; public readonly Personality personality; private readonly OpenControllerRig controls; public Mode mode; private Frame pose; private float bodyYaw; private Vector2 walk; private Vector2 stick; private bool jump; private bool otherA; private bool primaryClick; private bool secondaryClick; private bool running; private float runningSince; private bool crouching; private float crouch; private float feet; private float jumpDue = -1f; private int jumpsCleared; private float jumpClearSaidAt = -10f; private float jumpAsked; private bool wasJumping; private float jumpedAt = -10f; private float curl = 0.25f; private List<Frame> replay; private int replayAt; private int lastJumpFrame = -1; private float replayStart; private float replayYaw; private readonly Navigator nav = new Navigator(); private float idleUntil; private float ledgeJumpAt = -10f; private float stride; private float headYaw; private bool following; private Frame[] clip; private Frame[] fromClip; private float clipT; private float fromT; private float clipLeft; private float fade = 1f; private bool clipMirror; private bool fromMirror; private float clipRate = 1f; private float fromRate = 1f; private readonly List<Frame[]> lately = new List<Frame[]>(); private MotionLibrary.Gait gait; private MotionLibrary.Gait wantGait; private float wantSince; private readonly float born; private bool heard; private float metHeight = 1.65f; public bool enemy; public const string EnemyMark = "BotEnemyMark"; private bool broken; private float partsOffSince = -1f; private int mended; private float mendedAt = -100f; private Vector2 gameStick; private float seatOutAt = -10f; private int driveCalls; private int driveStops; private int cloneDrives; private bool gameSprints; public int LastDriveFrame; private static int named; private string nameIs; private float walkMost; private float sprintClickAt = -10f; private float sprintSaidAt = -10f; private float seatedLooseSince = -1f; private int seatedTries; private float waveUntil; private float waveStart; private Vector3 followSideWas; private float dropSaidAt = -10f; private string travelEnded = ""; private float noGunSaidAt = -100f; private Vector3 steer; private float goYawWas; private float goAt = -10f; private float goSaidAt = -10f; private float goByOthers; private float goByWay; private float goByApart; private Vector3 goDirWas; private IntPtr eyesOf; private float headCutSaidAt = -10f; private float badSaidAt = -10f; private static float pointSince = -1f; private static float pointedAt = -100f; private static Vector3 pointPlace; private static bool pointHas; private static int pointFrame = -1; private float pointSeen = -100f; private float stareSince = -1f; private float staredAt = -100f; private static Vector3 youStoodAt; private static float youStoodSince; private static int youFrame = -1; private readonly Dictionary<string, float> calledAt = new Dictionary<string, float>(); private const float ThinkEvery = 0.3f; private const float LearnEvery = 3f; private const float CloseCallRange = 1.6f; private const float CellSize = 5f; private readonly List<Targets.Target> hostiles = new List<Targets.Target>(); private readonly List<Vector3> seenEnemies = new List<Vector3>(); private Targets.Target nearestSeen; private Targets.Target mostDangerous; private float nearestSeenDistance = 999f; private float nearestAnyDistance = 999f; private Vector3 nearestAnyAt; private readonly float[] seen = new float[Knowledge.Features]; private Vector3 lastEnemyAt; private Vector3 lastEnemyVelocity; private float lastEnemyTime = -100f; private readonly HashSet<long> visited = new HashSet<long>(); private bool wasSeen; private Vector3 lookAt; private float lookUntil; public Goal goal; private float goalSince; private float goalReward; private float windowSince; private readonly float[] windowSeen = new float[Knowledge.Features]; private float thinkAt; private float closeCallAt = -10f; private string why = ""; private Vector3 goalPlace; private bool hasGoalPlace; private string heldBarcode; private float heldSince; private Targets.Target engaged; private float engagedAt = -10f; private Targets.Target brainTarget; private float coverReachedAt = -1f; private TextMeshPro thought; private static TMP_FontAsset font; private readonly Dictionary<IntPtr, float> sightAt = new Dictionary<IntPtr, float>(); private float climbAfterAt; private float noGunUntil; private Vector3 huntedAt; private float coverWantAt; private float coverStay = 2.5f; private float coverRestUntil; private float gunThreatAt = -100f; private bool climbing; private int climbPhase; private Vector3 climbEdge; private Vector3 climbIn; private float climbHeight; private Quaternion climbFacing; private ClimbMoves.Climb climbMove; private float climbT; private float climbReach; private float climbWait; private Pose climbStartHead; private Pose climbStartLeft; private Pose climbStartRight; private bool climbLifting; private Vector3 climbLiftFrom; private Vector3 climbFeetFrom; private Vector3 climbGlide; private bool climbGliding; private bool climbLegsUp; private float climbGlideSince; private readonly List<Rigidbody> climbBodies = new List<Rigidbody>(); private Vector3 climbLastEdge; private float climbLiftSaidAt; private float climbUpAt = -100f; private int climbTries; private float climbSince; private float climbLookAt; private Frame climbFrom; private readonly bool[] climbHolding = new bool[2]; private Pose climbHead; private Pose climbLeft; private Pose climbRight; private bool climbWantLeft; private bool climbWantRight; private float climbKeenAt = -10f; private bool climbHang; private Vector3 climbHangFeet; private readonly float[] climbSaidAt = new float[2]; private Clone.Take cloneTake; private float cloneStart; private int cloneEvent; private bool cloneLoop; private int cloneFrame; private readonly Dictionary<int, Poolee> cloneSpawns = new Dictionary<int, Poolee>(); private readonly List<(int id, string barcode, Vector3 at, float askedAt, HashSet<IntPtr> before)> clonePending = new List<(int, string, Vector3, float, HashSet<IntPtr>)>(); private readonly List<(Clone.Event e, float until)> cloneGrabs = new List<(Clone.Event, float)>(); private readonly Grip[] cloneHeld = (Grip[])(object)new Grip[2]; private float cloneFiredAt = -10f; private readonly float[] punchedAt = new float[2] { -10f, -10f }; private bool cloneDressing; private float cloneDressedBy; private float noSpawnSaidAt = -10f; private string grabWhy = ""; private int holdingPlayer = -1; private Vector3 heldOffset; private float playerHeldSince; private readonly List<Rigidbody> heldBodies = new List<Rigidbody>(); private readonly float[] cloneGrip = new float[2]; private static readonly List<(Vector3 at, float t)> recentSpawns = new List<(Vector3, float)>(); private bool tinkering; private string tinkerCode = ""; private string tinkerName = ""; private int trialN; private int trialsWanted; private string trialAction = ""; private string lastTrialAction = ""; private int trialPhase; private float trialAt; private readonly List<(Rigidbody rb, Vector3 at)> trialBodies = new List<(Rigidbody, Vector3)>(); private int trialParts; private bool trialSound; private Vector3 trialHead; private int trialPortals; private float trialBegan; private bool pressA; private bool pressB; private bool pressMenu; private bool pressClick; private string tinkerWant; private float newsSeen; private string pendingCode; private Vector3 pendingAt; private float pendingUntil; private bool menuWas; private Rigidbody heldForLesson; private bool heldForLessonWasKinematic; private float heldForLessonUntil; private Mode pointBackTo; private float pointBackAt = -1f; private float throwFar; private Vector3 throwAt; private Rigidbody flying; private Vector3 flyTarget; private float flySpeed; private float flyLoft; private float flyFar; private float flySince; private float flyNearest; private Driving.Model driveModel; private bool driveMeant; private bool driving; private Vector3 driveGoal; private Transform driveAfter; private string driveWhy = ""; private string driveEndWhy = ""; private float driveWaitSince; private float driveTookAt; private float driveStuckFor; private float driveBackUntil; private float driveBackTurn; private float driveOverFor; private float driveOutAt; private float driveSaidAt; private float driveGrabAt; private float driveNextAt; private float driveFollowAt; private float driveYouOutFor; private float driveStopSince; private float driveFeelAt; private readonly float[] driveHandOff = new float[2]; private int driveBacks; private Vector3 driveBackFrom; private bool driveStopping; private bool driveOut; private float driveGo; private float driveBack; private float driveTurn; private float driveTurnNow; private Vector3[] driveWay = (Vector3[])(object)new Vector3[0]; private int driveWayNext; private float driveWayAt; private float driveWayFound = -100f; private NavMeshPath drivePath; private static readonly float[] feelAngles = new float[9] { 0f, 15f, -15f, 30f, -30f, 50f, -50f, 75f, -75f }; private readonly float[] feelClear = new float[9]; private float feelLength = 8f; private float feelBehind = 5f; private bool driveAbout; private float driveAboutAt; private float[] skill; private bool skillTrying; private bool skillScored; private float skillFar; private int skillBacks; private int skillAbouts; private int skillRouteFrom; private float driveNoRoomSaid = -100f; private float driveClockAt; private int posed; private string poseWhy = ""; private bool driveLiveSaid; private List<Vector3> driveRoute; private List<float> driveRouteSpeed; private int driveRouteAt; private bool driveTrail; private Vector3 driveFacing; private static readonly Dictionary<IntPtr, KeyValuePair<Vector3, float>> driveSpots = new Dictionary<IntPtr, KeyValuePair<Vector3, float>>(); private Vector3 driveAimLeft; private Vector3 driveAimRight; private Transform leftVehicle; private float leftVehicleAt = -100f; private float driveYawWas; private float driveSpin; private bool driveYawHas; private readonly List<Vector3> bendWay = new List<Vector3>(); private float kartSeekAt; private Poolee kartSought; private Fid fid; private Fid lastFid; private float fidStart; private float fidLong; private float fidNext = -1f; private float fidLevel; private float fidSide = 1f; private Frame[] hitClip; private bool punchRight; private float punchAt = -10f; private float nextPunchAt; private float punchSaidAt = -10f; private int comboLeft; private readonly List<Frame[]> hitLately = new List<Frame[]>(); private bool meleeWanted; private float meleeReach = 1.3f; private float meleeSeenAt; private float meleeSenseAt; private float chaseSetAt; private Vector3 hitRightWas; private Vector3 hitLeftWas; private Quaternion hitRightTurnWas = Quaternion.identity; private Quaternion hitLeftTurnWas = Quaternion.identity; private float hitPosedAt = -10f; private Vector3 hitRightBefore; private Vector3 hitLeftBefore; private float hitFast; private float hitSpin; private float hitBody; private Quaternion fistOffRight = Quaternion.identity; private Quaternion fistOffLeft = Quaternion.identity; private static readonly string[] meleeWords = new string[28] { "knife", "dagger", "sword", "katana", "machete", "cleaver", "axe", "hatchet", "bat", "crowbar", "hammer", "sledge", "pipe", "wrench", "shovel", "spear", "club", "baton", "mace", "pickaxe", "kunai", "blade", "pan", "bottle", "golf", "hook", "shiv", "chainsaw" }; private Vector3 toolLocal = Vector3.back; private Quaternion toolTurnWas = Quaternion.identity; private bool toolTurnHas; private Vector3 gazeAt; private Transform gazeFollow; private string gazeOn = ""; private float gazeUntil; private float gazeYaw; private float gazePitch; private float gazeYawSpeed; private float gazePitchSpeed; private float gazeFarSince = -1f; private Vector3 heardAt; private float heardTime = -100f; private Vector2 aimFix; private GunMoves.Reload learnedReload; private bool learnedInsertTried; private float aimSaidAt; private float lockSaidAt = -10f; private float learnedHoldAt = -10f; private float aimPitchNow; private float aimYawNow; private float lookPitchNow; private float lookYawNow; private bool lockSet; private Vector3 reachFix; private Pose gunInController; private bool leftOnGunSet; private Pose leftOnGun; private IntPtr lockGun; private float lockSince; private float chargedAt = -10f; private static readonly string[] SpawnGuns = new string[10] { "c1534c5a-fcfc-4f43-8fb0-d29531393131", "c1534c5a-bcb7-4f02-a4f5-da9550333530", "c1534c5a-2a4f-481f-8542-cc9545646572", "c1534c5a-d00c-4aa8-adfd-3495534d474d", "c1534c5a-8d03-42de-93c7-f595534d4755", "c1534c5a-4c47-428d-b5a5-b05747756e56", "c1534c5a-40e5-40e0-8139-194347756e55", "c1534c5a-a6b5-4177-beb8-04d947756e41", "c1534c5a-9112-49e5-b022-9c955269666c", "c1534c5a-c061-4c5c-a5e2-3d955269666c" }; private const float Range = 35f; private Gun gun; private Grip support; private bool supportHeld; private float supportTriedAt = -10f; private int supportTries; private float shootUntil; private bool spawningGun; private float spawnAskedAt; private Gun ownGun; private float lastSpawnAt = -100f; private Vector3 spawnAt; private readonly HashSet<IntPtr> gunsBefore = new HashSet<IntPtr>(); private Targets.Target target; private float targetCheckAt; private float targetSince; private float lostTargetAt; private float doneWithTargetAt = -10f; private int shotsAtTarget; private Vector2 sidestep; private float sidestepUntil; private Vector2 footMove; private float footUntil; private float footSide = 1f; private float dodgedAt = -10f; private float[] footLikes; private float footPace = 1f; private float footLong = 1f; private float duckUntil; private float duckDepth; private float duckNow; private float trigger; private float triggerSince; private bool triggerWorks; private float firedAt = -10f; private Vector3 lastAimPoint; private float lastTargetAt = -10f; private float noMagSince; private int burstRoundsLeft; private float firedByHandAt = -10f; private float nextPullAt; private float burstUntil; private int dryPulls; private float pullToJudge = -1f; private float judgeAt; private Pose rightOnController = Pose.identity; private Pose freeRight = Pose.identity; private bool freeRightSet; private Pose rightFix = Pose.identity; private Pose leftFix = Pose.identity; private bool handMeasured; private Pose gunWant; private bool gunWantSet; private Pose rightInGun; private bool rightInGunSet; private Pose leftInGun; private bool leftInGunSet; private float twoHandSince; private float reaction = 0.45f; private float tapLength = 0.08f; private float wantedFireSince = -1f; private Vector2 wobble; private float unsafeSince = -1f; private float assistUntil = -10f; private float assistBegan = -10f; private float assistSawAt = -10f; private bool directAsked; private float forcedAt; private int forcedDry; private float forcedSeen; private static readonly HashSet<IntPtr> magless = new HashSet<IntPtr>(); private float loadSettleUntil; private int loadFails; private static readonly Dictionary<IntPtr, float> wontLoad = new Dictionary<IntPtr, float>(); private float duckAskedAt = -10f; private static MethodInfo zombieHit; private static bool zombieLooked; private static float zombieDamage = 25f; private float zombieSaidAt = -10f; private float[] shootSkill; private bool shootTrying; private int skillShots; private int skillHits; private float skillShooting; private float skillLastShot = -10f; private float shotRange = 8f; private Pose freeLeft = Pose.identity; private bool freeLeftSet; private Step step = Step.Ready; private float stepAt; private Pose leftStart; private const float SeekRadius = 10f; private const float MaxMass = 15f; private Play play; private Then then; private Rigidbody item; private Grip grip; private float playAt; private float holdFor; private Vector3 throwDir; private bool released; private bool fists; private bool tossNext; private bool forceToss; private bool handOverride; private Vector3 handAt; private Quaternion handTurn; private float playHeight; private float playPitch; private float playYaw; private bool leftOverride; private Vector3 leftAt; private Quaternion leftTurn; private Frame[] pickClip; private IntPtr pickFor; private bool pickMirror; private float pickTakeAt; private float pickLow; private float pickChosenAt = -10f; private float hp = -1f; public bool dead; private float diedAt; private float bluntAt = -10f; private Rigidbody stowed; private Gun stowedGun; private Grip stowedGrip; private Transform stowOn; private Vector3 stowAt; private Quaternion stowTurn; private bool stowedKinematic; private readonly List<Collider> stowedOff = new List<Collider>(); private float stowedSince; private float drawnAt = -10f; private MarrowEntity[] ownEntities; private float awakeAt; private int wakings; private float fastSaidAt = -10f; private readonly HashSet<IntPtr> noPushDone = new HashSet<IntPtr>(); private float risingFor; private float liftedFor; private float liftedAt = -100f; private float noPushAgainAt; private IntPtr fleshOf; private float hurtAt = -100f; private float voiceAt = -10f; private static SurfaceData bloodData; private static bool bloodAsked; private float labAimError = -1f; private Vector3 labGunUp; private Vector3 labWantUp; private Lessons.Lesson cloneLesson; private Mode lessonReturn; private float cloneYaw; private Vector3 cloneFrom; private Vector3 cloneTo; private float cloneSize = 1f; private bool lessonRootSet; private float lessonRootYaw; private Vector3 lessonPelvisWas; private bool lessonPelvisHas; private int lessonJumpAt = -1; private readonly List<float> lessonJumps = new List<float>(); private int lessonTurnsSeen; private int cloneDriven = -1; private float lessonSenseAt; private string lastLessonItem; private readonly Dictionary<Clone.Event, int> cloneStandIns = new Dictionary<Clone.Event, int>(); private Lessons.Lesson lessonNext; private bool lessonAtSpot; private int lessonLoops; private float lessonSeamAt = -10f; private Pose seamHead; private Pose seamLeft; private Pose seamRight; private Pose lastHeadPose; private Pose lastLeftPose; private Pose lastRightPose; private bool lessonPurposeful; private bool lessonGliding; private float wallTopY = float.MinValue; private float lessonTopY = float.MinValue; private readonly Dictionary<string, Poolee> lessonThings = new Dictionary<string, Poolee>(); private float regrabAt; private Vector3 lessonWallFoot; private Vector3 lessonWallIn; private Vector3 lessonLandAt; private bool lessonLanding; private float lessonLandSince; private int lessonLoopsDone; private readonly Dictionary<string, int> lessonStandIns = new Dictionary<string, int>(); private readonly HashSet<int> lessonBig = new HashSet<int>(); private readonly HashSet<int> lessonBigAsked = new HashSet<int>(); private Vector3 placeAhead; private Vector3 placeAt; private bool placeAtSet; private Clone.Event seatWaiting; private float seatWaitUntil; private float seatSitAt; private float seatAskedAt; private int seatMoves; private int seatRetries; private Seat seatAsked; private Clone.Event seatAskedOf; private readonly bool[] wallHeld = new bool[2]; private readonly bool[] wallPinned = new bool[2]; private readonly Vector3[] wallPin = (Vector3[])(object)new Vector3[2]; private readonly List<(Rigidbody body, Hand hand, Grip grip, Pose inHand, bool wasKinematic)> carried = new List<(Rigidbody, Hand, Grip, Pose, bool)>(); private float glidedAt; private float lessonDueAt = -1f; private Act act; private Act lastAct; private float actUntil; private bool portalGoing; private PortalWays.Way portalWay; private float portalSince; private int portalPhase; private float portalPhaseAt; private float portalNotBefore; private float portalTookSeen; private Vector3 portalHeadWas; private bool portalHeadHas; private float portalThroughAt = -100f; private float droveYaw; private bool droveHas; private Vector3 droveHead; private bool droveHeadHas; private float droveJumpAt = -10f; private float droveTurn; private float droveTurnAt = -10f; private bool labPortal; private float purposeAt; private (Vector3 foot, Vector3 inward, float height) planWall; private float flinchAt = -10f; private float flinchSize; private float flinchSide; private float nerves; private float nervesAt; private Vector3 fallLast; private bool fallHas; private float fallSpeed; private bool falling; private float fallTop; private float fallSince; private float landAt = -10f; private float landSize; private float noLandUntil; private float waveSeen; private float waveDue = -1f; private int waveTimes; private bool waveLeft; private float lastNearYou; private bool nearYou; private Reload reload; private float reloadAt; private Magazine newMag; private bool magAsked; private float magAskedAt; private Vector3 magAt; private readonly HashSet<IntPtr> magsBefore = new HashSet<IntPtr>(); private static readonly List<(Magazine mag, float at)> dropped = new List<(Magazine, float)>(); private const float DroppedFor = 20f; private bool ejected; private Grip slide; private bool slideHeld; private Vector3 slideFrom; private Pose leftOnController = Pose.identity; private bool leftMeasured; private float reloadedAt = -10f; private float cameOverAt = -1000f; private bool driveOnRoad; private string planWhy = ""; private Sight planSight; private Vector3 planPlace; private Vector3 planLook; private float planPush = 0.6f; private bool planRun; private float thinkUntil; private bool thinking2; private int detours; private Vector3 detourFor; private bool onDetour; private Vector3 viaPlace; private bool viaLeft; private Vector3 roamHeading; private float pauseUntil; private float pauseNext; private float planSince; private Sight lastSight = Sight.New; private string avatarCode = ""; private Frame[] waveClip; private Frame[] jumpClip; private Frame[] crouchClip; private float crouchStart; private bool crouchReset; private Frame[] previewClip; private bool previewing; private Mode previewBack; private Frame smoothOut; private bool smoothHas; private Eased easeLeft; private Eased easeRight; private Eased easeHead; private float easeHeightFrom; private float easeHeightAt = -10f; private float smoothSkipUntil; private int smoothDoing; private bool holdAimedNow; private int smoothFrame; private bool down; private float downAt; private float downFor; private bool rising; private float riseAt; private float upAt = -10f; private float bumpSaidAt = -10f; private float standingHeight { get { float num = StandingEyes(); if (!(num > 0.3f)) { return metHeight; } return num * 0.985f; } } public bool Alive { get { if ((Object)(object)rig != (Object)null && (Object)(object)controls != (Object)null && (Object)(object)controls.vrRoot != (Object)null) { return !broken; } return false; } } public bool Whole { get { if ((Object)(object)rig != (Object)null && (Object)(object)rig.physicsRig != (Object)null) { return ((Component)rig.physicsRig).gameObject.activeInHierarchy; } return false; } } public Transform Head { get { if (!((Object)(object)rig.physicsRig != (Object)null)) { return null; } return ((Rig)rig.physicsRig).m_head; } } private Vector3 Feet { get { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Head != (Object)null)) { return ((Component)rig).transform.position; } return Head.position - Vector3.up * pose.height; } } public Vector2 Walk { get { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!(((Vector2)(ref stick)).sqrMagnitude < 0.0001f)) { return gameStick; } return Vector2.zero; } } public string Name => nameIs ?? (nameIs = (enemy ? "E" : "B") + ++named); public static float YouStoodFor => Time.time - youStoodSince; private bool Armed { get { if ((Object)(object)gun != (Object)null) { return Holding(); } return false; } } private static float ReloadBelow => Mathf.Clamp(Knowledge.Style.Median(Knowledge.Style.reloadAt, 0.25f), 0.05f, 0.6f); private bool ClimbKeen { get { if (!(Time.time - climbKeenAt < 0.6f)) { if (enemy) { return goal == Goal.Investigate; } return false; } return true; } } public bool PlayingClone { get { if (mode == Mode.Clone) { return cloneTake != null; } return false; } } public bool Driving2 => driving; public bool DrivingNow { get { if (InLesson) { return driveMeant; } return false; } } public bool DrivingLesson { get { if (InLesson && cloneLesson != null) { return cloneLesson.purpose == "drive"; } return false; } } private bool MeleeArmed { get { if (play == Play.Melee) { return Holding(); } return false; } } private Quaternion ToolFix => Quaternion.FromToRotation(toolLocal, Vector3.back); private string GunKey { get { if (!((Object)(object)gun != (Object)null)) { return ""; } return GunMoves.KeyOf(gun, (Object)(object)support != (Object)null); } } public Gun OwnGun => ownGun; private bool Assisting => Time.time < assistUntil; private float[] Skill { get { if (shootSkill == null) { shootSkill = ShootSkill.Begin(((Il2CppObjectBase)rig).Pointer, out shootTrying); } return shootSkill; } } public bool Playing => play != Play.None; private Hand RightHand { get { if (!((Object)(object)rig.physicsRig != (Object)null)) { return null; } return rig.physicsRig.rightHand; } } private float MaxHp { get { if (!((Object)(object)rig.health != (Object)null) || !(rig.health.max_Health > 0f)) { return 10f; } return rig.health.max_Health; } } public bool HasStowed { get { if ((Object)(object)stowed != (Object)null) { return ((Component)stowed).gameObject.activeInHierarchy; } return false; } } private bool WeaponInHand { get { if (Holding()) { if (!((Object)(object)gun != (Object)null) || play != Play.Shoot) { return play == Play.Melee; } return true; } return false; } } public int LabShots { get; private set; } public int LabReloads { get; private set; } public Vector3 Facing => Quaternion.Euler(0f, bodyYaw, 0f) * Vector3.forward; public Transform GunHandTransform { get { if (!((Object)(object)RightHand != (Object)null)) { return Head; } return ((Component)RightHand).transform; } } public bool InLesson { get { if (mode == Mode.Clone) { return cloneLesson != null; } return false; } } public Mode KeptMode { get { if (!InLesson) { return mode; } return lessonReturn; } } private bool HandsFree { get { if (!handOverride && !Playing && !climbing) { return !fists; } return false; } } public bool Reloading => reload != Reload.None; private Hand LeftHand { get { if (!((Object)(object)rig.physicsRig != (Object)null)) { return null; } return rig.physicsRig.leftHand; } } public bool Down { get { if (!down) { return rising; } return true; } } public Bot(RigManager rig, float yaw) { //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) this.rig = rig; enemy = (Object)(object)((Component)rig).transform.Find("BotEnemyMark") != (Object)null; personality = Personality.Of(rig); controls = ((Il2CppObjectBase)rig.ControllerRig).TryCast<OpenControllerRig>(); bodyYaw = yaw; born = Time.time; if (Recorder.Capture(out var frame)) { metHeight = Mathf.Clamp(frame.height, 1.2f, 2.1f); } MotionLibrary.Refresh(); pose = Standing(0f, 0f, 0f, 0f); } private void StayWhole() { if (Whole) { partsOffSince = -1f; return; } if (partsOffSince < 0f) { partsOffSince = Time.time; } if (Time.time - partsOffSince < 1f) { return; } partsOffSince = -1f; if (Time.time - mendedAt > 30f) { mended = 0; } mendedAt = Time.time; if (++mended > 3) { Lab.Event("whole: its body will not stay switched on: done away with"); broken = true; return; } int num = 0; try { foreach (Rig componentsInChild in ((Component)rig).GetComponentsInChildren<Rig>(true)) { Transform val = ((Component)componentsInChild).transform; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)((Component)rig).transform) { if (!((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); num++; } val = val.parent; } if (!((Behaviour)componentsInChild).enabled) { ((Behaviour)componentsInChild).enabled = true; } } } catch (Exception ex) { Lab.Event("whole: could not switch its body on again: " + ex.Message); } Lab.Event("whole: its body had been switched off by the game: " + num + " part(s) switched on again (" + mended + ")"); } private Vector2 ForItsHead(Vector2 forBody) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) try { Transform head = Head; if ((Object)(object)head == (Object)null || ((Vector2)(ref forBody)).sqrMagnitude < 0.0001f || Tuning.F("move.byhead", 1f) < 0.5f) { return forBody; } Vector3 forward = Flat(head.forward); if (((Vector3)(ref forward)).sqrMagnitude < 0.04f) { return forBody; } float num = Mathf.DeltaAngle(Recorder.Yaw(forward), bodyYaw) * ((float)Math.PI / 180f); float num2 = Mathf.Cos(num); float num3 = Mathf.Sin(num); return new Vector2(forBody.x * num2 + forBody.y * num3, (0f - forBody.x) * num3 + forBody.y * num2); } catch (Exception) { return forBody; } } public void SetMode(Mode next) { //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) if (WeaponInHand && next != Mode.Clone && next != Mode.Copy && next != Mode.Replay) { Stow(); } StopPlaying(); if (mode == Mode.Clone && next != Mode.Clone) { LeaveClone(); } MotionLibrary.Refresh(); if (mode == Mode.Brain && next != Mode.Brain) { SwitchGoal(Goal.Idle); } HideThought(); mode = next; walk = Vector2.zero; primaryClick = (secondaryClick = (running = false)); jump = (otherA = false); crouching = false; jumpDue = -1f; nav.Clear(); following = false; idleUntil = 0f; if (next == Mode.Copy) { jumpAsked = Recorder.PlayerJumpedAt; } if (next == Mode.Replay && !StartReplay()) { mode = Mode.Stand; } } private bool StartReplay() { if (previewClip != null) { replay = new List<Frame>(previewClip); previewClip = null; replayAt = 0; lastJumpFrame = -1; replayStart = Time.time; replayYaw = bodyYaw - replay[0].yaw; return true; } string text = Recorder.Latest(); if (text == null) { Spawnables.Notify("Nothing recorded yet (turn on Record my play)"); return false; } try { replay = Recorder.Load(text); } catch (Exception ex) { Spawnables.Notify("That recording could not be read: " + ex.Message); return false; } if (replay.Count < 2) { Spawnables.Notify("That recording is too short"); return false; } replayAt = 0; lastJumpFrame = -1; replayStart = Time.time; replayYaw = bodyYaw - replay[0].yaw; Spawnables.Notify("Replaying " + replay[replay.Count - 1].time.ToString("0") + " seconds of you"); return true; } public void Update(float dt) { //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) if (Dead()) { return; } StayWhole(); if (!Whole) { return; } KeepAwake(); StowFollow(); try { if (mode != Mode.Clone && (Object)(object)rig.activeSeat != (Object)null && Time.time - seatOutAt > 1.5f) { seatOutAt = Time.time; rig.activeSeat.EgressRig(false); } } catch (Exception) { } OnItsFeet(); TheirWayStep(); Flesh(); Mend(dt); if (DownStep(dt)) { return; } HurtPlayer(); if (!heard && Time.time - born > 2f) { heard = true; BotRig.HearLate(rig); } Transform head = Head; Transform head2 = Player.Head; float t = Time.time - born; if (spawningGun && Time.time - spawnAskedAt > 0.2f && !TakeSpawnedGun() && Time.time - spawnAskedAt > 4f) { spawningGun = false; tossNext = false; } jump = (otherA = false); pressA = (pressB = (pressMenu = (pressClick = false))); primaryClick = (secondaryClick = false); crouching = false; NoteJumping(); TrackThrow(); MeasureFreeHands(); bool flag = mode == Mode.Stand || mode == Mode.Follow || mode == Mode.Wander || mode == Mode.Gunplay || mode == Mode.Brain || mode == Mode.Fists; if (flag) { Notice(head2, head); Aware(head2, head); HearNews(); } bool flag2 = climbing && climbHang; if (flag2) { ClimbStep(dt); } switch (flag2 ? ((Mode)(-1)) : mode) { case Mode.Stand: Watch(head2, head, dt, (Time.time < waveUntil) ? 200f : 60f); walk = Vector2.zero; if (Playing) { PlayStep(head2, head, dt); } break; case Mode.Follow: Follow(head2, head, dt); break; case Mode.Wander: Wander(head2, head, dt); break; case Mode.Gunplay: Gunplay(head2, head, dt); break; case Mode.Clone: CloneUpdate(dt); break; case Mode.Fists: FistsOnly(head2, head, dt); break; case Mode.Brain: BrainStep(head2, head, dt); break; case Mode.Copy: { Watch(head2, head, dt, 150f); if (Recorder.Capture(out var frame)) { pose = frame; Body(frame); } if (Recorder.PlayerJumpedAt > jumpAsked) { jumpAsked = Recorder.PlayerJumpedAt; AskJump(); } walk = Vector2.zero; curl = -1f; break; } case Mode.Replay: Replay(); break; } if (!flag2 && (mode == Mode.Follow || mode == Mode.Wander)) { AsideForYou(dt); } if (!flag) { return; } curl = 0.25f; float magnitude = ((Vector2)(ref walk)).magnitude; stride += dt * (2f + 5f * magnitude); bool flag3 = magnitude > 0.05f; primaryClick = SprintClick(); Frame frame2 = Standing(t, flag3 ? 8f : LookPitch(head2, head), flag3 ? 0f : headYaw, flag3 ? magnitude : 0f); MotionLibrary.Gait want = (flag3 ? ((!running) ? MotionLibrary.Gait.Walk : MotionLibrary.Gait.Run) : MotionLibrary.Gait.Idle); if (Moves(want, dt, out var f)) { if (!flag3) { f.head = Quaternion.Euler(LookPitch(head2, head), headYaw, 0f) * Quaternion.Slerp(Quaternion.identity, f.head, 0.35f); } frame2 = f; } pose = frame2; CrouchOfTheirs(); JumpOfTheirs(); OverHands(); Wave(t); Fidget(head2, flag3, dt); Gaze(head2, flag3, dt); React(dt); ClimbPose(); Smooth(dt); if (!MaybePurpose(head)) { MaybeLesson(); } } private bool SprintClick() { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Invalid comparison between Unknown and I4 //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Invalid comparison between Unknown and I4 //IL_037a: Unknown result type (might be due to invalid IL or missing references) RemapRig remapHeptaRig = rig.remapHeptaRig; Vector2 currentVelocity; if ((Object)(object)remapHeptaRig != (Object)null) { if (walkMost <= 0f) { for (walkMost = remapHeptaRig.maxVelocity; walkMost > Tuning.F("walk.most", 2.6f); walkMost /= Tuning.F("sprint.times", 2.1f)) { } } float num = walkMost * Tuning.F("sprint.times", 2.1f); if (!running) { gameSprints = false; } else { currentVelocity = remapHeptaRig._currentVelocity; if (((Vector2)(ref currentVelocity)).magnitude > num * 1.12f) { gameSprints = true; } } float num2 = ((running && !gameSprints) ? num : walkMost); remapHeptaRig.maxVelocity = Mathf.MoveTowards(remapHeptaRig.maxVelocity, num2, Time.deltaTime * (gameSprints ? 30f : 6f)); } Vector3 val2; try { Rigidbody val = Pelvis(); if ((Object)(object)remapHeptaRig != (Object)null && (int)remapHeptaRig.travState == 2) { if (!running || (Object)(object)val == (Object)null) { goto IL_014e; } val2 = Flat(val.velocity); if (((Vector3)(ref val2)).magnitude < Tuning.F("sprint.gait", 2.6f) - 0.6f) { goto IL_014e; } } goto end_IL_00f6; IL_014e: remapHeptaRig.travState = (TraversalState)0; end_IL_00f6:; } catch (Exception) { } if (!running || ((Vector2)(ref stick)).magnitude < 0.85f || stick.y < 0.6f) { return false; } Rigidbody val3 = Pelvis(); float num3; if (!((Object)(object)val3 != (Object)null)) { num3 = 0f; } else { val2 = Flat(val3.velocity); num3 = ((Vector3)(ref val2)).magnitude; } float num4 = num3; if (num4 < Tuning.F("sprint.speed", 2.9f) && Time.time - sprintClickAt > Tuning.F("sprint.again", 0.7f)) { sprintClickAt = Time.time; } if (Time.time - sprintSaidAt > 3f) { sprintSaidAt = Time.time; RemapRig remapHeptaRig2 = rig.remapHeptaRig; string[] obj = new string[10] { "run: going ", num4.ToString("0.0"), " m/s, stick ", ((Vector2)(ref stick)).magnitude.ToString("0.00"), " (", stick.x.ToString("0.0"), ", ", stick.y.ToString("0.0"), ")", null }; object obj2; if (!((Object)(object)remapHeptaRig2 != (Object)null)) { obj2 = ""; } else { string[] obj3 = new string[8] { ", ", ((object)remapHeptaRig2.travState/*cast due to .constrained prefix*/).ToString(), ", most ", remapHeptaRig2.currentMaxVelocity.ToString("0.0"), " of ", remapHeptaRig2.maxVelocity.ToString("0.0"), ", its own ", null }; currentVelocity = remapHeptaRig2._currentVelocity; obj3[7] = ((Vector2)(ref currentVelocity)).magnitude.ToString("0.0"); obj2 = string.Concat(obj3); } obj[9] = (string)obj2; Lab.Event(string.Concat(obj)); } try { if ((num4 > Tuning.F("sprint.gait", 2.6f) && (Object)(object)remapHeptaRig != (Object)null && (int)remapHeptaRig.travState == 0) || ((Object)(object)remapHeptaRig != (Object)null && (int)remapHeptaRig.travState == 1 && num4 > Tuning.F("sprint.gait", 2.6f))) { remapHeptaRig.travState = (TraversalState)2; } } catch (Exception) { } return Time.time - sprintClickAt < 0.15f; } public static string LegsOf(RigManager who) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) try { RemapRig val = (((Object)(object)who != (Object)null) ? who.remapHeptaRig : null); if ((Object)(object)val == (Object)null) { return "none"; } OpenControllerRig val2 = ((Il2CppObjectBase)who.ControllerRig).TryCast<OpenControllerRig>(); return ((object)val.travState/*cast due to .constrained prefix*/).ToString() + ", top speed " + val.maxVelocity.ToString("0.00") + " (now " + val.currentMaxVelocity.ToString("0.00") + "), accel " + val.maxAcceleration.ToString("0.0") + ", jump " + val.jumpVelocity.ToString("0.00") + ", jumping " + val._jumping + ", crouch " + val._crouchTarget.ToString("0.00") + ", feet " + val._feetOffset.ToString("0.00") + ", in weight " + val.inWeight.ToString("0.00") + ", enabled " + ((Behaviour)val).enabled + ", ball loco " + ((Object)(object)who.physicsRig != (Object)null && who.physicsRig.ballLocoEnabled) + (((Object)(object)val2 != (Object)null) ? (", A " + ((ControllerRig)val2)._primaryAButton + "/" + ((ControllerRig)val2)._secondaryAButton + ", stick click " + ((ControllerRig)val2)._primaryStick + "/" + ((ControllerRig)val2)._secondaryStick) : "") + BodiesOf(who); } catch (Exception ex) { return "failed: " + ex.Message; } } private static string BodiesOf(RigManager who) { try { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; string text = ""; foreach (Rigidbody componentsInChild in ((Component)who.physicsRig).GetComponentsInChildren<Rigidbody>(true)) { num++; bool isKinematic = componentsInChild.isKinematic; bool flag = !((Component)componentsInChild).gameObject.activeInHierarchy; if (isKinematic) { num2++; } if (flag) { num4++; } if (!isKinematic && !flag && componentsInChild.IsSleeping()) { num3++; } if ((isKinematic || flag) && text.Length < 160) { text = text + " " + ((Object)componentsInChild).name + (flag ? "(off)" : ""); } foreach (Joint component in ((Component)componentsInChild).GetComponents<Joint>()) { if ((Object)(object)component.connectedBody == (Object)null || (Object)(object)((Component)component.connectedBody).GetComponentInParent<RigManager>() != (Object)(object)who) { num5++; if (text.Length < 220) { text = text + " " + ((Object)componentsInChild).name + "->" + (((Object)(object)component.connectedBody != (Object)null) ? ((Object)component.connectedBody).name : "world"); } } } } return ", seat " + (((Object)(object)who.activeSeat != (Object)null) ? ((Object)who.activeSeat).name : "none") + ", bodies " + num + " (" + num2 + " held still, " + num3 + " asleep, " + num4 + " off, " + num5 + " tied to something else:" + text + "), physics rig on " + (((Behaviour)who.physicsRig).enabled && ((Component)who.physicsRig).gameObject.activeInHierarchy) + PartsOf(who); } catch (Exception ex) { return ", bodies failed: " + ex.Message; } } private void OnItsFeet() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 try { if ((Object)(object)rig.activeSeat != (Object)null || (int)rig.bodyState != 1 || InLesson) { seatedLooseSince = -1f; seatedTries = 0; return; } if (seatedLooseSince < 0f) { seatedLooseSince = Time.time; } if (Time.time - seatedLooseSince < ((seatedTries == 0) ? 2.5f : 0.8f)) { return; } seatedLooseSince = Time.time; seatedTries++; string text; if (seatedTries == 1) { rig.SwitchBodyState((BodyState)0); text = "asked for"; } else if (seatedTries == 2) { rig.bodyState = (BodyState)0; text = "set"; } else { ((Rig)rig.physicsRig).SetBodyState((BodyState)0, (BodyState)1); rig._bodyState = (BodyState)0; rig._bodyStateOnDeck = (BodyState)0; rig._bodyStateDirty = false; if (!rig.physicsRig.ballLocoEnabled) { rig.physicsRig.EnableBallLoco(); } text = "forced"; } if (seatedTries <= 4 || seatedTries % 20 == 0) { Lab.Event("seat: its body was still a sat one with no seat under it, back on its feet (" + text + ", try " + seatedTries + ")"); } } catch (Exception ex) { if (seatedTries <= 4) { Lab.Event("seat: could not put it back on its feet: " + ex.Message); } } } private static string PartsOf(RigManager who) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) try { PhysicsRig physicsRig = who.physicsRig; Vector3 position = ((Component)who).transform.position; string text = ", rig root " + ((Vector3)(ref position)).ToString("0.00"); Rigidbody val = (((Object)(object)((Rig)physicsRig).m_pelvis != (Object)null) ? ((Component)((Rig)physicsRig).m_pelvis).GetComponent<Rigidbody>() : null); Vector3 val2; if ((Object)(object)val != (Object)null) { string[] obj = new string[9] { text, ", hips at ", null, null, null, null, null, null, null }; val2 = val.position; obj[2] = ((Vector3)(ref val2)).ToString("0.00"); obj[3] = " going "; val2 = val.velocity; obj[4] = ((Vector3)(ref val2)).ToString("0.00"); obj[5] = " drag "; obj[6] = val.drag.ToString("0.0"); obj[7] = " constraints "; obj[8] = ((object)val.constraints/*cast due to .constrained prefix*/).ToString(); text = string.Concat(obj); } foreach (Rigidbody componentsInChild in ((Component)physicsRig).GetComponentsInChildren<Rigidbody>(true)) { string text2 = ((Object)componentsInChild).name.ToLowerInvariant(); if (!componentsInChild.isKinematic && (text2.Contains("knee") || text2.Contains("feet") || text2.Contains("foot") || text2.Contains("loco"))) { string[] obj2 = new string[12] { text, ", ", ((Object)componentsInChild).name, " y ", null, null, null, null, null, null, null, null }; val2 = componentsInChild.position; obj2[4] = val2.y.ToString("0.00"); obj2[5] = " going "; val2 = componentsInChild.velocity; obj2[6] = ((Vector3)(ref val2)).magnitude.ToString("0.00"); obj2[7] = " spin "; val2 = componentsInChild.angularVelocity; obj2[8] = ((Vector3)(ref val2)).magnitude.ToString("0.0"); obj2[9] = (componentsInChild.detectCollisions ? "" : " NO COLLISIONS"); obj2[10] = " layer "; obj2[11] = ((Component)componentsInChild).gameObject.layer.ToString(); text = string.Concat(obj2); } } foreach (Rig componentsInChild2 in ((Component)who).GetComponentsInChildren<Rig>(true)) { text = text + ", " + ((MemberInfo)((Object)componentsInChild2).GetIl2CppType()).Name + (((Behaviour)componentsInChild2).enabled ? "" : " OFF") + (((Component)componentsInChild2).gameObject.activeInHierarchy ? "" : " (object off)"); } return text + ", manager " + (((Behaviour)who).enabled ? "on" : "OFF") + ", body state " + ((object)who.bodyState/*cast due to .constrained prefix*/).ToString() + " (next " + ((object)who._bodyStateOnDeck/*cast due to .constrained prefix*/).ToString() + (who._bodyStateDirty ? ", due" : "") + ")" + (who._leashed ? ", LEASHED" : "") + ", phys input " + (((Object)(object)who.GetPhysInputRig() != (Object)null) ? ((MemberInfo)((Object)who.GetPhysInputRig()).GetIl2CppType()).Name : "none"); } catch (Exception ex) { return ", parts failed: " + ex.Message; } } public void LabSprint() { //IL_0017: 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_0024: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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) if (mode != Mode.Wander) { SetMode(Mode.Wander); } StopPlaying(); Vector3 val = Feet; if (Begin(Act.Sprint, Player.Head, val)) { Vector3 val2 = Flat(nav.Goal - val); Lab.Event("run: sent sprinting " + ((Vector3)(ref val2)).magnitude.ToString("0") + " m"); } } public void LabWave(int times) { StopPlaying(); if (mode != Mode.Stand) { SetMode(Mode.Stand); } waveStart = Time.time; waveUntil = Time.time + 0.35f + (float)times * 0.7f; waveLeft = false; WaveOfTheirs(); } private void Wave(float t) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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) if (Time.time >= waveUntil) { return; } if (waveClip != null) { OverClip(waveClip, Time.time - waveStart, 1f); return; } float num = waveUntil - Time.time; float num2 = Mathf.Clamp01(Mathf.Min((Time.time - waveStart) * 4f, num * 4f)); float num3 = Mathf.Sin(t * (float)Math.PI * 2f / 0.7f); float num4 = pose.height / 1.7f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((0.32f + num3 * 0.12f) * num4, pose.height + 0.08f * num4, 0.12f * num4); Quaternion val2 = Quaternion.Euler(-75f, 0f, num3 * 25f); if (waveLeft) { pose.leftPos = Vector3.Lerp(pose.leftPos, new Vector3(0f - val.x, val.y, val.z), Mathf.SmoothStep(0f, 1f, num2)); pose.leftRot = Quaternion.Slerp(pose.leftRot, val2, num2); } else { pose.rightPos = Vector3.Lerp(pose.rightPos, val, Mathf.SmoothStep(0f, 1f, num2)); pose.rightRot = Quaternion.Slerp(pose.rightRot, val2, num2); } curl = 0.1f; } public void LabToss(string barcode) { StopPlaying(); if (mode != Mode.Stand) { SetMode(Mode.Stand); } tossNext = true; if (!SpawnGun(barcode)) { tossNext = false; Lab.Event("could not spawn a gun to toss"); } } private bool Moves(MotionLibrary.Gait want, float dt, out Frame f) { //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) f = default(Frame); if (want != wantGait) { wantGait = want; wantSince = Time.time; } if (clip == null || (want != gait && Time.time - wantSince > 0.25f) || clipLeft <= 0f) { bool tense = (mode == Mode.Brain || mode == Mode.Fists || mode == Mode.Gunplay) && ((Object)(object)nearestSeen.transform != (Object)null || Time.time - lastEnemyTime < 8f); Frame[] array = MotionLibrary.Pick((clip == null) ? want : wantGait, lately, personality, tense, ((Vector2)(ref walk)).magnitude < 0.6f, avatarCode); if (array == null) { clip = null; return false; } if (clip != null) { fromClip = clip; fromT = clipT; fromMirror = clipMirror; fromRate = clipRate; fade = 0f; } clip = array; gait = wantGait; lately.Add(clip); while (lately.Count > Mathf.Max(1, MotionLibrary.Count(gait) * 2 / 3)) { lately.RemoveAt(0); } clipMirror = Random.value < personality.mirror; clipRate = Random.Range(0.92f, 1.08f) * personality.tempo; float time = clip[clip.Length - 1].time; float num = Mathf.Min(time, Random.Range(2.5f, 6f)); clipT = Random.Range(0f, time - num); if (MoveSlots.IsSlot(clip)) { num = time; clipT = 0f; } clipLeft = num / clipRate - 0.35f; } float num2 = MoveSlots.SpeedOf(clip); if (num2 > 0.3f && gait != MotionLibrary.Gait.Idle) { Rigidbody val = Pelvis(); float num3; if (!((Object)(object)val != (Object)null)) { num3 = num2; } else { Vector3 val2 = Flat(val.velocity); num3 = ((Vector3)(ref val2)).magnitude; } float num4 = num3; clipRate = Mathf.Lerp(clipRate, Mathf.Clamp(num4 / num2, 0.7f, 1.4f), Mathf.Clamp01(dt * 4f)); } clipT += dt * clipRate; fromT += dt * fromRate; clipLeft -= dt; f = Sample(clip, clipT, clipMirror); if (fade < 1f && fromClip != null) { fade = Mathf.Min(1f, fade + dt / 0.35f); f = Blend(Sample(fromClip, fromT, fromMirror), f, Mathf.SmoothStep(0f, 1f, fade)); } if (!MoveSlots.IsSlot(clip)) { f = MotionLibrary.Relax(f, Tuning.F("relax.arms", 0.85f)); } else { float num5 = MoveSlots.Size(clip, StandingEyes()); if (Mathf.Abs(num5 - 1f) > 0.03f) { f.height *= num5; ref Vector3 leftPos = ref f.leftPos; leftPos *= num5; ref Vector3 rightPos = ref f.rightPos; rightPos *= num5; } } return true; } private static Frame Sample(Frame[] from, float t, bool mirror) { Frame frame = MotionLibrary.Sample(from, t); if (!mirror) { return frame; } return MotionLibrary.Mirror(frame); } private void Follow(Transform you, Transform head, float dt) { //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_002a: 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_0031: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_00c8: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) headYaw = 0f; if ((Object)(object)you == (Object)null || (Object)(object)head == (Object)null) { walk = Vector2.zero; return; } Vector3 val = Feet; Vector3 val2 = you.position - Vector3.up * 1.4f; if (PortalStep(val2, afterPlayer: true, dt)) { following = true; return; } Vector3 val3 = Flat(val2 - val); float magnitude = ((Vector3)(ref val3)).magnitude; if (DriveAfterYou(you, magnitude) || ToAVehicle(you, magnitude, dt)) { return; } PhysicsRig physicsRig = rig.physicsRig; float num = (((Object)(object)physicsRig != (Object)null && (Object)(object)((Rig)physicsRig).centerOfPressure != (Object)null) ? ((Rig)physicsRig).centerOfPressure.position.y : val.y); bool flag = val2.y - num > Tuning.F("follow.above", 1f); bool flag2 = num - val2.y > Tuning.F("follow.below", 1f); if (!following && (magnitude > BotManager.FollowDistance + 0.6f || flag || flag2)) { following = true; } if (!following) { Watch(you, head, dt, 150f); walk = Vector2.zero; return; } Vector3 val4 = val2 + FollowSide(val2, val); if (nav.HasGoal) { val3 = Flat(nav.Goal - val4); if (!(((Vector3)(ref val3)).magnitude > Tuning.F("follow.regoal", 1.5f))) { goto IL_01a3; } } nav.SetGoal(val4); goto IL_01a3; IL_01a3: bool flag3 = running; bool flag4 = false; try { Rigidbody val5 = (((Object)(object)Player.PhysicsRig != (Object)null && (Object)(object)((Rig)Player.PhysicsRig).m_pelvis != (Object)null) ? ((Component)((Rig)Player.PhysicsRig).m_pelvis).GetComponent<Rigidbody>() : null); int num2; if ((Object)(object)val5 != (Object)null) { val3 = Flat(val5.velocity); num2 = ((((Vector3)(ref val3)).magnitude > Tuning.F("follow.yourun", 2.8f)) ? 1 : 0); } else { num2 = 0; } flag4 = (byte)num2 != 0; } catch (Exception) { } running = magnitude > 6f || (flag4 && magnitude > BotManager.FollowDistance + 0.8f) || (running && (magnitude > BotManager.FollowDistance + 1.5f || Time.time - runningSince < 2.5f)); if (running && !flag3) { runningSince = Time.time; } float speed = (running ? MotionLibrary.RunPush : Mathf.Clamp(MotionLibrary.WalkPush * (0.75f + (magnitude - BotManager.FollowDistance) * 0.15f), 0.3f, MotionLibrary.WalkPush)); climbKeenAt = Time.time; if (flag && !climbing && magnitude > 0.2f) { val3 = Flat(val2 - val); TryStartClimb(((Vector3)(ref val3)).normalized); } if (flag && !climbing && magnitude < 1.2f) { Watch(you, head, dt, 150f); walk = Vector2.zero; } else if (Travel(speed, (flag || flag2) ? 0.2f : BotManager.FollowDistance, dt) && !flag && !flag2) { following = false; running = false; nav.Clear(); } } private Vector3 FollowSide(Vector3 yourFeet, Vector3 feet) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0063: 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_0092: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; foreach (Bot item in BotManager.All) { if (!item.dead && item.enemy == enemy && item.mode == Mode.Follow) { if (item == this) { num = num2; } num2++; } } if (num2 < 2) { return Vector3.zero; } Vector3 val = Flat(yourFeet - feet); if (((Vector3)(ref val)).sqrMagnitude < 4f) { return followSideWas; } Vector3 val2 = Vector3.Cross(Vector3.up, ((Vector3)(ref val)).normalized); float num3 = ((num % 2 == 0) ? (-1f) : 1f) * (0.9f + 0.9f * (float)(num / 2)); followSideWas = Vector3.Lerp(followSideWas, val2 * num3 * Tuning.F("follow.side", 1f), 0.05f); return followSideWas; } private void Gunplay(Transform you, Transform head, float dt) { //IL_00c8: 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) running = false; if (Assisting && !Playing) { FistsOnly(you, head, dt); if ((Object)(object)nearestSeen.transform != (Object)null) { assistSawAt = Time.time; } else if (Time.time - assistSawAt > 2.5f && Time.time - assistBegan > 2.5f) { assistUntil = 0f; } if ((Object)(object)nearestSeen.transform != (Object)null && nearestSeenDistance < 3f) { assistUntil = Mathf.Max(assistUntil, Time.time + 3f); } return; } if (Playing) { PlayStep(you, head, dt); return; } walk = Vector2.zero; if (Time.time < idleUntil) { Watch(you, head, dt, 90f); } else if (!GetAGun()) { if (!BotManager.OwnSpawns && Time.time - noGunSaidAt > 60f) { noGunSaidAt = Time.time; Spawnables.Notify("No gun near the bot (turn on Spawn guns for bots)"); } idleUntil = Time.time + 3f; } } private void Wander(Transform you, Transform head, float dt) { Life(you, head, dt); } private bool Travel(float speed, float arrive, float dt) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_0074: 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_00a4: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) if (climbing) { ClimbStep(dt); return false; } Vector3 val = Feet; if (nav.Remaining(val) < arrive) { walk = Vector2.zero; travelEnded = "there (" + nav.Remaining(val).ToString("0.0") + " m left)"; return true; } Transform head = Head; Vector3 chest = (((Object)(object)head != (Object)null) ? (head.position - Vector3.up * 0.45f) : (val + Vector3.up * 1.2f)); float rise; bool drop; Vector3 val2 = nav.Steer(val, chest, Quaternion.Euler(0f, bodyYaw, 0f) * Vector3.forward, out rise, out drop); if (drop && val2 != Vector3.zero && nav.HasGoal && nav.Goal.y < val.y - 0.5f && nav.DropDepth <= Tuning.F("drop.max", 5f)) { if (Time.time - dropSaidAt > 3f) { dropSaidAt = Time.time; Lab.Event("drop: down a " + nav.DropDepth.ToString("0.0") + " m edge"); } Go(val2, speed, dt); return false; } if (val2 == Vector3.zero || drop) { walk = Vector2.zero; travelEnded = (drop ? ("an edge ahead, " + nav.DropDepth.ToString("0.0") + " m down") : "no way to turn") + (nav.OnMesh ? ", on the level's ways" : ", by feel") + ", feet at " + val.y.ToString("0.00"); return true; } if (TryStartClimb(val2)) { return false; } Go(val2, speed, dt); if (rise > 0.4f && rise < 1.3f && Time.time - ledgeJumpAt > 1.5f) { ledgeJumpAt = Time.time; AskJump(); } if (nav.CheckStuck(val, ((Vector2)(ref walk)).magnitude, dt)) { AskJump(); if (nav.StuckCount == 2) { SelfTaught.Bad(nav.HasGoal ? nav.Goal : val); } } return false; } private void Go(Vector3 dir, float speed, float dt) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a0: 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_00b1: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) Vector3 val = dir; if (Time.time - goAt < 0.2f) { goByOthers += Mathf.Abs(Mathf.DeltaAngle(goYawWas, bodyYaw)); goByWay += ((((Vector3)(ref goDirWas)).sqrMagnitude > 0.01f) ? Vector3.Angle(goDirWas, val) : 0f); } else { goByOthers = (goByWay = (goByApart = 0f)); goSaidAt = Time.time; } goDirWas = val; dir = KeepApart(dir, ref speed); goByApart += Vector3.Angle(val, dir) * dt * 5f; if (Time.time - goSaidAt > 3f) { if (goByOthers > 120f || goByWay > 240f || goByApart > 60f) { Lab.Event("walk: in 3 s its body was turned " + goByOthers.ToString("0") + " deg by something other than its walking, its way swung " + goByWay.ToString("0") + " deg in all, kept off others by " + goByApart.ToString("0") + "; " + act.ToString() + "/" + play.ToString() + ((Time.time < gazeUntil) ? ", looking at something" : "") + (thinking2 ? ", thinking" : "")); } goByOthers = (goByWay = (goByApart = 0f)); goSaidAt = Time.time; } steer = ((((Vector3)(ref steer)).sqrMagnitude < 0.01f) ? dir : Vector3.Slerp(steer, dir, 1f - Mathf.Exp((0f - dt) * Tuning.F("move.curve", 2.6f)))); Vector3 val2 = Flat(steer); Vector3 val3; if (!(((Vector3)(ref val2)).sqrMagnitude > 0.001f)) { val3 = dir; } else { val2 = Flat(steer); val3 = ((Vector3)(ref val2)).normalized; } dir = val3; float num = Recorder.Yaw(dir); float num2 = Mathf.Lerp(Tuning.F("move.turn.slow", 200f), Tuning.F("move.turn.fast", 110f), Mathf.Clamp01(((Vector2)(ref stick)).magnitude)); bodyYaw = Mathf.MoveTowardsAngle(bodyYaw, num, num2 * dt); float num3 = Mathf.Abs(Mathf.DeltaAngle(bodyYaw, num)); Vector3 val4 = Quaternion.Euler(0f, 0f - bodyYaw, 0f) * dir; walk = new Vector2(val4.x, val4.z) * (speed * Mathf.Clamp01(1.3f - num3 / 90f)); goYawWas = bodyYaw; goAt = Time.time; } public void PickSomethingUp() { SetMode(Mode.Wander); if (!FindSomethingToPlayWith()) { Spawnables.Notify("Nothing it can pick up nearby"); } } public void BringTo(Vector3 feet, Vector3 forward) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) try { bodyYaw = Recorder.Yaw(forward); StopPlaying(); nav.Clear(); droveHas = false; droveHeadHas = false; portalHeadHas = false; portalGoing = false; SmoothReset(); rig.Teleport(feet, true); } catch (Exception ex) { Spawnables.Notify("The bot could not be brought over: " + ex.Message); } } private float Watch(Transform you, Transform head, float dt, float speed) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)you == (Object)null || (Object)(object)head == (Object)null) { return 0f; } Vector3 forward = Flat(you.position - head.position); if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { return 0f; } float num = Recorder.Yaw(forward); if (Mathf.Abs(Mathf.DeltaAngle(bodyYaw, num)) > 15f || mode != Mode.Stand) { bodyYaw = Mathf.MoveTowardsAngle(bodyYaw, num, speed * dt); } return Mathf.DeltaAngle(bodyYaw, num); } private float LookPitch(Transform you, Transform head) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) if ((Object)(object)you == (Object)null || (Object)(object)head == (Object)null) { return 0f; } Vector3 val = you.position - head.position; Vector3 val2 = Flat(val); float magnitude = ((Vector3)(ref val2)).magnitude; return Mathf.Clamp((0f - Mathf.Atan2(val.y, Mathf.Max(magnitude, 0.1f))) * 57.29578f, -40f, 40f); } private Frame Standing(float t, float pitch, float lookYaw, float swing) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sin(t * 1.7f); float num2 = Mathf.Sin(t * 0.6f); float num3 = Mathf.Sin(stride) * 0.13f * swing; float num4 = Mathf.Abs(Mathf.Cos(stride)) * 0.02f * swing; float num5 = standingHeight + num * 0.004f; return new Frame { height = num5, head = Quaternion.Euler(pitch, lookYaw + num2 * 4f, 0f), leftPos = new Vector3(-0.2f, num5 - 0.78f + num * 0.006f + num4, 0.06f + num2 * 0.01f + num3), rightPos = new Vector3(0.2f, num5 - 0.78f + num * 0.006f + num4, 0.06f - num2 * 0.01f - num3), leftRot = Quaternion.Euler(65f, 10f, 0f), rightRot = Quaternion.Euler(65f, -10f, 0f) }; } private void Replay() { //IL_0137: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) float num = Time.time - replayStart; while (replayAt < replay.Count - 1 && replay[replayAt + 1].time <= num) { replayAt++; if (replay[replayAt].jumped && replayAt != lastJumpFrame) { lastJumpFrame = replayAt; AskJump(); } } if (replayAt >= replay.Count - 1) { if (previewing) { previewing = false; crouchReset = true; SetMode(previewBack); } else { Spawnables.Notify("Replay finished"); SetMode(Mode.Stand); } } else { Frame frame = replay[replayAt]; Frame b = replay[replayAt + 1]; float num2 = Mathf.InverseLerp(frame.time, b.time, num); pose = Blend(frame, b, num2); bodyYaw = replayYaw + Mathf.LerpAngle(frame.yaw, b.yaw, num2); walk = Vector2.Lerp(frame.stick, b.stick, num2); Body(frame); crouch = Mathf.Lerp(frame.crouch, b.crouch, num2); feet = Mathf.Lerp(frame.feet, b.feet, num2); curl = -1f; } } private void Body(Frame f) { jump = f.jump; otherA = f.otherA; primaryClick = f.primaryStick; secondaryClick = f.secondaryStick; crouching = true; crouch = f.crouch; feet = f.feet; } private void NoteJumping() { //IL_00a8: 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) RemapRig remapHeptaRig = rig.remapHeptaRig; bool flag = (Object)(object)remapHeptaRig != (Object)null && remapHeptaRig._jumping; if (flag && !wasJumping) { jumpedAt = Time.time; jumpClip = MoveSlots.Pick(MoveSlots.Kind.Jump, null, avatarCode); } wasJumping = flag; try { if (flag && (Object)(object)remapHeptaRig != (Object)null && Time.time - jumpedAt > Tuning.F("jump.longest", 1.6f) && !climbing && !InLesson) { Rigidbody val = Pelvis(); if ((Object)(object)val != (Object)null && Mathf.Abs(val.velocity.y) < 0.6f && (Object)(object)((Rig)rig.physicsRig).centerOfPressure != (Object)null && FeetOnGround()) { remapHeptaRig._jumping = false; remapHeptaRig._jumpCycle = 0f; remapHeptaRig._timeOfFlight = 0f; if ((int)remapHeptaRig.travState != 0) { remapHeptaRig.travState = (TraversalState)0; } wasJumping = false; jumpsCleared++; if (Time.time - jumpClearSaidAt > 5f) { jumpClearSaidAt = Time.time; Lab.Event("legs: a jump that never ended (" + (Time.time - jumpedAt).ToString("0.0") + " s, feet on the ground): ended, " + jumpsCleared + " so far"); } } } } catch (Exception) { } if (jumpDue > 0f && Time.time >= jumpDue) { jumpDue = -1f; if (Time.time - jumpedAt > 0.3f && (Object)(object)remapHeptaRig != (Object)null && !remapHeptaRig._jumping) { remapHeptaRig.Jump(); } } } private void AskJump() { Call("effort"); if (jumpDue < 0f) { jumpDue = Time.time + 0.12f; } } internal static Frame Blend(Frame a, Frame b, float k) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0050: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0082: 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) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) Frame result = a; result.height = Mathf.Lerp(a.height, b.height, k); result.head = Quaternion.Slerp(a.head, b.head, k); result.leftPos = Vector3.Lerp(a.leftPos, b.leftPos, k); result.rightPos = Vector3.Lerp(a.rightPos, b.rightPos, k); result.leftRot = Quaternion.Slerp(a.leftRot, b.leftRot, k); result.rightRot = Quaternion.Slerp(a.rightRot, b.rightRot, k); result.leftGrip = Mathf.Lerp(a.leftGrip, b.leftGrip, k); result.rightGrip = Mathf.Lerp(a.rightGrip, b.rightGrip, k); return result; } public void Drive() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_018a: Unknown result type (might be due to inva