Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Pedal Bike v0.1.7
BepInEx/plugins/PedalBike/PedalBike.dll
Decompiled 8 hours 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyInformationalVersion("0.1.7")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.1.7.0")] namespace PedalBike; [BepInPlugin("arioh.valheim.pedalbike", "Pedal Bike", "0.1.7")] [BepInDependency("com.jotunn.jotunn", "2.30.2")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class BikePlugin : BaseUnityPlugin { public const string Id = "arioh.valheim.pedalbike"; public const string Version = "0.1.7"; public const string PrefabName = "Arioh_PedalBike"; internal static BikePlugin Instance; internal ConfigEntry<float> CruiseSpeed; internal ConfigEntry<float> SprintSpeed; internal ConfigEntry<float> PedalCost; internal ConfigEntry<float> SprintCost; private Harmony harmony; private bool registered; internal static bool Headless => (int)SystemInfo.graphicsDeviceType == 4; private void Awake() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown Instance = this; CruiseSpeed = Setting("CruiseSpeedKmh", 37f, 4f, 37f, "Normal forward pedal speed target in km/h. Standard 37; handling losses are at most 2 km/h."); SprintSpeed = Setting("SprintSpeedKmh", 42f, 6f, 42f, "Shift pedal speed target in km/h. Standard and ground ceiling 42; handling losses are at most 2 km/h."); ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>("Compatibility", "RideModelRevision", 0, new ConfigDescription("Internal migration marker. Revision 14 applies the requested 37/42 km/h defaults once.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); if (val.Value < 14) { CruiseSpeed.Value = 37f; SprintSpeed.Value = 42f; val.Value = 14; } PedalCost = Setting("PedalStaminaPerSecond", 3f, 0.5f, 12f, "Stamina per second for normal pedaling. Coasting and braking do not spend stamina."); SprintCost = Setting("SprintStaminaPerSecond", 7f, 1f, 25f, "Stamina per second while Shift-pedaling; never less than normal pedal cost."); CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string[,] array = new string[6, 2] { { "pb_name", "Pedal Bike" }, { "pb_desc", "A single-rider timber bicycle. W pedal; S brake/backpedal; A/D steer up to 45 degrees; Shift pedal faster using more stamina. Rear cargo: 8 slots." }, { "pb_rider", "Pedal Bike - Ride" }, { "pb_cargo", "Pedal Bike - Cargo (8 slots)" }, { "pb_sit", "Ride" }, { "pb_busy", "This bicycle or its cargo is in use." } }; for (int i = 0; i < array.GetLength(0); i++) { string text = "English"; localization.AddTranslation(ref text, ref array[i, 0], array[i, 1]); text = "Thai"; localization.AddTranslation(ref text, ref array[i, 0], array[i, 1]); } harmony = new Harmony("arioh.valheim.pedalbike"); harmony.PatchAll(typeof(BikePlugin).Assembly); PrefabManager.OnVanillaPrefabsAvailable += Register; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Pedal Bike 0.1.7 loading."); } private ConfigEntry<float> Setting(string key, float value, float min, float max, string description) { //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_002c: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown return ((BaseUnityPlugin)this).Config.Bind<float>("Pedaling", key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } internal static GameObject Native(string name) { GameObject prefab = PrefabManager.Instance.GetPrefab(name); if (!Object.op_Implicit((Object)(object)prefab)) { throw new InvalidOperationException("Native prefab missing: " + name); } return prefab; } private void Register() { //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) if (registered) { return; } PrefabManager.OnVanillaPrefabsAvailable -= Register; try { foreach (NativePart item in ModelSpec.Parts()) { if (!Object.op_Implicit((Object)(object)Native(item.Prefab).transform.Find(item.Path))) { throw new InvalidOperationException("Native model path missing: " + item.Prefab + "/" + item.Path); } } GameObject val = PrefabManager.Instance.CreateClonedPrefab("Arioh_PedalBike", Native("Cart")); if (val.activeInHierarchy) { throw new InvalidOperationException("Bike prefab must be inactive during registration."); } MonoBehaviour[] components = val.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val2 in components) { if (!(val2 is ZNetView) && !(val2 is ZSyncTransform) && !(val2 is Piece) && !(val2 is WearNTear)) { Object.DestroyImmediate((Object)(object)val2); } } Joint[] components2 = val.GetComponents<Joint>(); for (int i = 0; i < components2.Length; i++) { Object.DestroyImmediate((Object)(object)components2[i]); } LODGroup[] componentsInChildren = val.GetComponentsInChildren<LODGroup>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } for (int num = val.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val.transform.GetChild(num)).gameObject); } Collider[] components3 = val.GetComponents<Collider>(); for (int i = 0; i < components3.Length; i++) { Object.DestroyImmediate((Object)(object)components3[i]); } Rigidbody component = val.GetComponent<Rigidbody>(); component.mass = 120f; component.isKinematic = false; component.useGravity = true; component.constraints = (RigidbodyConstraints)112; component.centerOfMass = new Vector3(0f, 0.58f, -0.12f); component.linearDamping = 0.12f; component.angularDamping = 2f; component.interpolation = (RigidbodyInterpolation)1; component.collisionDetectionMode = (CollisionDetectionMode)3; ZNetView component2 = val.GetComponent<ZNetView>(); component2.m_persistent = true; component2.m_distant = true; ZSyncTransform val3 = val.GetComponent<ZSyncTransform>(); if (!Object.op_Implicit((Object)(object)val3)) { val3 = val.AddComponent<ZSyncTransform>(); } val3.m_syncPosition = true; val3.m_syncRotation = true; val3.m_syncBodyVelocity = true; Piece component3 = val.GetComponent<Piece>(); component3.m_name = "$pb_name"; component3.m_description = "$pb_desc"; component3.m_craftingStation = Native("piece_workbench").GetComponent<CraftingStation>(); component3.m_resources = (Requirement[])(object)new Requirement[2] { Cost("Wood", 20), Cost("BronzeNails", 5) }; component3.m_noInWater = false; component3.m_comfort = 0; component3.m_comfortObject = null; component3.m_canBeRemoved = true; Container obj = val.AddComponent<Container>(); Container componentInChildren = Native("Cart").GetComponentInChildren<Container>(true); if (!Object.op_Implicit((Object)(object)componentInChildren)) { throw new InvalidOperationException("Native cargo settings missing."); } obj.m_name = "$pb_cargo"; obj.m_width = 4; obj.m_height = 2; obj.m_bkg = componentInChildren.m_bkg; obj.m_openEffects = componentInChildren.m_openEffects; obj.m_closeEffects = componentInChildren.m_closeEffects; obj.m_defaultItems = componentInChildren.m_defaultItems; obj.m_destroyedLootPrefab = componentInChildren.m_destroyedLootPrefab; obj.m_wagon = null; obj.m_rootObjectOverride = null; obj.m_open = (obj.m_closed = null); obj.m_checkGuardStone = true; obj.m_privacy = (PrivacySetting)2; obj.m_autoDestroyEmpty = false; BikeController controller = val.AddComponent<BikeController>(); GameObject val4 = BikeModel.Build(val, controller); WearNTear component4 = val.GetComponent<WearNTear>(); component4.m_new = (component4.m_worn = (component4.m_broken = val4)); component4.m_wet = null; component4.m_snow = (component4.m_snowWorn = (component4.m_snowBroken = null)); component4.m_noSupportWear = false; component4.m_noRoofWear = false; component4.m_supports = false; component4.m_staticPosition = false; component4.m_snowDamageImmune = true; component4.m_ashDamageImmune = true; component4.m_burnable = false; component4.m_health = 600f; component4.m_fragmentRoots = (GameObject[])(object)new GameObject[1] { val4 }; component4.m_nonSolidRenderers = new List<Renderer>(); if (!Headless) { try { Sprite val5 = RenderManager.Instance.Render(val4, RenderManager.IsometricRotation); if (Object.op_Implicit((Object)(object)val5)) { component3.m_icon = val5; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Bike icon render: " + ex.Message)); } } PieceManager instance = PieceManager.Instance; CustomPiece val6 = new CustomPiece(val, "Hammer", false); val6.Usage = new string[1] { "Crafting" }; if (!instance.AddPiece(val6)) { throw new InvalidOperationException("Could not register bicycle."); } registered = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Pedal Bike ready: single rider, Wood20/BronzeNails5, 8 cargo slots, 45-degree front steering, stamina pedal drive."); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("Pedal Bike registration failed: " + ex2)); } } private static Requirement Cost(string item, int count) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0025: Expected O, but got Unknown return new Requirement { m_resItem = Native(item).GetComponent<ItemDrop>(), m_amount = count, m_recover = true }; } internal static void LogRide(string message) { if (Object.op_Implicit((Object)(object)Instance)) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)message); } } internal static void Error(string text, Exception error) { if (Object.op_Implicit((Object)(object)Instance)) { ((BaseUnityPlugin)Instance).Logger.LogError((object)(text + ": " + error)); } } private void OnDestroy() { BikeCamera.Release(); PrefabManager.OnVanillaPrefabsAvailable -= Register; if (harmony != null) { harmony.UnpatchSelf(); } Instance = null; } } [HarmonyPatch(typeof(Player), "SetControls")] internal static class RidingControls { private static void Prefix(Player __instance, ref Vector3 movedir, ref bool attack, ref bool attackHold, ref bool secondaryAttack, ref bool secondaryAttackHold, ref bool block, ref bool blockHold, ref bool jump, ref bool crouch, ref bool run, ref bool autoRun, ref bool dodge) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (__instance.GetDoodadController() is BikeSeat) { movedir = Vector3.zero; attack = (attackHold = (secondaryAttack = (secondaryAttackHold = (block = (blockHold = (jump = (crouch = (run = (autoRun = (dodge = false)))))))))); } } } [HarmonyPatch(typeof(WearNTear), "CanBeRemoved")] internal static class RiderRemoval { private static void Postfix(WearNTear __instance, ref bool __result) { BikeController component = ((Component)__instance).GetComponent<BikeController>(); if (Object.op_Implicit((Object)(object)component) && component.Occupied) { __result = false; } } } [HarmonyPatch(typeof(Container), "Interact")] internal static class RidingCargo { private static bool Prefix(Container __instance, ref bool __result) { BikeController component = ((Component)__instance).GetComponent<BikeController>(); if (Object.op_Implicit((Object)(object)component) && component.Occupied) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Container), "RPC_RequestOpen")] internal static class RidingCargoRequest { private static bool Prefix(Container __instance, long __0) { BikeController component = ((Component)__instance).GetComponent<BikeController>(); if (!Object.op_Implicit((Object)(object)component) || !component.Occupied) { return true; } ZNetView component2 = ((Component)__instance).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component2) && component2.IsValid() && component2.IsOwner()) { component2.InvokeRPC(__0, "RPC_OpenResponse", new object[1] { false }); } return false; } } public sealed class BikeController : MonoBehaviour { private const string RiderKey = "pb_rider_v1"; [SerializeField] private WheelCollider front; [SerializeField] private WheelCollider rear; [SerializeField] private Transform frontVisual; [SerializeField] private Transform rearVisual; [SerializeField] private Transform steering; [SerializeField] private Transform crank; [SerializeField] private Transform leftPedal; [SerializeField] private Transform rightPedal; [SerializeField] private Transform frame; [SerializeField] private BikeSeat seat; private ZNetView view; private Rigidbody body; private Container cargo; private Collider frontGuard; private Collider rearGuard; private float idleSleepThreshold = 0.005f; private float pedalSince = -1f; private float traceAt; private bool movementLogged; private float visualBank; private Vector3 motionUp = Vector3.up; private Vector3 tracePosition; private Vector3 input; private long inputActor; private int inputSequence = -1; private float inputAt; private float leaseAt; private float publishAt; private float sweepAt; private float pendingUntil; private float steer; private float phase; private float wheelPhase; private float parkSince = -1f; private bool pending; private bool wasOwner; private bool parked; private bool tired; private float lastPhase; private float lastWheelPhase; private float receivedAt; private float receivedWheelAt; internal Transform RiderFrame { get { if (!Object.op_Implicit((Object)(object)frame)) { return ((Component)this).transform; } return frame; } } internal bool Valid { get { if (Object.op_Implicit((Object)(object)view)) { return view.IsValid(); } return false; } } internal long Rider { get { if (!Valid) { return 0L; } return view.GetZDO().GetLong("pb_rider_v1", 0L); } } internal bool Occupied => Rider != 0; internal float Speed { get { if (!Valid) { return 0f; } return view.GetZDO().GetFloat("pb_speed", 0f); } } internal bool Exhausted { get { if (Valid) { return view.GetZDO().GetBool("pb_tired", false); } return false; } } internal bool Sprinting { get { if (Valid) { return view.GetZDO().GetBool("pb_sprint", false); } return false; } } internal bool Pedaling { get { if (Valid) { return view.GetZDO().GetInt("pb_effort", 0) != 0; } return false; } } internal bool Parked { get { if (Valid) { return view.GetZDO().GetBool("pb_parked", false); } return false; } } internal float SteeringAngle { get { if (!Valid) { return 0f; } return view.GetZDO().GetFloat("pb_steer", 0f); } } internal float Hull { get { WearNTear component = ((Component)this).GetComponent<WearNTear>(); if (!Object.op_Implicit((Object)(object)component)) { return 0f; } return component.GetHealthPercentage() * 100f; } } internal void Configure(WheelCollider f, WheelCollider r, Transform fv, Transform rv, Transform turn, Transform pedals, Transform left, Transform right, BikeSeat saddle, Transform model) { front = f; rear = r; frontVisual = fv; rearVisual = rv; steering = turn; crank = pedals; leftPedal = left; rightPedal = right; seat = saddle; frame = model; } private void Awake() { view = ((Component)this).GetComponent<ZNetView>(); body = ((Component)this).GetComponent<Rigidbody>(); cargo = ((Component)this).GetComponent<Container>(); if (Object.op_Implicit((Object)(object)body)) { idleSleepThreshold = body.sleepThreshold; } Transform val = ((Component)this).transform.Find("Front tyre contact guard"); Transform val2 = ((Component)this).transform.Find("Rear tyre contact guard"); frontGuard = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<Collider>() : null); rearGuard = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponent<Collider>() : null); if (Valid) { view.Register<long>("pb_mount", (Action<long, long>)RPC_Mount); view.Register<long, bool>("pb_reply", (Action<long, long, bool>)RPC_Reply); view.Register<long>("pb_release", (Action<long, long>)RPC_Release); view.Register<long>("pb_lease", (Action<long, long>)RPC_Lease); view.Register<long, int, Vector3>("pb_input", (Action<long, long, int, Vector3>)RPC_Input); } } internal bool PreparePhysicsRole(out bool kinematic) { kinematic = true; if (!Valid || !Object.op_Implicit((Object)(object)body)) { return false; } kinematic = BikePhysics.Role(body, view.IsOwner(), Occupied, idleSleepThreshold); return true; } private void ContactGuards(bool enabled) { if (Object.op_Implicit((Object)(object)frontGuard)) { frontGuard.enabled = enabled; } if (Object.op_Implicit((Object)(object)rearGuard)) { rearGuard.enabled = enabled; } } private Player Actor(long peer, long actor) { Player player = Player.GetPlayer(actor); if (!Object.op_Implicit((Object)(object)player) || ((Character)player).GetOwner() != peer || ((Character)player).IsDead() || ((Character)player).IsTeleporting()) { return null; } return player; } private bool RiderActor(long peer, long actor, out Player p) { //IL_0029: 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) p = Actor(peer, actor); if (Object.op_Implicit((Object)(object)p)) { return BikeRules.RiderAllowed(actor, Rider, peer, ((Character)p).GetOwner(), Vector3.Distance(((Component)p).transform.position, ((Component)this).transform.position), alive: true); } return false; } internal void Request(Player p) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Valid && Object.op_Implicit((Object)(object)p) && !((Character)p).IsAttached() && !((Character)p).IsEncumbered() && PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false) && (!pending || !(Time.time < pendingUntil))) { pending = true; pendingUntil = Time.time + 5f; view.InvokeRPC("pb_mount", new object[1] { p.GetPlayerID() }); } } private void RPC_Mount(long sender, long actor) { //IL_0055: 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_007d: Unknown result type (might be due to invalid IL or missing references) if (Valid && view.IsOwner()) { Player val = Actor(sender, actor); bool flag = Object.op_Implicit((Object)(object)val) && (!Object.op_Implicit((Object)(object)cargo) || !cargo.IsInUse()) && BikeRules.MountAllowed(actor, Rider, sender, ((Character)val).GetOwner(), Vector3.Distance(((Component)val).transform.position, seat.Anchor.position), alive: true) && WardAccess.Allowed(((Component)this).transform.position, actor); if (flag) { view.GetZDO().Set("pb_rider_v1", actor); leaseAt = Time.time; } view.InvokeRPC(sender, "pb_reply", new object[2] { actor, flag }); } } private void RPC_Reply(long sender, long actor, bool allowed) { Player localPlayer = Player.m_localPlayer; if (!Valid || sender != view.GetZDO().GetOwner() || !Object.op_Implicit((Object)(object)localPlayer) || localPlayer.GetPlayerID() != actor || !pending || Time.time > pendingUntil) { return; } pending = false; if (!allowed) { ((Character)localPlayer).Message((MessageType)2, "$pb_busy", 0, (Sprite)null, false); return; } if (((Character)localPlayer).IsAttached()) { view.InvokeRPC("pb_release", new object[1] { actor }); return; } view.ClaimOwnership(); view.GetZDO().Set("pb_rider_v1", actor); leaseAt = Time.time; if (!PrepareForMount()) { view.InvokeRPC("pb_release", new object[1] { actor }); } else { seat.Begin(localPlayer); } } private bool PrepareForMount() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00d9: 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_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_00c3: Unknown result type (might be due to invalid IL or missing references) if (!Valid || !view.IsOwner() || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)front) || !Object.op_Implicit((Object)(object)rear)) { return false; } parked = false; parkSince = -1f; WheelCollider obj = front; bool enabled = (((Collider)rear).enabled = true); ((Collider)obj).enabled = enabled; ContactGuards(enabled: false); Vector3 normal; float height; bool flag2 = BikeStability.Probe(((Component)this).transform, out normal, out height); BikeStability.BeforeMount(body, flag2, normal, height); motionUp = (flag2 ? BikeStability.SafeUp(normal) : Vector3.up); visualBank = 0f; if (Object.op_Implicit((Object)(object)frame)) { frame.localRotation = Quaternion.identity; } ((Component)this).transform.SetPositionAndRotation(body.position, body.rotation); Physics.SyncTransforms(); movementLogged = false; pedalSince = -1f; traceAt = Time.time + 1.5f; steer = 0f; front.steerAngle = 0f; WheelCollider obj2 = front; float motorTorque = (rear.motorTorque = 0f); obj2.motorTorque = motorTorque; WheelCollider obj3 = front; motorTorque = (rear.brakeTorque = 0f); obj3.brakeTorque = motorTorque; input = Vector3.zero; inputAt = 0f; inputActor = 0L; inputSequence = -1; view.GetZDO().Set("pb_parked", false); view.GetZDO().Set("pb_steer", 0f); publishAt = 0f; return true; } internal void Release(Player p) { if (Valid && Object.op_Implicit((Object)(object)p)) { view.InvokeRPC("pb_release", new object[1] { p.GetPlayerID() }); } } private void RPC_Release(long sender, long actor) { //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) if (Valid && view.IsOwner() && RiderActor(sender, actor, out var _)) { view.GetZDO().Set("pb_rider_v1", 0L); input = Vector3.zero; inputAt = 0f; inputSequence = -1; inputActor = 0L; } } internal void Ping(Player p) { if (Valid) { view.InvokeRPC("pb_lease", new object[1] { p.GetPlayerID() }); } } private void RPC_Lease(long sender, long actor) { if (Valid && view.IsOwner() && RiderActor(sender, actor, out var _)) { leaseAt = Time.time; } } internal void Send(Player p, int sequence, Vector3 command) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (Valid) { view.InvokeRPC("pb_input", new object[3] { p.GetPlayerID(), sequence, command }); } } private void RPC_Input(long sender, long actor, int sequence, Vector3 command) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0062: Unknown result type (might be due to invalid IL or missing references) if (Valid && view.IsOwner() && RiderActor(sender, actor, out var _) && BikeRules.InputValid(command.x, command.y, command.z) && (actor != inputActor || sequence > inputSequence)) { inputActor = actor; inputSequence = sequence; input = command; inputAt = Time.time; leaseAt = Time.time; } } private void SetParked(bool value) { //IL_0027: 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) if (Object.op_Implicit((Object)(object)body) && value != parked) { parked = value; if (value) { body.linearVelocity = Vector3.zero; body.angularVelocity = Vector3.zero; body.constraints = (RigidbodyConstraints)126; } else { body.constraints = (RigidbodyConstraints)112; body.WakeUp(); parkSince = -1f; } } } private unsafe void FixedUpdate() { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: 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_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0338: 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_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_083b: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_083d: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07c8: Unknown result type (might be due to invalid IL or missing references) //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08b5: Unknown result type (might be due to invalid IL or missing references) //IL_08ba: Unknown result type (might be due to invalid IL or missing references) //IL_08bf: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_08d7: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Unknown result type (might be due to invalid IL or missing references) //IL_0a97: Unknown result type (might be due to invalid IL or missing references) //IL_0a99: Unknown result type (might be due to invalid IL or missing references) //IL_0ab3: Unknown result type (might be due to invalid IL or missing references) //IL_0ab5: Unknown result type (might be due to invalid IL or missing references) //IL_0b33: Unknown result type (might be due to invalid IL or missing references) //IL_0b38: Unknown result type (might be due to invalid IL or missing references) //IL_0925: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_092c: Unknown result type (might be due to invalid IL or missing references) if (!Valid || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)front) || !Object.op_Implicit((Object)(object)rear)) { return; } bool flag = view.IsOwner(); PreparePhysicsRole(out var _); ContactGuards(!Occupied); if (!flag) { if (parked) { SetParked(value: false); } WheelCollider obj = front; bool enabled = (((Collider)rear).enabled = false); ((Collider)obj).enabled = enabled; body.useGravity = false; body.isKinematic = true; wasOwner = false; return; } if (!wasOwner) { wasOwner = true; WheelCollider obj2 = front; bool enabled = (((Collider)rear).enabled = true); ((Collider)obj2).enabled = enabled; body.useGravity = true; body.isKinematic = false; parked = false; parkSince = -1f; body.constraints = (RigidbodyConstraints)112; Vector3 normal; float height; bool flag4 = BikeStability.Probe(((Component)this).transform, out normal, out height); BikeStability.Recover(body, flag4, normal, height); motionUp = (flag4 ? BikeStability.SafeUp(normal) : Vector3.up); body.WakeUp(); steer = view.GetZDO().GetFloat("pb_steer", 0f); phase = view.GetZDO().GetFloat("pb_phase", 0f); wheelPhase = view.GetZDO().GetFloat("pb_wheel_phase", 0f); inputAt = 0f; inputActor = 0L; inputSequence = -1; leaseAt = Time.time; } BikePlugin instance = BikePlugin.Instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } float fixedDeltaTime = Time.fixedDeltaTime; Player player = Player.GetPlayer(Rider); bool flag5 = Object.op_Implicit((Object)(object)player) && !((Character)player).IsDead() && !((Character)player).IsTeleporting(); bool flag6 = flag5 && BikeRules.Fresh(Time.time, inputAt); float num = (flag6 ? input.x : 0f); steer = BikeRules.Steer(steer, flag6 ? input.y : 0f, fixedDeltaTime); front.steerAngle = 0f; WheelHit val = default(WheelHit); bool groundHit = front.GetGroundHit(ref val); WheelHit val2 = default(WheelHit); bool groundHit2 = rear.GetGroundHit(ref val2); bool flag7 = groundHit || groundHit2; Vector3 normal2; float height2; bool flag8 = BikeStability.Probe(((Component)this).transform, out normal2, out height2); if (parked && flag8) { flag8 = BikeRules.HasParkingSupport(body.position.y, height2); } ? normal3; Vector3 val3; if (!flag8) { if (!(groundHit && groundHit2)) { normal3 = (groundHit ? ((WheelHit)(ref val)).normal : (groundHit2 ? ((WheelHit)(ref val2)).normal : Vector3.up)); } else { val3 = ((WheelHit)(ref val)).normal + ((WheelHit)(ref val2)).normal; normal3 = ((Vector3)(ref val3)).normalized; } } else { normal3 = normal2; } Vector3 val4 = BikeStability.SafeUp((Vector3)normal3); flag7 = flag7 || (flag8 && body.position.y - height2 <= 0.35f && body.position.y - height2 >= -0.45f); if (flag7) { BikeStability.LimitSpeed(body, val4); } Vector3 forward = BikeStability.Forward(body.rotation); float num2 = BikeDrive.SignedSpeed(body.linearVelocity, motionUp, forward); float previousNormalSpeed = Vector3.Dot(body.linearVelocity, motionUp); bool flag9 = flag6 && BikeRules.Braking(num, num2); bool flag10 = flag6 && num > 0f && input.z > 0.5f; bool flag11 = false; float num3 = 0f; if (tired && Object.op_Implicit((Object)(object)player) && ((Character)player).HaveStamina(5f)) { tired = false; } WheelCollider obj3 = front; float brakeTorque = (rear.brakeTorque = 0f); obj3.brakeTorque = brakeTorque; WheelCollider obj4 = rear; brakeTorque = (front.motorTorque = 0f); obj4.motorTorque = brakeTorque; float slopeDegrees = Vector3.Angle(val4, Vector3.up); float num6 = BikeRules.Target(num, flag10, instance.CruiseSpeed.Value, Mathf.Max(instance.CruiseSpeed.Value, instance.SprintSpeed.Value), steer, slopeDegrees); if (flag6 && !flag9 && flag7 && Mathf.Abs(num) > 0.1f && !tired) { float num7 = BikeRules.Effort(fixedDeltaTime, flag10, instance.PedalCost.Value, Mathf.Max(instance.PedalCost.Value, instance.SprintCost.Value)); if (((Character)player).HaveStamina(num7)) { ((Character)player).UseStamina(num7); flag11 = true; num3 = (float)(flag10 ? 95 : 65) * Mathf.Sign(num); } else { tired = true; } } if (parked && (flag5 || !flag8)) { SetParked(value: false); } if (!parked) { Vector3 direction = BikeStability.Apply(body, steer, num2, flag5, flag7, val4, fixedDeltaTime); if (flag7) { BikeDrive.Apply(body, direction, val4, num2, num6, flag11, flag9, !flag5 || !flag6, fixedDeltaTime, previousNormalSpeed); } } if (flag11) { if (pedalSince < 0f) { pedalSince = Time.time; traceAt = Time.time + 1.5f; tracePosition = body.position; } if (Time.time >= traceAt) { float num8 = Vector3.Distance(body.position, tracePosition); tracePosition = body.position; traceAt = Time.time + 2f; if (num8 > 0.25f) { if (!movementLogged) { movementLogged = true; BikePlugin.LogRide("Drive moved: distance=" + num8.ToString("F2") + "m speed=" + (num2 * 3.6f).ToString("F1") + "km/h owner=" + flag + " kinematic=" + body.isKinematic + " sleeping=" + body.IsSleeping()); } } else { string[] obj5 = new string[20] { "Drive stalled: moved=", num8.ToString("F3"), "m input=", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }; val3 = input; obj5[3] = ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString(); obj5[4] = " target="; obj5[5] = (num6 * 3.6f).ToString("F1"); obj5[6] = "km/h velocity="; val3 = body.linearVelocity; obj5[7] = ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString(); obj5[8] = " kinematic="; obj5[9] = body.isKinematic.ToString(); obj5[10] = " sleeping="; obj5[11] = body.IsSleeping().ToString(); obj5[12] = " constraints="; obj5[13] = ((object)body.constraints/*cast due to .constrained prefix*/).ToString(); obj5[14] = " ground="; obj5[15] = flag7.ToString(); obj5[16] = " support="; obj5[17] = flag8.ToString(); obj5[18] = " parked="; obj5[19] = parked.ToString(); BikePlugin.LogRide(string.Concat(obj5)); } } } else { pedalSince = -1f; } motionUp = (flag7 ? val4 : Vector3.up); float num9 = (flag5 ? BikeRules.Lean(num2, steer, flag7) : 0f); visualBank = Mathf.MoveTowards(visualBank, num9, 100f * fixedDeltaTime); if (!flag5) { WheelCollider obj6 = front; brakeTorque = (rear.brakeTorque = 600f); obj6.brakeTorque = brakeTorque; if (!parked) { float upDot = Vector3.Dot(body.rotation * Vector3.up, BikeStability.SafeUp(val4)); bool contact = flag7; bool support = flag8; val3 = body.linearVelocity; if (BikeRules.CanPark(contact, support, ((Vector3)(ref val3)).magnitude, upDot)) { if (parkSince < 0f) { parkSince = Time.time; } if (Time.time - parkSince > 0.3f) { body.rotation = BikeStability.Upright(body.rotation, val4); SetParked(value: true); } } else { parkSince = -1f; } } } phase = Mathf.Repeat(phase + num3 * 6f * fixedDeltaTime, 360f); wheelPhase = Mathf.Repeat(wheelPhase + num2 / 0.46f * 57.29578f * fixedDeltaTime, 360f); if (Time.time >= publishAt) { publishAt = Time.time + 0.1f; ZDO zDO = view.GetZDO(); zDO.Set("pb_speed", num2); zDO.Set("pb_steer", steer); zDO.Set("pb_phase", phase); zDO.Set("pb_wheel_phase", wheelPhase); zDO.Set("pb_rpm", num3); zDO.Set("pb_effort", flag11 ? ((num > 0f) ? 1 : (-1)) : 0); zDO.Set("pb_sprint", flag11 && flag10); zDO.Set("pb_tired", tired); zDO.Set("pb_parked", parked); zDO.Set("pb_bank_v1", visualBank); Vector3 val5 = default(Vector3); Quaternion val6 = default(Quaternion); front.GetWorldPose(ref val5, ref val6); Vector3 val7 = default(Vector3); rear.GetWorldPose(ref val7, ref val6); zDO.Set("pb_front_y", ((Component)this).transform.InverseTransformPoint(val5).y); zDO.Set("pb_rear_y", ((Component)this).transform.InverseTransformPoint(val7).y); } if (Time.time >= sweepAt) { sweepAt = Time.time + 0.5f; if (Occupied && (Time.time - leaseAt > 5f || !Object.op_Implicit((Object)(object)player) || ((Character)player).IsDead() || ((Character)player).IsTeleporting())) { view.GetZDO().Set("pb_rider_v1", 0L); input = Vector3.zero; inputAt = 0f; } if (Object.op_Implicit((Object)(object)cargo) && cargo.GetInventory() != null) { body.mass = 120f + Mathf.Clamp(cargo.GetInventory().GetTotalWeight() * 0.25f, 0f, 180f); WheelCollider obj7 = front; brakeTorque = (rear.sprungMass = body.mass * 0.5f); obj7.sprungMass = brakeTorque; } } } private void Update() { //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_022b: 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_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) if (Valid && Object.op_Implicit((Object)(object)frontVisual) && Object.op_Implicit((Object)(object)rearVisual)) { ZDO zDO = view.GetZDO(); float num = zDO.GetFloat("pb_phase", 0f); float num2 = zDO.GetFloat("pb_wheel_phase", 0f); if (num != lastPhase) { lastPhase = num; receivedAt = Time.time; } if (num2 != lastWheelPhase) { lastWheelPhase = num2; receivedWheelAt = Time.time; } float num3 = (view.IsOwner() ? phase : (num + zDO.GetFloat("pb_rpm", 0f) * 6f * Mathf.Min(0.3f, Time.time - receivedAt))); float num4 = (view.IsOwner() ? wheelPhase : (num2 + Speed / 0.46f * 57.29578f * Mathf.Min(0.3f, Time.time - receivedWheelAt))); if (Object.op_Implicit((Object)(object)frame)) { frame.localRotation = Quaternion.Euler(0f, 0f, view.IsOwner() ? visualBank : zDO.GetFloat("pb_bank_v1", 0f)); } if (view.IsOwner() && ((Collider)front).enabled) { Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); front.GetWorldPose(ref val, ref val2); frontVisual.localPosition = ((Component)this).transform.InverseTransformPoint(val); rear.GetWorldPose(ref val, ref val2); rearVisual.localPosition = ((Component)this).transform.InverseTransformPoint(val); } else { frontVisual.localPosition = new Vector3(0f, zDO.GetFloat("pb_front_y", 0.48f), 1f); rearVisual.localPosition = new Vector3(0f, zDO.GetFloat("pb_rear_y", 0.48f), -0.9f); } frontVisual.localRotation = Quaternion.Euler(num4, SteeringAngle, 0f); rearVisual.localRotation = Quaternion.Euler(num4, 0f, 0f); steering.localRotation = Quaternion.Euler(0f, SteeringAngle, 0f); crank.localRotation = Quaternion.Euler(num3, 0f, 0f); Transform obj = leftPedal; Quaternion localRotation = (rightPedal.localRotation = Quaternion.Euler(0f - num3, 0f, 0f)); obj.localRotation = localRotation; } } private void OnDestroy() { Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && localPlayer.GetDoodadController() is BikeSeat && Object.op_Implicit((Object)(object)localPlayer.GetAttachPoint()) && localPlayer.GetAttachPoint().IsChildOf(((Component)this).transform)) { localPlayer.StopDoodadControl(); ((Character)localPlayer).AttachStop(); } } } public sealed class BikeSeat : MonoBehaviour, Hoverable, Interactable, IDoodadController { [SerializeField] private Transform anchor; private BikeController vehicle; private bool exitArmed; private float inputAt; private float leaseAt; private float grace; private int sequence; internal Transform Anchor => anchor; internal BikeController Vehicle => vehicle; internal void Configure(Transform point) { anchor = point; } private void Awake() { vehicle = ((Component)this).GetComponentInParent<BikeController>(); } internal void Begin(Player p) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)vehicle)) { vehicle = ((Component)this).GetComponentInParent<BikeController>(); } exitArmed = false; grace = Time.time + 2f; Vector3 val = anchor.InverseTransformPoint(((Component)vehicle).transform.TransformPoint(new Vector3(-1f, 0.2f, -0.28f))); ((Character)p).AttachStart(anchor, ((Component)vehicle).gameObject, true, false, true, "attach_chair", val, (Transform)null); p.StartDoodadControl((IDoodadController)(object)this); ((Character)p).Message((MessageType)2, "W pedal | S brake/backpedal | A/D steer 45 deg | Shift sprint | E dismount", 0, (Sprite)null, false); } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (!hold && user is Player && Object.op_Implicit((Object)(object)vehicle)) { vehicle.Request((Player)user); } return false; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverName() { return Localization.instance.Localize("$pb_rider"); } public string GetHoverText() { return Localization.instance.Localize("$pb_rider\n[<color=yellow><b>$KEY_Use</b></color>] $pb_sit"); } public float GetHoverOffset() { return 0f; } public bool IsValid() { if (Object.op_Implicit((Object)(object)this) && Object.op_Implicit((Object)(object)vehicle)) { return vehicle.Valid; } return false; } public Component GetControlledComponent() { return (Component)(object)this; } public Vector3 GetPosition() { //IL_001f: 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 (!Object.op_Implicit((Object)(object)anchor)) { return ((Component)this).transform.position; } return anchor.position; } public void ApplyControlls(Vector3 moveDir, Vector3 lookDir, bool run, bool autoRun, bool block) { } public void OnUseStop(Player p) { BikeInput.Mark(); if (Object.op_Implicit((Object)(object)vehicle)) { vehicle.Release(p); } ((Character)p).AttachStop(); } private void Update() { //IL_0177: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || !Object.op_Implicit((Object)(object)vehicle) || !vehicle.Valid || (Object)(object)localPlayer.GetAttachPoint() != (Object)(object)anchor) { return; } BikeInput.Mark(); if (((Character)localPlayer).IsDead() || ((Character)localPlayer).IsTeleporting() || (Time.time > grace && vehicle.Rider != localPlayer.GetPlayerID())) { localPlayer.StopDoodadControl(); ((Character)localPlayer).AttachStop(); return; } if (Time.time >= leaseAt) { leaseAt = Time.time + 0.5f; vehicle.Ping(localPlayer); } bool uIBlocked = BikeInput.UIBlocked; if (!Input.GetKey((KeyCode)101)) { exitArmed = true; } if (!uIBlocked && exitArmed && Input.GetKeyDown((KeyCode)101)) { localPlayer.StopDoodadControl(); } else if (!(Time.time < inputAt)) { inputAt = Time.time + 0.1f; float num = ((!uIBlocked) ? (Input.GetKey((KeyCode)115) ? (-1) : (Input.GetKey((KeyCode)119) ? 1 : 0)) : 0); float num2 = ((!uIBlocked) ? ((Input.GetKey((KeyCode)100) ? 1 : 0) - (Input.GetKey((KeyCode)97) ? 1 : 0)) : 0); bool flag = !uIBlocked && (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)); vehicle.Send(localPlayer, ++sequence, new Vector3(num, num2, (float)(flag ? 1 : 0))); } } } public sealed class BikeCargo : MonoBehaviour, Hoverable, Interactable { private Container cargo; private BikeController vehicle; private void Awake() { cargo = ((Component)this).GetComponentInParent<Container>(); vehicle = ((Component)this).GetComponentInParent<BikeController>(); } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold || !Object.op_Implicit((Object)(object)cargo) || (Object.op_Implicit((Object)(object)vehicle) && vehicle.Occupied)) { return false; } return cargo.Interact(user, false, alt); } public bool UseItem(Humanoid user, ItemData item) { if (Object.op_Implicit((Object)(object)cargo)) { return cargo.UseItem(user, item); } return false; } public string GetHoverName() { return Localization.instance.Localize("$pb_cargo"); } public string GetHoverText() { return Localization.instance.Localize("$pb_cargo\n[<color=yellow><b>$KEY_Use</b></color>] Open"); } public float GetHoverOffset() { return 0f; } } internal static class BikeRules { internal const float SteerLimit = 45f; internal const float Wheelbase = 1.9f; internal const float Radius = 0.46f; internal const float LeanLimit = 45f; internal const float CruiseLimitKmh = 37f; internal const float SpeedLimitKmh = 42f; internal static bool Finite(float v) { if (!float.IsNaN(v)) { return !float.IsInfinity(v); } return false; } internal static bool InputValid(float drive, float steer, float sprint) { if (Finite(drive) && Finite(steer) && Finite(sprint) && Math.Abs(drive) <= 1f && Math.Abs(steer) <= 1f) { if (sprint != 0f) { return sprint == 1f; } return true; } return false; } internal static bool RiderAllowed(long actor, long rider, long sender, long actorOwner, float distance, bool alive) { if (actor != 0L && actor == rider && sender == actorOwner && alive && Finite(distance) && distance >= 0f) { return distance <= 8f; } return false; } internal static bool MountAllowed(long actor, long rider, long sender, long actorOwner, float distance, bool alive) { if (actor != 0L && (rider == 0L || rider == actor) && sender == actorOwner && alive && Finite(distance) && distance >= 0f) { return distance <= 3.5f; } return false; } internal static bool Fresh(float now, float last) { if (Finite(now) && Finite(last) && last > 0f && now >= last) { return now - last < 1f; } return false; } internal static float Clamp(float v, float min, float max) { return Math.Max(min, Math.Min(max, v)); } internal static float Steer(float value, float input, float dt) { float num = Clamp(input, -1f, 1f) * 45f; float num2 = 120f * Math.Max(0f, Math.Min(0.1f, dt)); if (!(value < num)) { return Math.Max(num, value - num2); } return Math.Min(num, value + num2); } internal static bool Braking(float input, float speed) { if (input < -0.1f) { return speed > 0.25f; } return false; } internal static float HandlingLossKmh(float steer, float slopeDegrees) { return 2f * Math.Max(Math.Abs(Clamp(steer, -45f, 45f)) / 45f, Clamp(slopeDegrees, 0f, 25f) / 25f); } internal static float Target(float input, bool boost, float normal, float sprint, float steer, float slopeDegrees = 0f) { if (input == 0f) { return 0f; } if (input < 0f) { return -0.8333334f; } float num = (boost ? Math.Min(42f, sprint) : Math.Min(37f, normal)); return Math.Max(0f, num - HandlingLossKmh(steer, slopeDegrees)) / 3.6f; } internal static float StepSpeed(float current, float target, bool powered, bool brake, float dt) { if (!Finite(current) || !Finite(target) || !Finite(dt) || dt <= 0f) { if (!Finite(current)) { return 0f; } return current; } float num = (brake ? 0f : target); if (!brake && !powered) { return current; } float num2 = (brake ? 6f : 4f) * Math.Min(0.05f, dt); if (!(current < num)) { return Math.Max(num, current - num2); } return Math.Min(num, current + num2); } internal static float Lean(float speed, float steering, bool grounded) { if (!grounded) { return 0f; } return 0f - Clamp((float)(Math.Atan((double)(speed * speed * (float)Math.Tan((double)steering * Math.PI / 180.0) / 1.9f) / 9.81) * 180.0 / Math.PI), -45f, 45f); } internal static float YawDelta(float speed, float steer, float dt) { if (!Finite(speed) || !Finite(steer) || !Finite(dt) || dt <= 0f) { return 0f; } return Clamp((float)((double)(Clamp(speed, -11.666667f, 11.666667f) / 1.9f) * Math.Tan((double)Clamp(steer, -45f, 45f) * Math.PI / 180.0) * 180.0 / Math.PI), -90f, 90f) * Math.Min(0.05f, dt); } internal static bool HasParkingSupport(float rootY, float highestGroundY) { if (Finite(rootY) && Finite(highestGroundY)) { return rootY - highestGroundY <= 0.2f; } return false; } internal static bool CanPark(bool contact, bool support, float totalSpeed, float upDot) { if (contact && support && Finite(totalSpeed) && totalSpeed >= 0f && totalSpeed < 0.2f && Finite(upDot)) { return upDot > 0.9998f; } return false; } internal static float Effort(float dt, bool sprint, float normalCost, float fastCost) { if (!Finite(dt) || !(dt > 0f)) { return 0f; } return Math.Min(0.05f, dt) * (sprint ? fastCost : normalCost); } internal static bool Reserved(string name) { switch (name) { default: return name == "JoyJump"; case "Use": case "JoyUse": case "AutoRun": case "JoyAutoRun": case "Run": case "JoyRun": case "Jump": return true; } } } internal static class BikeStability { internal const RigidbodyConstraints RidingConstraints = (RigidbodyConstraints)112; private static readonly RaycastHit[] Hits = (RaycastHit[])(object)new RaycastHit[32]; internal static Vector3 Forward(Quaternion rotation) { //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_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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) Vector3 val = Vector3.ProjectOnPlane(rotation * Vector3.forward, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.Cross(rotation * Vector3.right, Vector3.up); } if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { return ((Vector3)(ref val)).normalized; } return Vector3.forward; } internal static Vector3 SafeUp(Vector3 normal) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) if (!(((Vector3)(ref normal)).sqrMagnitude > 0.1f) || !(((Vector3)(ref normal)).normalized.y > 0.55f)) { return Vector3.up; } return ((Vector3)(ref normal)).normalized; } internal static Quaternion Upright(Quaternion rotation, Vector3 normal) { //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_0006: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //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_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_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = SafeUp(normal); Vector3 val2 = Vector3.ProjectOnPlane(Forward(rotation), val); return Quaternion.LookRotation(((Vector3)(ref val2)).normalized, val); } internal static bool Probe(Transform root, out Vector3 normal, out float height) { //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_0011: 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_0178: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Forward(root.rotation); Vector3 val2 = Vector3.zero; bool flag = false; height = float.NegativeInfinity; for (int i = 0; i < 2; i++) { float num = ((i == 0) ? 1f : (-0.9f)); int num2 = Physics.RaycastNonAlloc(root.position + val * num + Vector3.up * 0.65f, Vector3.down, Hits, 1.6f, -1, (QueryTriggerInteraction)1); float num3 = float.PositiveInfinity; int num4 = -1; for (int j = 0; j < num2; j++) { Collider collider = ((RaycastHit)(ref Hits[j])).collider; if (Object.op_Implicit((Object)(object)collider) && !((Component)collider).transform.IsChildOf(root) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<Character>()) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<ItemDrop>()) && !(((RaycastHit)(ref Hits[j])).normal.y <= 0.55f) && ((RaycastHit)(ref Hits[j])).distance < num3) { num3 = ((RaycastHit)(ref Hits[j])).distance; num4 = j; } } if (num4 >= 0) { flag = true; val2 += ((RaycastHit)(ref Hits[num4])).normal; height = Mathf.Max(height, ((RaycastHit)(ref Hits[num4])).point.y); } } normal = (flag ? SafeUp(val2) : Vector3.up); return flag; } internal static void Recover(Rigidbody body, bool support, Vector3 normal, float height) { //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_0010: 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_002c: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0095: Unknown result type (might be due to invalid IL or missing references) bool flag = Vector3.Dot(body.rotation * Vector3.up, SafeUp(normal)) < 0.5f; body.constraints = (RigidbodyConstraints)112; body.angularVelocity = Vector3.zero; if (support && flag) { body.linearVelocity = Vector3.zero; } body.rotation = Upright(body.rotation, support ? normal : Vector3.up); if (support) { Vector3 position = body.position; position.y += Mathf.Clamp(height + 0.12f - position.y, 0f, 0.6f); body.position = position; } } internal static void BeforeMount(Rigidbody body, bool support, Vector3 normal, float height) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) body.isKinematic = false; body.useGravity = true; Recover(body, support, normal, height); body.WakeUp(); } internal static Vector3 Apply(Rigidbody body, float steer, float speed, bool riding, bool grounded, Vector3 normal, float dt) { //IL_0009: 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_0020: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) body.constraints = (RigidbodyConstraints)112; body.angularVelocity = Vector3.zero; Vector3 val = (grounded ? SafeUp(normal) : Vector3.up); Vector3 val2 = Forward(body.rotation); val2 = Quaternion.AngleAxis((riding && grounded) ? BikeRules.YawDelta(speed, steer, dt) : 0f, Vector3.up) * val2; Vector3 val3 = Vector3.ProjectOnPlane(val2, val); Quaternion val4 = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, val); Quaternion val5 = Quaternion.RotateTowards(body.rotation, val4, 180f * Mathf.Clamp(dt, 0f, 0.05f)); body.MoveRotation(val5); val3 = Vector3.ProjectOnPlane(val5 * Vector3.forward, val); return ((Vector3)(ref val3)).normalized; } internal static void LimitSpeed(Rigidbody body, Vector3 normal) { //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_0006: 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_000d: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) Vector3 val = SafeUp(normal); Vector3 linearVelocity = body.linearVelocity; Vector3 val2 = Vector3.ProjectOnPlane(linearVelocity, val); float num = 11.666667f; if (((Vector3)(ref val2)).sqrMagnitude > num * num) { body.linearVelocity = ((Vector3)(ref val2)).normalized * num + val * Vector3.Dot(linearVelocity, val); } } } internal static class BikeDrive { internal static float SignedSpeed(Vector3 velocity, Vector3 up, Vector3 forward) { //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_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(velocity, up); return ((Vector3)(ref val)).magnitude * (float)((!(Vector3.Dot(val, forward) < 0f)) ? 1 : (-1)); } internal static void Apply(Rigidbody body, Vector3 direction, Vector3 normal, float current, float target, bool powered, bool brake, bool stop, float dt, float previousNormalSpeed) { //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_0006: 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_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) //IL_000e: 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_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = BikeStability.SafeUp(normal); Vector3 val2 = Vector3.ProjectOnPlane(direction, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = BikeRules.StepSpeed(current, target, powered, brake || stop, dt); BikePhysics.WakeDrive(body); float num2 = 11.666667f; num = Mathf.Clamp(num, 0f - num2, num2); Vector3 val3 = normalized * num + val * previousNormalSpeed; body.AddForce(val3 - body.linearVelocity, (ForceMode)2); if (powered) { body.AddForce(-Vector3.ProjectOnPlane(Physics.gravity, val), (ForceMode)5); } } } internal static class BikePhysics { internal static bool Role(Rigidbody body, bool owner, bool occupied, float idleSleepThreshold) { if (owner) { if (body.isKinematic) { body.isKinematic = false; } body.useGravity = true; body.sleepThreshold = (occupied ? 0f : idleSleepThreshold); if (occupied) { body.WakeUp(); } } else { body.useGravity = false; if (!body.isKinematic) { body.isKinematic = true; } } return body.isKinematic; } internal static void WakeDrive(Rigidbody body) { if (body.isKinematic) { body.isKinematic = false; } body.WakeUp(); } } [HarmonyPatch(typeof(ZSyncTransform), "OwnerSync")] internal static class BikeOwnerSync { private static void Prefix(ZSyncTransform __instance, ref bool ___m_isKinematicBody, ref bool ___m_useGravity) { BikeController component = ((Component)__instance).GetComponent<BikeController>(); if (Object.op_Implicit((Object)(object)component) && component.PreparePhysicsRole(out var kinematic)) { ___m_isKinematicBody = kinematic; ___m_useGravity = true; } } } [HarmonyPatch(typeof(ZSyncTransform), "ClientSync")] internal static class BikeClientSync { private static void Prefix(ZSyncTransform __instance, ref bool ___m_isKinematicBody, ref bool ___m_useGravity) { BikeController component = ((Component)__instance).GetComponent<BikeController>(); if (Object.op_Implicit((Object)(object)component) && component.PreparePhysicsRole(out var kinematic)) { ___m_isKinematicBody = kinematic; ___m_useGravity = true; } } } internal static class BikeModel { private sealed class Fit { internal GameObject Holder; internal Transform Content; internal Bounds Bounds; internal Transform SourceRoot; } private static readonly Dictionary<string, Material> Materials = new Dictionary<string, Material>(); internal static Vector3 V(P p) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(p.X, p.Y, p.Z); } private static GameObject Child(Transform parent, string name, Vector3 position) { //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_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) //IL_0030: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = position; val.layer = LayerMask.NameToLayer("piece"); return val; } private static Fit Copy(NativePart part, Transform parent) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_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_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) GameObject val = BikePlugin.Native(part.Prefab); MeshFilter[] componentsInChildren = ((Component)val.transform.Find(part.Path)).GetComponentsInChildren<MeshFilter>(true); Bounds bounds = default(Bounds); bool flag = false; MeshFilter[] array = componentsInChildren; foreach (MeshFilter val2 in array) { MeshRenderer component = ((Component)val2).GetComponent<MeshRenderer>(); if (!Object.op_Implicit((Object)(object)val2.sharedMesh) || !Object.op_Implicit((Object)(object)component)) { continue; } Matrix4x4 val3 = val.transform.worldToLocalMatrix * ((Component)val2).transform.localToWorldMatrix; Bounds bounds2 = val2.sharedMesh.bounds; for (int j = 0; j < 8; j++) { Vector3 val4 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(((Bounds)(ref bounds2)).center + Vector3.Scale(((Bounds)(ref bounds2)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1))))); if (flag) { ((Bounds)(ref bounds)).Encapsulate(val4); continue; } ((Bounds)(ref bounds))..ctor(val4, Vector3.zero); flag = true; } } if (!flag) { throw new InvalidOperationException("Native mesh missing: " + part.Prefab + "/" + part.Path); } GameObject val5 = Child(parent, part.Name, V(part.Position)); val5.transform.localRotation = Quaternion.Euler(V(part.Rotation)); GameObject val6 = Child(val5.transform, "Native visual", Vector3.zero); Vector3 val7 = default(Vector3); ((Vector3)(ref val7))..ctor(part.Size.X / Mathf.Max(0.001f, ((Bounds)(ref bounds)).size.x), part.Size.Y / Mathf.Max(0.001f, ((Bounds)(ref bounds)).size.y), part.Size.Z / Mathf.Max(0.001f, ((Bounds)(ref bounds)).size.z)); val6.transform.localScale = val7; val6.transform.localPosition = -Vector3.Scale(((Bounds)(ref bounds)).center, val7); array = componentsInChildren; foreach (MeshFilter val8 in array) { MeshRenderer component2 = ((Component)val8).GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)val8.sharedMesh)) { Matrix4x4 val9 = val.transform.worldToLocalMatrix * ((Component)val8).transform.localToWorldMatrix; GameObject obj = Child(val6.transform, ((Object)val8).name, Vector3.zero); obj.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val9)).GetColumn(3)); obj.transform.localRotation = ((Matrix4x4)(ref val9)).rotation; obj.transform.localScale = ((Matrix4x4)(ref val9)).lossyScale; obj.AddComponent<MeshFilter>().sharedMesh = val8.sharedMesh; MeshRenderer obj2 = obj.AddComponent<MeshRenderer>(); ((Renderer)obj2).sharedMaterials = Styled(((Renderer)component2).sharedMaterials, part.Tone); ((Renderer)obj2).enabled = !BikePlugin.Headless; ((Renderer)obj2).shadowCastingMode = ((Renderer)component2).shadowCastingMode; ((Renderer)obj2).receiveShadows = true; } } return new Fit { Holder = val5, Content = val6.transform, Bounds = bounds, SourceRoot = val.transform }; } private static Material[] Styled(Material[] source, string tone) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_00e6: 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_00ba: Unknown result type (might be due to invalid IL or missing references) Material[] array = (Material[])(object)new Material[source.Length]; for (int i = 0; i < source.Length; i++) { Material val = source[i]; if (!Object.op_Implicit((Object)(object)val)) { array[i] = val; continue; } string key = ((Object)val).GetInstanceID() + ":" + tone; if (!Materials.TryGetValue(key, out var value)) { value = new Material(val); ((Object)value).name = "PedalBike_" + tone + "_" + ((Object)val).name; Color val2 = (Color)(tone switch { "Timber" => new Color(0.85f, 0.65f, 0.39f), "Iron" => new Color(0.16f, 0.17f, 0.18f), "Leather" => new Color(0.37f, 0.17f, 0.075f), "Brass" => new Color(0.64f, 0.39f, 0.17f), _ => new Color(0.32f, 0.29f, 0.24f), }); if (value.HasProperty("_Color")) { value.SetColor("_Color", val2); } if (tone == "Brass" || tone == "Iron") { if (value.HasProperty("_Metallic")) { value.SetFloat("_Metallic", 0.8f); } if (value.HasProperty("_Glossiness")) { value.SetFloat("_Glossiness", 0.45f); } } Materials[key] = value; } array[i] = value; } return array; } internal static GameObject Build(GameObject root, BikeController controller) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_00a4: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_0204: 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_023d: 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_0275: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: 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_02fd: 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_0348: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) GameObject val = Child(root.transform, "PedalBikeModel", Vector3.zero); Transform transform = Child(val.transform, "FrontWheelVisual", new Vector3(0f, 0.48f, 1f)).transform; Transform transform2 = Child(val.transform, "RearWheelVisual", new Vector3(0f, 0.48f, -0.9f)).transform; Transform transform3 = Child(val.transform, "SteeringAssembly", new Vector3(0f, 0.48f, 1f)).transform; Transform transform4 = Child(val.transform, "PedalCrank", V(ModelSpec.CrankPivot)).transform; Transform transform5 = Child(transform4, "LeftPedal", new Vector3(-0.26f, 0f, 0.19f)).transform; Transform transform6 = Child(transform4, "RightPedal", new Vector3(0.26f, 0f, -0.19f)).transform; Dictionary<string, Transform> dictionary = new Dictionary<string, Transform> { { "Body", val.transform }, { "Steering", transform3 }, { "FrontWheel", transform }, { "RearWheel", transform2 }, { "Crank", transform4 }, { "LeftPedal", transform5 }, { "RightPedal", transform6 } }; foreach (NativePart item in ModelSpec.Parts()) { Fit fit = Copy(item, dictionary[item.Group]); if (item.Name == "Cargo chest body") { fit.Holder.AddComponent<BoxCollider>().size = V(item.Size); fit.Holder.AddComponent<BikeCargo>(); } } Box(val.transform, "Narrow frame collider", new Vector3(0f, 0.84f, 0f), new Vector3(0.22f, 0.45f, 1.44f)); GameObject obj = Box(val.transform, "Ride saddle", new Vector3(0f, 1.15f, -0.28f), new Vector3(0.38f, 0.12f, 0.4f)); Transform transform7 = Child(val.transform, "RiderAnchor", new Vector3(0f, 0.8f, -0.28f)).transform; BikeSeat bikeSeat = obj.AddComponent<BikeSeat>(); bikeSeat.Configure(transform7); Box(root.transform, "Front tyre contact guard", new Vector3(0f, 0.48f, 1f), new Vector3(0.12f, 0.9f, 0.22f)); Box(root.transform, "Rear tyre contact guard", new Vector3(0f, 0.48f, -0.9f), new Vector3(0.12f, 0.9f, 0.22f)); WheelCollider f = Wheel(root.transform, "Front tyre contact", new Vector3(0f, 0.48f, 1f)); WheelCollider r = Wheel(root.transform, "Rear tyre contact", new Vector3(0f, 0.48f, -0.9f)); Transform transform8 = Child(transform3, "LeftGrip", V(ModelSpec.LeftGrip)).transform; Transform transform9 = Child(transform3, "RightGrip", V(ModelSpec.RightGrip)).transform; controller.Configure(f, r, transform, transform2, transform3, transform4, transform5, transform6, bikeSeat, val.transform); root.AddComponent<BikePose>().Configure(controller, transform5, transform6, transform8, transform9); return val; } private static WheelCollider Wheel(Transform parent, string name, Vector3 position) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0066: 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_00b0: 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) WheelCollider obj = Child(parent, name, position).AddComponent<WheelCollider>(); obj.radius = 0.46f; obj.mass = 12f; obj.suspensionDistance = 0.18f; JointSpring suspensionSpring = obj.suspensionSpring; suspensionSpring.spring = 18000f; suspensionSpring.damper = 2400f; suspensionSpring.targetPosition = 0.5f; obj.suspensionSpring = suspensionSpring; WheelFrictionCurve val = obj.forwardFriction; ((WheelFrictionCurve)(ref val)).extremumSlip = 0.4f; ((WheelFrictionCurve)(ref val)).extremumValue = 1f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 0.8f; ((WheelFrictionCurve)(ref val)).asymptoteValue = 0.65f; ((WheelFrictionCurve)(ref val)).stiffness = 0f; obj.forwardFriction = val; val = obj.sidewaysFriction; ((WheelFrictionCurve)(ref val)).extremumSlip = 0.2f; ((WheelFrictionCurve)(ref val)).extremumValue = 1f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 0.5f; ((WheelFrictionCurve)(ref val)).asymptoteValue = 0.75f; ((WheelFrictionCurve)(ref val)).stiffness = 0f; obj.sidewaysFriction = val; obj.ConfigureVehicleSubsteps(5f, 8, 12); return obj; } private static GameObject Box(Transform parent, string name, Vector3 p, Vector3 size) { //IL_0002: 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) GameObject obj = Child(parent, name, p); obj.AddComponent<BoxCollider>().size = size; return obj; } } internal struct P { public float X; public float Y; public float Z; public P(float x, float y, float z) { X = x; Y = y; Z = z; } } internal sealed class NativePart { public string Name; public string Prefab; public string Path; public string Group; public string Tone; public P Position; public P Size; public P Rotation; public NativePart(string name, string prefab, string path, P position, P size, P rotation, string group = "Body") { Name = name; Prefab = prefab; Path = path; Position = position; Size = size; Rotation = rotation; Group = group; Tone = Style(name); } private static string Style(string name) { if (name.Contains("bronze")) { return "Brass"; } if (name.Contains("copper") || name.Contains("hub") || name.Contains("rivet")) { return "Brass"; } if (name.Contains("cushion") || name.Contains("leather grip")) { return "Leather"; } if (name.Contains("guard") || name.Contains("Guard") || name.Contains("shaft") || name.Contains("propeller mount") || name.Contains("stationary") || name.Contains("axle") || name.Contains("bearing")) { return "Iron"; } if (name.Contains("infill")) { return "Timber"; } if (name.Contains("chest") || name.Contains("Deck") || name.Contains("blade")) { return "Timber"; } return "Frame"; } } internal static class ModelSpec { internal static readonly P CrankPivot = new P(0f, 0.56f, -0.12f); internal static readonly P StemBase = new P(0f, 0.84f, -0.24f); internal static readonly P HandlebarCenter = new P(0f, 1f, -0.24f); internal static readonly P LeftGrip = new P(-0.34f, 1f, -0.24f); internal static readonly P RightGrip = new P(0.34f, 1f, -0.24f); private static void Link(List<NativePart> parts, string name, P from, P to, float width, string group = "Body") { double num = to.X - from.X; double num2 = to.Y - from.Y; double num3 = to.Z - from.Z; float x = (float)Math.Sqrt(num * num + num2 * num2 + num3 * num3); parts.Add(new NativePart(name, "wood_beam", "new", new P((from.X + to.X) / 2f, (from.Y + to.Y) / 2f, (from.Z + to.Z) / 2f), new P(x, width, width), new P(0f, (float)(Math.Atan2(0.0 - num3, num) * 180.0 / Math.PI), (float)(Math.Atan2(num2, Math.Sqrt(num * num + num3 * num3)) * 180.0 / Math.PI)), group)); } internal static List<NativePart> Parts() { List<NativePart> list = new List<NativePart>(); P crankPivot = CrankPivot; P p = new P(0f, 1.08f, -0.28f); P p2 = new P(0f, 1.32f, 0.76f); Link(list, "Top timber tube", p, p2, 0.105f); Link(list, "Down timber tube", crankPivot, p2, 0.12f); Link(list, "Seat timber tube", crankPivot, p, 0.11f); float[] array = new float[2] { -0.12f, 0.12f }; foreach (float x in array) { Link(list, "Chain stay", new P(x, 0.56f, -0.12f), new P(x, 0.48f, -0.9f), 0.075f); Link(list, "Seat stay", new P(x, 1.08f, -0.28f), new P(x, 0.48f, -0.9f), 0.075f); } list.Add(new NativePart("Front wheel", "Cart", "Wheel1/default", default(P), new P(0.14f, 0.92f, 0.92f), default(P), "FrontWheel")); list.Add(new NativePart("Rear wheel", "Cart", "Wheel1/default", default(P), new P(0.14f, 0.92f, 0.92f), default(P), "RearWheel")); array = new float[2] { 1f, -0.9f }; foreach (float z in array) { list.Add(new NativePart("Wheel bronze axle", "Copper", "model", new P(0f, 0.48f, z), new P(0.27f, 0.1f, 0.1f), default(P))); } array = new float[2] { -0.1f, 0.1f }; foreach (float x2 in array) { Link(list, "Steering fork", new P(x2, 0f, 0f), new P(x2, StemBase.Y, StemBase.Z), 0.065f, "Steering"); } Link(list, "Fork crown", new P(-0.1f, StemBase.Y, StemBase.Z), new P(0.1f, StemBase.Y, StemBase.Z), 0.09f, "Steering"); Link(list, "Handlebar neck", StemBase, HandlebarCenter, 0.08f, "Steering"); Link(list, "Straight handlebar", new P(-0.44f, HandlebarCenter.Y, HandlebarCenter.Z), HandlebarCenter, 0.065f, "Steering"); Link(list, "Straight handlebar", HandlebarCenter, new P(0.44f, HandlebarCenter.Y, HandlebarCenter.Z), 0.065f, "Steering"); P[] array2 = new P[2] { LeftGrip, RightGrip }; foreach (P position in array2) { list.Add(new NativePart("Handlebar grip", "wood_beam", "new", position, new P(0.19f, 0.075f, 0.075f), default(P), "Steering")); } for (int j = -1; j <= 1; j++) { list.Add(new NativePart("Wood saddle", "wood_beam", "new", new P((float)j * 0.105f, 1.15f, -0.28f), new P(0.38f - (float)Math.Abs(j) * 0.08f, 0.08f, 0.1f), new P(0f, 90f, 0f))); } array = new float[2] { -0.28f, 0.28f }; foreach (float num in array) { Link(list, "Rear rack brace", new P(num * 0.45f, 0.49f, -0.9f), new P(num, 0.94f, -0.9f), 0.055f); Link(list, "Rear rack rail", new P(num, 0.94f, -1.18f), new P(num, 0.94f, -0.64f), 0.06f); } list.Add(new NativePart("Cargo chest body", "piece_chest_wood", "New/woodchest", new P(0f, 1.11f, -0.92f), new P(0.6f, 0.3f, 0.48f), default(P))); list.Add(new NativePart("Cargo chest lid", "piece_chest_wood", "New/woodchesttop_closed", new P(0f, 1.29f, -0.92f), new P(0.6f, 0.1f, 0.48f), default(P))); Link(list, "Wood drive shaft", new P(0.17f, 0.56f, -0.12f), new P(0.17f, 0.48f, -0.9f), 0.045f); list.Add(new NativePart("Crank bronze gear", "Cart", "Wheel1/default", new P(0.14f, 0f, 0f), new P(0.05f, 0.25f, 0.25f), default(P), "Crank")); Link(list, "Crank axle", new P(-0.22f, 0f, 0f), new P(0.22f, 0f, 0f), 0.06f, "Crank"); Link(list, "Left crank arm", new P(-0.22f, 0f, 0f), new P(-0.22f, 0f, 0.19f), 0.055f, "Crank"); Link(list, "Right crank arm", new P(0.22f, 0f, 0f), new P(0.22f, 0f, -0.19f), 0.055f, "Crank"); string[] array3 = new string[2] { "LeftPedal", "RightPedal" }; foreach (string text in array3) { list.Add(new NativePart("Pedal block", "wood_beam", "new", default(P), new P(0.17f, 0.055f, 0.105f), default(P), text)); } array2 = new P[3] { crankPivot, p, p2 }; foreach (P position2 in array2) { list.Add(new NativePart("Frame bronze joint", "Copper", "model", position2, new P(0.17f, 0.13f, 0.16f), default(P))); } array = new float[2] { -0.08f, 0.08f }; foreach (float x3 in array) { float[] array4 = new float[3] { -0.9f, -0.12f, 0.76f }; foreach (float num2 in array4) { list.Add(new NativePart("Frame bronze nail", "Copper", "model", new P(x3, (num2 < -0.5f) ? 0.48f : ((num2 > 0f) ? 1.3f : 0.56f), num2), new P(0.035f, 0.06f, 0.06f), default(P))); } } return list; } } public sealed class BikePose : MonoBehaviour { [SerializeField] private BikeController bike; [SerializeField] private Transform leftPedal; [SerializeField] private Transform rightPedal; [SerializeField] private Transform leftGrip; [SerializeField] private Transform rightGrip; private Player rider; private Transform hips; private Transform spine; private Transform lu; private Transform ll; private Transform lf; private Transform ru; private Transform rl; private Transform rf; private Transform la; private Transform le; private Transform lh; private Transform ra; private Transform re; private Transform rh; internal void Configure(BikeController b, Transform lp, Transform rp, Transform lg, Transform rg) { bike = b; leftPedal = lp; rightPedal = rp; leftGrip = lg; rightGrip = rg; } private void Cache(Player p) { rider = p; hips = ((Component)p).transform.Find("Visual/Armature/Hips"); if (Object.op_Implicit((Object)(object)hips)) { lu = hips.Find("LeftUpLeg"); ll = (Object.op_Implicit((Object)(object)lu) ? lu.Find("LeftLeg") : null); lf = (Object.op_Implicit((Object)(object)ll) ? ll.Find("LeftFoot") : null); ru = hips.Find("RightUpLeg"); rl = (Object.op_Implicit((Object)(object)ru) ? ru.Find("RightLeg") : null); rf = (Object.op_Implicit((Object)(object)rl) ? rl.Find("RightFoot") : null); spine = hips.Find("Spine"); Transform val = hips.Find("Spine/Spine1/Spine2"); la = (Object.op_Implicit((Object)(object)val) ? val.Find("LeftShoulder/LeftArm") : null); le = (Object.op_Implicit((Object)(object)la) ? la.Find("LeftForeArm") : null); lh = (Object.op_Implicit((Object)(object)le) ? le.Find("LeftHand") : null); ra = (Object.op_Implicit((Object)(object)val) ? val.Find("RightShoulder/RightArm") : null); re = (Object.op_Implicit((Object)(object)ra) ? ra.Find("RightForeArm") : null); rh = (Object.op_Implicit((Object)(object)re) ? re.Find("RightHand") : null); } } private static void Reach(Transform upper, Transform lower, Transform end, Vector3 target, Vector3 pole) { //IL_001a: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_0028: 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_0036: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown