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 LoxWagon v0.7.3
LoxWagon.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HaldorWagonMod { public sealed class ArticulatedChassis : MonoBehaviour { private struct CollisionPair { public Collider A; public Collider B; public bool Previous; } [HarmonyPatch(typeof(Vagon), "AttachTo")] private static class RouteHitch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { bool patched = false; foreach (CodeInstruction instruction in instructions) { MethodInfo methodInfo = instruction.operand as MethodInfo; if (methodInfo != null && methodInfo.Name == "AddComponent" && methodInfo.IsGenericMethod && methodInfo.GetGenericArguments()[0] == typeof(ConfigurableJoint)) { instruction.opcode = OpCodes.Call; instruction.operand = AccessTools.Method(typeof(ArticulatedChassis), "MakeHitch", (Type[])null, (Type[])null); patched = true; } yield return instruction; } if (!patched) { throw new Exception("Cannot route vanilla hitch joint to articulated carrier."); } } private static void Postfix(Vagon __instance) { //IL_0039: 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_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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00cb: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) ArticulatedChassis component = ((Component)__instance).GetComponent<ArticulatedChassis>(); if (!((Object)(object)component == (Object)null)) { object? value = AttachField.GetValue(__instance); ConfigurableJoint val = (ConfigurableJoint)((value is ConfigurableJoint) ? value : null); if (!((Object)(object)val == (Object)null)) { ((Joint)val).anchor = ((Component)val).transform.InverseTransformPoint(__instance.m_attachPoint.position); ((Joint)val).enableCollision = false; component.desiredHitchAnchor = __instance.m_attachOffset; float num = AnchorError(val); ((Joint)val).connectedAnchor = ((Component)((Joint)val).connectedBody).transform.InverseTransformPoint(__instance.m_attachPoint.position); ConfigurableJointMotion val2 = (ConfigurableJointMotion)1; val.zMotion = (ConfigurableJointMotion)1; ConfigurableJointMotion xMotion = (val.yMotion = val2); val.xMotion = xMotion; SoftJointLimit linearLimit = default(SoftJointLimit); ((SoftJointLimit)(ref linearLimit)).limit = 0.08f; ((SoftJointLimit)(ref linearLimit)).bounciness = 0f; ((SoftJointLimit)(ref linearLimit)).contactDistance = 0.01f; val.linearLimit = linearLimit; component.settlingHitch = val; ManualLogSource log = HaldorWagonPlugin.Log; string[] obj = new string[12] { "Hitch settling wagon=", component.Identity, " initialNominalGap=", num.ToString("F3"), " actualGap=", AnchorError(val).ToString("F3"), " spring=", null, null, null, null, null }; SoftJointLimitSpring linearLimitSpring = val.linearLimitSpring; obj[7] = ((SoftJointLimitSpring)(ref linearLimitSpring)).spring.ToString(); obj[8] = " damper="; linearLimitSpring = val.linearLimitSpring; obj[9] = ((SoftJointLimitSpring)(ref linearLimitSpring)).damper.ToString(); obj[10] = " breakForce="; obj[11] = ((Joint)val).breakForce.ToString(); log.LogInfo((object)string.Concat(obj)); } } } } [HarmonyPatch(typeof(Player), "SetupPlacementGhost")] private static class IgnorePlacementPreview { private static void Postfix(Player __instance) { object? value = AccessTools.Field(typeof(Player), "m_placementGhost").GetValue(__instance); GameObject val = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val == (Object)null) { return; } ArticulatedChassis component = val.GetComponent<ArticulatedChassis>(); if (!((Object)(object)component == (Object)null)) { component.Preview = true; ((Behaviour)component).enabled = false; Vagon component2 = val.GetComponent<Vagon>(); if ((Object)(object)component2 != (Object)null) { ((MonoBehaviour)component2).CancelInvoke(); ((Behaviour)component2).enabled = false; } LoxWagonController component3 = val.GetComponent<LoxWagonController>(); if ((Object)(object)component3 != (Object)null) { ((Behaviour)component3).enabled = false; } } } } [HarmonyPatch(typeof(Vagon), "SetMass")] private static class PreserveMassRatios { private static bool Prefix(Vagon __instance, float __0) { ArticulatedChassis component = ((Component)__instance).GetComponent<ArticulatedChassis>(); if ((Object)(object)component == (Object)null) { return true; } if (!component.Preview) { component.SetMass(__0); } return false; } } public Rigidbody Turntable; public Rigidbody Carrier; public Rigidbody[] Wheels; private Rigidbody body; private ZNetView net; private Vagon cart; private Rigidbody[] moving; private Vector3[] restPositions; private Quaternion[] restRotations; private bool owner; private bool initialized; private bool ready; private bool faulted; public bool Preview; private ConfigurableJoint yawJoint; private ConfigurableJoint pitchJoint; private ConfigurableJoint settlingHitch; private Quaternion yawRest; private Quaternion pitchRest; private Vector3 desiredHitchAnchor; private float lastBreakAt = -100f; private string lastBreakBody = "none"; private static readonly MethodInfo Detach = AccessTools.Method(typeof(Vagon), "Detach", (Type[])null, (Type[])null); private float nextPublish; private float nextLog; private Vector3 lastRoot; private readonly List<CollisionPair> ignored = new List<CollisionPair>(); private static readonly FieldInfo AttachField = AccessTools.Field(typeof(Vagon), "m_attachJoin"); internal string Identity { get { if (!((Object)(object)net != (Object)null) || !net.IsValid()) { return ((Object)((Component)this).gameObject).GetInstanceID().ToString(); } return ((object)Unsafe.As<ZDOID, ZDOID>(ref net.GetZDO().m_uid)/*cast due to .constrained prefix*/).ToString(); } } internal static void Build(GameObject wagon, GameObject ram) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_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_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0593: 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_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Expected O, but got Unknown //IL_027d: 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_0292: 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_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: 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_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) VisualWheelRotation component = wagon.GetComponent<VisualWheelRotation>(); if ((Object)(object)component == (Object)null || (Object)(object)component.Shafts == (Object)null || (Object)(object)component.FrontAxle == (Object)null || component.Wheels.Length != 4) { throw new Exception("Articulated chassis requires separated wheels, shafts and front axle."); } Vagon component2 = wagon.GetComponent<Vagon>(); Vagon val = (((Object)(object)ram != (Object)null) ? ram.GetComponent<Vagon>() : null); Rigidbody val2 = (((Object)(object)val != (Object)null && val.m_wheels.Length != 0) ? val.m_wheels[0] : null); MeshCollider val3 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<MeshCollider>() : null); if ((Object)(object)val3 == (Object)null || (Object)(object)val3.sharedMesh == (Object)null) { throw new Exception("BatteringRam wheel collider unavailable; chassis cannot be built."); } ArticulatedChassis articulatedChassis = wagon.AddComponent<ArticulatedChassis>(); articulatedChassis.body = wagon.GetComponent<Rigidbody>(); articulatedChassis.Turntable = NewBody("FrontTurntable", wagon.transform, new Vector3(0f, 1.25f, -2f), 3f); LimitedJoint(articulatedChassis.Turntable, articulatedChassis.body, Vector3.up, Vector3.forward, 32f, 1.5f); articulatedChassis.Carrier = NewBody("FrontAxleCarrier", ((Component)articulatedChassis.Turntable).transform, new Vector3(0f, 0f, 0.55f), 3.6f); LimitedJoint(articulatedChassis.Carrier, articulatedChassis.Turntable, Vector3.right, Vector3.up, 18f, 0.8f); articulatedChassis.Wheels = (Rigidbody[])(object)new Rigidbody[4]; Vector3 val5 = default(Vector3); for (int i = 0; i < 4; i++) { bool flag = i < 2; Rigidbody val4 = (flag ? articulatedChassis.Carrier : articulatedChassis.body); ((Vector3)(ref val5))..ctor((float)((i % 2 != 0) ? 1 : (-1)) * 1.44284f, 1f, (float)(flag ? (-2) : 2)); Rigidbody val6 = NewBody((flag ? "Front" : "Rear") + ((i % 2 == 0) ? "Left" : "Right") + "Wheel", ((Component)val4).transform, ((Component)val4).transform.InverseTransformPoint(wagon.transform.TransformPoint(val5)), 2.1f); ((Component)val6).transform.rotation = wagon.transform.rotation; GameObject val7 = new GameObject("WheelContact"); val7.layer = ((Component)val3).gameObject.layer; val7.transform.SetParent(((Component)val6).transform, false); Bounds bounds = val3.sharedMesh.bounds; val7.transform.localScale = new Vector3(0.14f / ((Bounds)(ref bounds)).size.x, 1.96f / ((Bounds)(ref bounds)).size.y, 1.96f / ((Bounds)(ref bounds)).size.z); val7.transform.localPosition = -Vector3.Scale(((Bounds)(ref bounds)).center, val7.transform.localScale); MeshCollider obj = val7.AddComponent<MeshCollider>(); obj.sharedMesh = val3.sharedMesh; obj.convex = true; ((Collider)obj).sharedMaterial = ((Collider)val3).sharedMaterial; ConfigurableJoint obj2 = LockedJoint(val6, val4, Vector3.right, Vector3.up); obj2.angularXMotion = (ConfigurableJointMotion)2; obj2.projectionMode = (JointProjectionMode)0; articulatedChassis.Wheels[i] = val6; Transform transform = new GameObject("VisualWheelMount" + i).transform; transform.SetParent(((Component)val4).transform, false); transform.position = component.Wheels[i].position; transform.rotation = wagon.transform.rotation; component.Wheels[i].SetParent(transform, true); } component.Shafts.SetParent(((Component)articulatedChassis.Carrier).transform, true); component.FrontAxle.SetParent(((Component)articulatedChassis.Carrier).transform, true); component2.m_attachPoint.SetParent(((Component)articulatedChassis.Carrier).transform, true); if ((Object)(object)component2.m_lineAttachPoints0 != (Object)null) { component2.m_lineAttachPoints0.SetParent(((Component)articulatedChassis.Carrier).transform, true); } if ((Object)(object)component2.m_lineAttachPoints1 != (Object)null) { component2.m_lineAttachPoints1.SetParent(((Component)articulatedChassis.Carrier).transform, true); } Transform val8 = wagon.transform.Find("LoxHitch"); if ((Object)(object)val8 != (Object)null) { val8.SetParent(((Component)articulatedChassis.Carrier).transform, true); } Rigidbody[] wheels = component2.m_wheels; foreach (Rigidbody val9 in wheels) { if ((Object)(object)val9 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val9).gameObject); } } Collider[] componentsInChildren = wagon.GetComponentsInChildren<Collider>(true); foreach (Collider val10 in componentsInChildren) { if (!val10.isTrigger && (Object)(object)((Component)val10).GetComponentInParent<Rigidbody>(true) == (Object)(object)articulatedChassis.body) { Object.DestroyImmediate((Object)(object)val10); } } BoxCollider val11 = wagon.AddComponent<BoxCollider>(); val11.center = new Vector3(0f, 2.08f, 0.6f); val11.size = new Vector3(1.85f, 0.36f, 5.25f); component2.m_slipperyCollider = (Collider)(object)val11; component2.m_wheels = articulatedChassis.Wheels; articulatedChassis.body.solverIterations = 20; articulatedChassis.body.solverVelocityIterations = 8; articulatedChassis.body.maxDepenetrationVelocity = 2f; articulatedChassis.body.centerOfMass = new Vector3(0f, 1.65f, 0.35f); articulatedChassis.SetMass(component2.m_baseMass); HaldorWagonPlugin.Log.LogInfo((object)"Articulated chassis built: BatteringRam wheel contacts; yaw +/-32, offset pitch +/-18; shafts AND actual hitch on carrier; four physical wheels; roll locked."); } private static Rigidbody NewBody(string name, Transform parent, Vector3 pos, float mass) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_009b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); val.transform.localPosition = pos; Rigidbody obj = val.AddComponent<Rigidbody>(); obj.mass = mass; obj.linearDamping = 0f; obj.angularDamping = 0.1f; obj.solverIterations = 20; obj.solverVelocityIterations = 8; obj.maxDepenetrationVelocity = 2f; obj.collisionDetectionMode = (CollisionDetectionMode)2; obj.interpolation = (RigidbodyInterpolation)1; obj.maxAngularVelocity = 15f; obj.inertiaTensor = Vector3.one * 0.8f; obj.inertiaTensorRotation = Quaternion.identity; return obj; } private static ConfigurableJoint LockedJoint(Rigidbody child, Rigidbody parent, Vector3 axis, Vector3 secondary) { //IL_001a: 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_0041: 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_0053: 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_0061: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) ConfigurableJoint obj = ((Component)child).gameObject.AddComponent<ConfigurableJoint>(); ((Joint)obj).autoConfigureConnectedAnchor = false; ((Joint)obj).connectedBody = parent; ((Joint)obj).anchor = Vector3.zero; ((Joint)obj).connectedAnchor = ((Component)parent).transform.InverseTransformPoint(((Component)child).transform.position); ((Joint)obj).axis = axis; obj.secondaryAxis = secondary; ConfigurableJointMotion val = (ConfigurableJointMotion)0; obj.zMotion = (ConfigurableJointMotion)0; ConfigurableJointMotion xMotion = (obj.yMotion = val); obj.xMotion = xMotion; val = (ConfigurableJointMotion)0; obj.angularZMotion = (ConfigurableJointMotion)0; xMotion = (obj.angularYMotion = val); obj.angularXMotion = xMotion; ((Joint)obj).enableCollision = false; ((Joint)obj).enablePreprocessing = true; obj.projectionMode = (JointProjectionMode)1; obj.projectionDistance = 0.05f; obj.projectionAngle = 3f; return obj; } private static void LimitedJoint(Rigidbody child, Rigidbody parent, Vector3 axis, Vector3 secondary, float limit, float damping) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0073: 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) ConfigurableJoint obj = LockedJoint(child, parent, axis, secondary); obj.angularXMotion = (ConfigurableJointMotion)1; SoftJointLimit val = default(SoftJointLimit); ((SoftJointLimit)(ref val)).limit = 0f - limit; ((SoftJointLimit)(ref val)).bounciness = 0f; ((SoftJointLimit)(ref val)).contactDistance = 2f; obj.lowAngularXLimit = val; val = default(SoftJointLimit); ((SoftJointLimit)(ref val)).limit = limit; ((SoftJointLimit)(ref val)).bounciness = 0f; ((SoftJointLimit)(ref val)).contactDistance = 2f; obj.highAngularXLimit = val; JointDrive angularXDrive = default(JointDrive); ((JointDrive)(ref angularXDrive)).positionSpring = 0f; ((JointDrive)(ref angularXDrive)).positionDamper = damping; ((JointDrive)(ref angularXDrive)).maximumForce = 30f; obj.angularXDrive = angularXDrive; } private bool BodiesValid() { if ((Object)(object)body != (Object)null && (Object)(object)Turntable != (Object)null && (Object)(object)Carrier != (Object)null && Wheels != null && Wheels.Length == 4) { return Wheels.All((Rigidbody w) => (Object)(object)w != (Object)null); } return false; } internal void SetMass(float total) { //IL_0094: 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_00ae: 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_00dd: Unknown result type (might be due to invalid IL or missing references) if (Preview || faulted) { return; } if ((Object)(object)body == (Object)null) { body = ((Component)this).GetComponent<Rigidbody>(); } if (BodiesValid()) { body.mass = total * 0.5f; Turntable.mass = total * 0.1f; Carrier.mass = total * 0.12f; Rigidbody[] wheels = Wheels; for (int i = 0; i < wheels.Length; i++) { wheels[i].mass = total * 0.07f; } Turntable.inertiaTensor = Vector3.one * Turntable.mass * 0.8f; Carrier.inertiaTensor = new Vector3(3f, 3f, 0.5f) * Carrier.mass; wheels = Wheels; for (int i = 0; i < wheels.Length; i++) { wheels[i].ResetInertiaTensor(); } } } private string MissingBodies() { List<string> list = new List<string>(); if ((Object)(object)body == (Object)null) { list.Add("WagonBody"); } if ((Object)(object)Turntable == (Object)null) { list.Add("FrontTurntable"); } if ((Object)(object)Carrier == (Object)null) { list.Add("FrontAxleCarrier"); } for (int i = 0; i < 4; i++) { if (Wheels == null || Wheels.Length <= i || (Object)(object)Wheels[i] == (Object)null) { list.Add("Wheel" + i); } } return string.Join(",", list.ToArray()); } private void Fail(string reason) { if (faulted) { return; } faulted = true; ready = false; HaldorWagonPlugin.Log.LogError((object)("Chassis disabled wagon=" + Identity + " reason=" + reason)); if ((Object)(object)cart != (Object)null && (Object)(object)net != (Object)null && net.IsValid() && net.IsOwner()) { Detach.Invoke(cart, null); } if (moving != null) { Rigidbody[] array = moving; foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null) { val.collisionDetectionMode = (CollisionDetectionMode)3; val.isKinematic = true; } } } ((Behaviour)this).enabled = false; } private unsafe void Start() { //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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: 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_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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_039f: 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_03bf: Unknown result type (might be due to invalid IL or missing references) body = ((Component)this).GetComponent<Rigidbody>(); net = ((Component)this).GetComponent<ZNetView>(); cart = ((Component)this).GetComponent<Vagon>(); if (Preview || (Object)(object)net == (Object)null || !net.IsValid()) { ((Behaviour)this).enabled = false; return; } if (!BodiesValid()) { Fail("missing bodies: " + MissingBodies()); return; } Physics.SyncTransforms(); moving = ((IEnumerable<Rigidbody>)(object)new Rigidbody[2] { Turntable, Carrier }).Concat(Wheels).ToArray(); restPositions = moving.Select((Rigidbody r) => ((Component)r).transform.localPosition).ToArray(); restRotations = moving.Select((Rigidbody r) => ((Component)r).transform.localRotation).ToArray(); lastRoot = ((Component)this).transform.position; Rigidbody[] array = moving; foreach (Rigidbody val in array) { ConfigurableJoint[] components = ((Component)val).GetComponents<ConfigurableJoint>(); for (int num2 = 0; num2 < components.Length; num2++) { Object.DestroyImmediate((Object)(object)components[num2]); } if ((Object)(object)((Component)val).GetComponent<ChassisJointEvents>() == (Object)null) { ((Component)val).gameObject.AddComponent<ChassisJointEvents>(); } } LimitedJoint(Turntable, body, Vector3.up, Vector3.forward, 32f, 3f); LimitedJoint(Carrier, Turntable, Vector3.right, Vector3.up, 18f, 2f); yawJoint = ((Component)Turntable).GetComponent<ConfigurableJoint>(); pitchJoint = ((Component)Carrier).GetComponent<ConfigurableJoint>(); yawRest = Quaternion.Inverse(body.rotation) * Turntable.rotation; pitchRest = Quaternion.Inverse(Turntable.rotation) * Carrier.rotation; for (int num3 = 0; num3 < 4; num3++) { ConfigurableJoint obj = LockedJoint(Wheels[num3], (num3 < 2) ? Carrier : body, Vector3.right, Vector3.up); obj.angularXMotion = (ConfigurableJointMotion)2; obj.projectionMode = (JointProjectionMode)0; } Collider[] array2 = (from c in ((Component)this).GetComponentsInChildren<Collider>(true) where !c.isTrigger select c).ToArray(); for (int num4 = 0; num4 < array2.Length; num4++) { for (int num5 = num4 + 1; num5 < array2.Length; num5++) { if (!((Object)(object)array2[num4].attachedRigidbody == (Object)(object)array2[num5].attachedRigidbody)) { ignored.Add(new CollisionPair { A = array2[num4], B = array2[num5], Previous = Physics.GetIgnoreCollision(array2[num4], array2[num5]) }); Physics.IgnoreCollision(array2[num4], array2[num5], true); } } } SetMass(cart.m_baseMass + cart.m_container.GetInventory().GetTotalWeight() * cart.m_itemWeightMassFactor); ready = true; ManualLogSource log = HaldorWagonPlugin.Log; string[] obj2 = new string[10] { "Chassis initialized wagon=", Identity, " bodies=7 joints=6 yawRest=", null, null, null, null, null, null, null }; Quaternion val2 = yawRest; obj2[3] = ((object)(*(Quaternion*)(&val2))/*cast due to .constrained prefix*/).ToString(); obj2[4] = " pitchRest="; val2 = pitchRest; obj2[5] = ((object)(*(Quaternion*)(&val2))/*cast due to .constrained prefix*/).ToString(); obj2[6] = " yawAnchorError="; obj2[7] = AnchorError(yawJoint).ToString("F4"); obj2[8] = " pitchAnchorError="; obj2[9] = AnchorError(pitchJoint).ToString("F4"); log.LogInfo((object)string.Concat(obj2)); FixedUpdate(); } internal void JointBroken(string source, float force) { lastBreakAt = Time.time; lastBreakBody = source; ConfigurableJoint val = (ConfigurableJoint)(((Object)(object)cart != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); HaldorWagonPlugin.Log.LogWarning((object)("Chassis joint break wagon=" + Identity + " source=" + source + " force=" + force + " hitchPresent=" + ((Object)(object)val != (Object)null) + " yawPresent=" + ((Object)(object)yawJoint != (Object)null) + " pitchPresent=" + ((Object)(object)pitchJoint != (Object)null))); } internal string LossContext() { return " wagon=" + Identity + " lastBreakBody=" + lastBreakBody + " secondsSinceBreak=" + (Time.time - lastBreakAt).ToString("F2"); } private static float AnchorError(ConfigurableJoint j) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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 ((Object)(object)j == (Object)null || (Object)(object)((Joint)j).connectedBody == (Object)null) { return -1f; } return Vector3.Distance(((Component)j).transform.TransformPoint(((Joint)j).anchor), ((Component)((Joint)j).connectedBody).transform.TransformPoint(((Joint)j).connectedAnchor)); } private static float Twist(Rigidbody child, Rigidbody parent, Quaternion rest, Vector3 axis, out float swing) { //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_0007: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0055: 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_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_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_009a: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Inverse(rest) * (Quaternion.Inverse(parent.rotation) * child.rotation); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, val.y, val.z); Vector3 val3 = axis * Vector3.Dot(val2, axis); Quaternion val4 = new Quaternion(val3.x, val3.y, val3.z, val.w); Quaternion normalized = ((Quaternion)(ref val4)).normalized; swing = Quaternion.Angle(Quaternion.identity, val * Quaternion.Inverse(normalized)); return Mathf.DeltaAngle(0f, 2f * Mathf.Atan2(Vector3.Dot(val3, axis), val.w) * 57.29578f); } private void SettleHitch() { //IL_0066: 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_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_0040: 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_0056: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)settlingHitch == (Object)null) && !((Object)(object)((Joint)settlingHitch).connectedBody == (Object)null)) { if (AnchorError(settlingHitch) < 0.3f) { ((Joint)settlingHitch).connectedAnchor = Vector3.MoveTowards(((Joint)settlingHitch).connectedAnchor, desiredHitchAnchor, 0.75f * Time.fixedDeltaTime); } Vector3 val = ((Joint)settlingHitch).connectedAnchor - desiredHitchAnchor; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { HaldorWagonPlugin.Log.LogInfo((object)("Hitch settled wagon=" + Identity)); settlingHitch = null; } } } private void FixedUpdate() { //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051a: 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_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) if (!ready || Preview || faulted) { return; } if (!BodiesValid()) { Fail("runtime missing bodies: " + MissingBodies()); return; } if ((Object)(object)yawJoint == (Object)null || (Object)(object)pitchJoint == (Object)null) { Fail("structural joint missing" + LossContext()); return; } bool flag = (Object)(object)net != (Object)null && net.IsValid(); bool flag2 = flag && net.IsOwner(); if (!initialized || flag2 != owner) { if (initialized && owner && !flag2) { HaldorWagonPlugin.Log.LogInfo((object)("Hitch detach: ownership lost wagon=" + Identity)); Detach.Invoke(cart, null); } Rigidbody[] array = moving; foreach (Rigidbody val in array) { if (!flag2) { val.collisionDetectionMode = (CollisionDetectionMode)3; } val.isKinematic = !flag2; if (flag2) { val.collisionDetectionMode = (CollisionDetectionMode)2; } } if (flag2) { array = moving; foreach (Rigidbody obj in array) { obj.linearVelocity = body.linearVelocity; obj.angularVelocity = body.angularVelocity; } } owner = flag2; initialized = true; HaldorWagonPlugin.Log.LogInfo((object)("Articulated chassis physics owner=" + owner)); } if (!flag) { return; } if (owner) { SettleHitch(); Vector3 val2 = ((Component)this).transform.position - lastRoot; if (((Vector3)(ref val2)).sqrMagnitude > 100f) { for (int j = 0; j < moving.Length; j++) { Transform transform = ((Component)moving[j]).transform; transform.localPosition = restPositions[j]; transform.localRotation = restRotations[j]; moving[j].position = transform.position; moving[j].rotation = transform.rotation; moving[j].linearVelocity = body.linearVelocity; moving[j].angularVelocity = Vector3.zero; } } if (Time.time >= nextPublish) { nextPublish = Time.time + 0.1f; for (int k = 0; k < moving.Length; k++) { net.GetZDO().Set("lw_chassis_p" + k, ((Component)moving[k]).transform.localPosition); net.GetZDO().Set("lw_chassis_q" + k, ((Component)moving[k]).transform.localRotation); } } if (Time.time >= nextLog) { nextLog = Time.time + 10f; object? value = AttachField.GetValue(cart); ConfigurableJoint val3 = (ConfigurableJoint)((value is ConfigurableJoint) ? value : null); float num = (((Object)(object)val3 != (Object)null && (Object)(object)((Joint)val3).connectedBody != (Object)null) ? Vector3.Distance(((Component)val3).transform.TransformPoint(((Joint)val3).anchor), ((Component)((Joint)val3).connectedBody).transform.TransformPoint(((Joint)val3).connectedAnchor)) : 0f); float swing; float num2 = Twist(Turntable, body, yawRest, Vector3.up, out swing); float swing2; float num3 = Twist(Carrier, Turntable, pitchRest, Vector3.right, out swing2); ManualLogSource log = HaldorWagonPlugin.Log; string[] obj2 = new string[22] { "Chassis state wagon=", Identity, " yawTwist=", num2.ToString("F1"), " pitchTwist=", num3.ToString("F1"), " yawSwing=", swing.ToString("F1"), " pitchSwing=", swing2.ToString("F1"), " yawAnchorError=", AnchorError(yawJoint).ToString("F3"), " pitchAnchorError=", AnchorError(pitchJoint).ToString("F3"), " attached=", ((Object)(object)val3 != (Object)null).ToString(), " settling=", ((Object)(object)settlingHitch != (Object)null).ToString(), " hitchGap=", num.ToString("F3"), " speed=", null }; val2 = body.linearVelocity; obj2[21] = ((Vector3)(ref val2)).magnitude.ToString("F2"); log.LogInfo((object)string.Concat(obj2)); } } else { for (int l = 0; l < moving.Length; l++) { Transform transform2 = ((Component)moving[l]).transform; transform2.localPosition = net.GetZDO().GetVec3("lw_chassis_p" + l, restPositions[l]); transform2.localRotation = net.GetZDO().GetQuaternion("lw_chassis_q" + l, restRotations[l]); } } lastRoot = ((Component)this).transform.position; } private void OnDestroy() { foreach (CollisionPair item in ignored) { if ((Object)(object)item.A != (Object)null && (Object)(object)item.B != (Object)null) { Physics.IgnoreCollision(item.A, item.B, item.Previous); } } } internal static ConfigurableJoint MakeHitch(GameObject wagon) { ArticulatedChassis component = wagon.GetComponent<ArticulatedChassis>(); if ((Object)(object)component != (Object)null && (!component.ready || component.faulted || !component.BodiesValid())) { throw new InvalidOperationException("Articulated chassis is not ready for hitching."); } return (((Object)(object)component != (Object)null) ? ((Component)component.Carrier).gameObject : wagon).AddComponent<ConfigurableJoint>(); } } public sealed class ChassisJointEvents : MonoBehaviour { private void OnJointBreak(float force) { ArticulatedChassis componentInParent = ((Component)this).GetComponentInParent<ArticulatedChassis>(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.JointBroken(((Object)((Component)this).gameObject).name, force); } } } internal static class CargoContact { internal static float Drop(List<Vector3[]> moving, IEnumerable<List<Vector3[]>> supports) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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) float num = 1.5f; foreach (Vector3[] item in moving) { foreach (Vector3 val in item) { num = Mathf.Min(num, val.y - WagonCargo.InteriorFloor(val.x) - 0.012f); } } num = Mathf.Max(0f, num); foreach (List<Vector3[]> support in supports) { foreach (Vector3[] item2 in moving) { foreach (Vector3[] item3 in support) { Vector3[] array = (Vector3[])(object)new Vector3[3] { item2[1] - item2[0], item2[2] - item2[0], item2[4] - item2[0] }; Vector3[] array2 = (Vector3[])(object)new Vector3[3] { item3[1] - item3[0], item3[2] - item3[0], item3[4] - item3[0] }; List<Vector3> list = new List<Vector3>(); for (int j = 0; j < 3; j++) { list.Add(Vector3.Cross(array[j], array[(j + 1) % 3])); list.Add(Vector3.Cross(array2[j], array2[(j + 1) % 3])); } Vector3[] current = array; foreach (Vector3 val2 in current) { Vector3[] array3 = array2; foreach (Vector3 val3 in array3) { list.Add(Vector3.Cross(val2, val3)); } } float num2 = 0f; float num3 = num; bool flag = true; foreach (Vector3 item4 in list) { Vector3 current5 = item4; if (((Vector3)(ref current5)).sqrMagnitude < 1E-10f) { continue; } Vector3 normalized = ((Vector3)(ref current5)).normalized; float num4 = float.MaxValue; float num5 = float.MinValue; float num6 = float.MaxValue; float num7 = float.MinValue; current = item2; for (int i = 0; i < current.Length; i++) { float num8 = Vector3.Dot(current[i], normalized); num4 = Mathf.Min(num4, num8); num5 = Mathf.Max(num5, num8); } current = item3; for (int i = 0; i < current.Length; i++) { float num9 = Vector3.Dot(current[i], normalized); num6 = Mathf.Min(num6, num9); num7 = Mathf.Max(num7, num9); } if (Mathf.Abs(normalized.y) < 1E-06f) { if (num5 < num6 - 0.0001f || num7 < num4 - 0.0001f) { flag = false; break; } continue; } float num10 = (num4 - num7) / normalized.y; float num11 = (num5 - num6) / normalized.y; num2 = Mathf.Max(num2, Mathf.Min(num10, num11)); num3 = Mathf.Min(num3, Mathf.Max(num10, num11)); if (num2 > num3) { flag = false; break; } } if (flag && num3 >= 0f) { num = Mathf.Min(num, Mathf.Max(0f, num2 - 0.003f)); } } } } return num; } } internal static class CargoLayout { internal struct Item { internal string Kind; internal int Stage; internal Vector3 Position; internal Vector3 Angles; internal Item(string k, int s, Vector3 p, Vector3 a) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Kind = k; Stage = s; Position = p; Angles = a; } } internal static readonly Item[] Items = new Item[65] { new Item("C3", 0, new Vector3(0f, 2.085648f, 1.81f), new Vector3(0f, 0f, 0f)), new Item("C3", 0, new Vector3(0f, 2.085648f, 2.3f), new Vector3(0f, 0f, 0f)), new Item("C3", 0, new Vector3(0f, 2.085648f, 2.8f), new Vector3(0f, 0f, 0f)), new Item("C3", 0, new Vector3(0.037542f, 2.091974f, -0.770876f), new Vector3(0f, 0f, 0f)), new Item("C2", 0, new Vector3(0.028199f, 2.171409f, -1.501321f), new Vector3(0f, 90f, 0f)), new Item("C3", 1, new Vector3(-0.501618f, 2.185535f, -1.0432f), new Vector3(0f, -5f, -20f)), new Item("C3", 1, new Vector3(-0.506264f, 2.187838f, -1.545157f), new Vector3(0f, -5f, -20f)), new Item("C3", 1, new Vector3(0.485456f, 2.241671f, -0.719952f), new Vector3(0f, 90f, 0f)), new Item("C3", 1, new Vector3(-0.6f, 2.273668f, 1.82f), new Vector3(0f, 0f, 0f)), new Item("C3", 1, new Vector3(-0.6f, 2.273668f, 2.28f), new Vector3(0f, 0f, 0f)), new Item("C3", 1, new Vector3(-0.6f, 2.273668f, 2.74f), new Vector3(0f, 0f, 0f)), new Item("C3", 1, new Vector3(0.6f, 2.273668f, 1.82f), new Vector3(0f, 0f, 0f)), new Item("C3", 1, new Vector3(0.6f, 2.273668f, 2.28f), new Vector3(0f, 0f, 0f)), new Item("C3", 2, new Vector3(0.6f, 2.273668f, 2.74f), new Vector3(0f, 0f, 0f)), new Item("C1", 2, new Vector3(-0.074239f, 2.293547f, 0.966045f), new Vector3(0f, 0f, 0f)), new Item("C3", 2, new Vector3(0.728007f, 2.337125f, -0.053276f), new Vector3(0f, 0f, 0f)), new Item("C3", 2, new Vector3(0.78995f, 2.367833f, -1.481687f), new Vector3(0f, 0f, 0f)), new Item("C3", 2, new Vector3(-0.80222f, 2.373916f, 0.322657f), new Vector3(0f, 0f, 0f)), new Item("C3", 2, new Vector3(0.822187f, 2.383814f, 1.270398f), new Vector3(0f, 0f, 0f)), new Item("C0", 2, new Vector3(0.001257f, 2.435399f, -0.030828f), new Vector3(0f, 0f, 0f)), new Item("B2", 2, new Vector3(-0.698615f, 2.447299f, 0.874274f), new Vector3(90f, 0f, 0f)), new Item("C2", 2, new Vector3(-0.772008f, 2.479388f, -0.400317f), new Vector3(0f, 0f, 0f)), new Item("C3", 3, new Vector3(0.944566f, 2.480888f, 0.718383f), new Vector3(0f, 4f, 18f)), new Item("C2", 3, new Vector3(0.05425f, 2.577409f, -1.542428f), new Vector3(0f, 0f, 0f)), new Item("B2", 3, new Vector3(0.918544f, 2.692822f, -0.736052f), new Vector3(0f, 0f, 0f)), new Item("B1", 3, new Vector3(0.911868f, 2.810961f, 0.03044f), new Vector3(90f, 0f, 0f)), new Item("C3", 3, new Vector3(-0.624844f, 2.818299f, 0.847646f), new Vector3(0f, 0f, 0f)), new Item("C3", 3, new Vector3(-1.253744f, 2.886257f, 0.80346f), new Vector3(0f, 90f, 0f)), new Item("C1", 3, new Vector3(1.000602f, 2.909216f, -1.361584f), new Vector3(0f, 0f, 0f)), new Item("C3", 3, new Vector3(0.248619f, 2.918409f, -1.314897f), new Vector3(0f, 90f, 0f)), new Item("C0", 3, new Vector3(-0.768283f, 2.940938f, -1.177795f), new Vector3(0f, 0f, 0f)), new Item("B0", 3, new Vector3(-0.6f, 2.974668f, 2.2825f), new Vector3(90f, 0f, 0f)), new Item("B0", 3, new Vector3(0.6f, 2.974668f, 2.2825f), new Vector3(90f, 0f, 0f)), new Item("C3", 3, new Vector3(1.344168f, 2.977557f, -0.652351f), new Vector3(9f, 0f, 12f)), new Item("C3", 4, new Vector3(-0.564099f, 3.094299f, 0.945655f), new Vector3(0f, 0f, 0f)), new Item("C0", 4, new Vector3(0.921673f, 3.113223f, 1.039159f), new Vector3(0f, 0f, 12f)), new Item("C1", 4, new Vector3(0.132981f, 3.161399f, 0.076067f), new Vector3(0f, 0f, 0f)), new Item("C1", 4, new Vector3(0.161551f, 3.161399f, -0.750351f), new Vector3(0f, 0f, 0f)), new Item("C3", 4, new Vector3(-1.196226f, 3.208182f, 0.832805f), new Vector3(0f, 4f, 18f)), new Item("C0", 4, new Vector3(-0.888425f, 3.22019f, 0.11215f), new Vector3(0f, 0f, 12f)), new Item("C2", 4, new Vector3(0.985871f, 3.346961f, -0.466688f), new Vector3(0f, 90f, 0f)), new Item("C2", 4, new Vector3(0.902544f, 3.410216f, -1.315114f), new Vector3(0f, 90f, 0f)), new Item("C1", 4, new Vector3(0.897206f, 3.441961f, 0.188234f), new Vector3(0f, 0f, 0f)), new Item("C2", 4, new Vector3(-0.64748f, 3.571938f, -1.514736f), new Vector3(0f, 90f, 0f)), new Item("C3", 4, new Vector3(0.198197f, 3.597399f, -1.247129f), new Vector3(0f, 90f, 0f)), new Item("C1", 4, new Vector3(-0.686659f, 3.666938f, -0.88769f), new Vector3(0f, 0f, 0f)), new Item("C3", 4, new Vector3(-0.48571f, 3.675668f, 1.375775f), new Vector3(0f, 0f, 0f)), new Item("C3", 5, new Vector3(0.708007f, 3.679542f, 0.81528f), new Vector3(9f, 0f, 12f)), new Item("B2", 5, new Vector3(0.189462f, 3.684415f, 1.059685f), new Vector3(90f, 7f, 0f)), new Item("C3", 5, new Vector3(0.999263f, 3.687961f, -0.71348f), new Vector3(0f, 0f, 0f)), new Item("C2", 5, new Vector3(-0.6f, 3.740668f, 1.87f), new Vector3(0f, 0f, 0f)), new Item("C2", 5, new Vector3(0.6f, 3.740668f, 1.87f), new Vector3(0f, 0f, 0f)), new Item("C3", 5, new Vector3(0.703326f, 3.751216f, -1.324617f), new Vector3(0f, 0f, 0f)), new Item("C1", 5, new Vector3(0.006523f, 3.757399f, 0.19602f), new Vector3(0f, 0f, 0f)), new Item("C1", 5, new Vector3(0.282072f, 3.757399f, -0.660297f), new Vector3(0f, 7f, 0f)), new Item("C3", 5, new Vector3(0.774243f, 3.877961f, 0.318136f), new Vector3(0f, 0f, 0f)), new Item("C2", 5, new Vector3(-0.860955f, 3.910704f, 0.045241f), new Vector3(9f, 0f, 12f)), new Item("C3", 5, new Vector3(0.894317f, 3.963961f, -0.412646f), new Vector3(0f, 0f, 0f)), new Item("C3", 6, new Vector3(0.60534f, 3.998934f, 0.882707f), new Vector3(0f, 0f, 0f)), new Item("C3", 6, new Vector3(0.730858f, 4.153961f, 0.204194f), new Vector3(0f, 0f, 0f)), new Item("C2", 6, new Vector3(-0.649471f, 4.167938f, -0.508096f), new Vector3(0f, 90f, 0f)), new Item("C2", 6, new Vector3(-0.572973f, 4.167938f, -1.043729f), new Vector3(0f, 0f, 0f)), new Item("C2", 6, new Vector3(0.157509f, 4.258399f, 0.438657f), new Vector3(0f, 0f, 0f)), new Item("C2", 6, new Vector3(0.166921f, 4.258399f, -0.096315f), new Vector3(0f, 90f, 0f)), new Item("C2", 6, new Vector3(-0.37065f, 4.300595f, 0.216939f), new Vector3(0f, 0f, 0f)) }; internal static readonly float[] CoverHeights = new float[1225] { 3.1763926f, 3.375616f, 3.5645561f, 3.7358866f, 3.8757343f, 3.9606285f, 3.9741154f, 3.9741154f, 3.9741154f, 3.9741154f, 3.9741154f, 3.9659324f, 3.9577494f, 3.9495666f, 3.9413836f, 3.9332006f, 3.9250176f, 3.9168346f, 3.9086518f, 3.9004688f, 3.808018f, 3.610553f, 3.3965926f, 3.1782126f, 2.9580643f, 3.2335808f, 3.443189f, 3.6463807f, 3.8375258f, 4.003469f, 4.113334f, 4.1318965f, 4.1318965f, 4.1318965f, 4.1318965f, 4.1318965f, 4.122682f, 4.113468f, 4.104254f, 4.09504f, 4.0858254f, 4.0766115f, 4.067397f, 4.058183f, 4.048969f, 3.8592188f, 3.6486905f, 3.4349265f, 3.2167017f, 2.9968095f, 3.2735107f, 3.491105f, 3.705957f, 3.9152079f, 4.1104956f, 4.2602453f, 4.2896776f, 4.2896776f, 4.2896776f, 4.2896776f, 4.2896776f, 4.2773f, 4.2649217f, 4.2525434f, 4.2401657f, 4.2277875f, 4.2154093f, 4.2030315f, 4.1463103f, 4.0895896f, 3.898106f, 3.6868277f, 3.4732606f, 3.2551908f, 3.035555f, 3.2945147f, 3.5165863f, 3.7382793f, 3.9591558f, 4.1776996f, 4.3834653f, 4.447459f, 4.447459f, 4.447459f, 4.447459f, 4.447459f, 4.4341526f, 4.420846f, 4.407539f, 4.3942323f, 4.380926f, 4.3676195f, 4.3543124f, 4.2422614f, 4.1302104f, 3.9369931f, 3.724965f, 3.5115945f, 3.29368f, 3.0743003f, 3.30581f, 3.5278933f, 3.7496035f, 3.970508f, 4.1909366f, 4.4113655f, 4.5351152f, 4.5351152f, 4.5351152f, 4.5351152f, 4.5351152f, 4.526523f, 4.5179305f, 4.5093384f, 4.500746f, 4.4921536f, 4.483561f, 4.474969f, 4.3229f, 4.1708307f, 3.9758801f, 3.7631025f, 3.5499287f, 3.332169f, 3.1130457f, 3.317105f, 3.5392003f, 3.760928f, 3.98186f, 4.202231f, 4.4226017f, 4.543482f, 4.543482f, 4.543482f, 4.543482f, 4.543482f, 4.5362835f, 4.5290847f, 4.5218863f, 4.514688f, 4.507489f, 4.500291f, 4.493092f, 4.352272f, 4.2114515f, 4.014767f, 3.8015149f, 3.5882626f, 3.3706582f, 3.151791f, 3.3284004f, 3.5505073f, 3.772252f, 3.993212f, 4.213525f, 4.433838f, 4.5518484f, 4.5518484f, 4.5518484f, 4.5518484f, 4.5518484f, 4.546044f, 4.5402393f, 4.5344343f, 4.52863f, 4.522825f, 4.51702f, 4.5112157f, 4.381644f, 4.2520723f, 4.053654f, 3.8401256f, 3.6265965f, 3.4091473f, 3.1905363f, 3.3396957f, 3.5618143f, 3.7835765f, 4.0045643f, 4.224819f, 4.445074f, 4.5602155f, 4.5602155f, 4.5602155f, 4.5602155f, 4.5602155f, 4.5558043f, 4.5513935f, 4.5469823f, 4.5425715f, 4.538161f, 4.5337496f, 4.529339f, 4.411016f, 4.292693f, 4.0925417f, 3.878736f, 3.6649306f, 3.4476364f, 3.2292817f, 3.3509908f, 3.5731213f, 3.794901f, 4.0159163f, 4.236113f, 4.4563103f, 4.568582f, 4.568582f, 4.568582f, 4.568582f, 4.568582f, 4.5655646f, 4.5625477f, 4.5595307f, 4.5565133f, 4.5534964f, 4.5504794f, 4.547462f, 4.4403877f, 4.3333135f, 4.1314287f, 3.9173467f, 3.7032645f, 3.4861255f, 3.2680268f, 3.362286f, 3.584428f, 3.8062253f, 4.0272684f, 4.2474074f, 4.4675465f, 4.5769486f, 4.5769486f, 4.5769486f, 4.5769486f, 4.5769486f, 4.5753255f, 4.573702f, 4.5720787f, 4.5704556f, 4.568832f, 4.567209f, 4.5655856f, 4.46976f, 4.3739343f, 4.1703157f, 3.9559572f, 3.7415986f, 3.5246146f, 3.3067722f, 3.3735814f, 3.595735f, 3.8175495f, 4.0386205f, 4.2587013f, 4.4787827f, 4.585315f, 4.585315f, 4.585315f, 4.585315f, 4.585315f, 4.585086f, 4.5848565f, 4.5846267f, 4.5843973f, 4.584168f, 4.583938f, 4.583709f, 4.4991317f, 4.414555f, 4.209203f, 3.9945676f, 3.7799325f, 3.5631037f, 3.3455176f, 3.3848765f, 3.607042f, 3.8288739f, 4.0499725f, 4.2699957f, 4.490019f, 4.593682f, 4.5945873f, 4.5954933f, 4.596399f, 4.5973043f, 4.59821f, 4.5991154f, 4.600021f, 4.6009264f, 4.6018324f, 4.6018324f, 4.6018324f, 4.528504f, 4.4551754f, 4.24809f, 4.0331783f, 3.8182664f, 3.6015928f, 3.3842628f, 3.3961718f, 3.618349f, 3.840198f, 4.0613246f, 4.2812896f, 4.501255f, 4.6020484f, 4.6040382f, 4.606028f, 4.6080174f, 4.6100073f, 4.611997f, 4.6139865f, 4.6159763f, 4.6179657f, 4.6199555f, 4.6199555f, 4.6199555f, 4.5629597f, 4.495796f, 4.286977f, 4.071789f, 3.8566005f, 3.640082f, 3.4230082f, 3.407467f, 3.629656f, 3.8515224f, 4.0726767f, 4.292584f, 4.512491f, 4.610415f, 4.613498f, 4.616581f, 4.619664f, 4.622747f, 4.62583f, 4.628913f, 4.6319957f, 4.635079f, 4.6380787f, 4.6380787f, 4.6380787f, 4.600082f, 4.536417f, 4.3258643f, 4.1103992f, 3.8949344f, 3.678571f, 3.459896f, 3.4187622f, 3.640963f, 3.8628469f, 4.0840287f, 4.303878f, 4.5237274f, 4.618782f, 4.623272f, 4.627762f, 4.632252f, 4.636742f, 4.641232f, 4.645722f, 4.6502123f, 4.654702f, 4.6562023f, 4.6562023f, 4.6562023f, 4.6372037f, 4.577038f, 4.3647513f, 4.1438136f, 3.9218068f, 3.699461f, 3.4769647f, 3.4300575f, 3.6522698f, 3.874171f, 4.095381f, 4.315172f, 4.5349636f, 4.6271486f, 4.6330457f, 4.6389427f, 4.64484f, 4.650737f, 4.6566343f, 4.6625314f, 4.6684284f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.5918255f, 4.3690753f, 4.1463256f, 3.9235754f, 3.7008255f, 3.4780755f, 3.4413526f, 3.6635768f, 3.8854954f, 4.1067324f, 4.326466f, 4.5462f, 4.635515f, 4.6403666f, 4.645218f, 4.650069f, 4.6549206f, 4.659772f, 4.664623f, 4.669474f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.5918255f, 4.3690753f, 4.1463256f, 3.9235754f, 3.7008255f, 3.4780755f, 3.452648f, 3.6748838f, 3.8968196f, 4.118085f, 4.3377604f, 4.5574365f, 4.643882f, 4.6476874f, 4.6514926f, 4.655298f, 4.659104f, 4.662909f, 4.6667147f, 4.6705203f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.5918255f, 4.3690753f, 4.1463256f, 3.9235754f, 3.7008255f, 3.4780755f, 3.4639432f, 3.6861908f, 3.908144f, 4.129437f, 4.349055f, 4.5686727f, 4.6522484f, 4.6550083f, 4.657768f, 4.660527f, 4.663287f, 4.6660466f, 4.668806f, 4.671566f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.5918255f, 4.3690753f, 4.1463256f, 3.9235754f, 3.7008255f, 3.4780755f, 3.4752383f, 3.6974978f, 3.9194684f, 4.140789f, 4.3603487f, 4.579909f, 4.660615f, 4.662329f, 4.664043f, 4.6657567f, 4.6674705f, 4.669184f, 4.670898f, 4.6726117f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.5918255f, 4.3690753f, 4.1463256f, 3.9235754f, 3.7008255f, 3.4780755f, 3.4865336f, 3.7088048f, 3.9307928f, 4.152141f, 4.371643f, 4.591145f, 4.668982f, 4.66965f, 4.6703176f, 4.6709857f, 4.6716537f, 4.672322f, 4.6729894f, 4.6736574f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.6743255f, 4.5918255f, 4.3690753f, 4.1463256f, 3.9235754f, 3.7008255f, 3.4780755f, 3.497829f, 3.7201116f, 3.942117f, 4.1634927f, 4.382937f, 4.602381f, 4.6773486f, 4.6773486f, 4.6773486f, 4.6773486f, 4.6773486f, 4.6769705f, 4.676593f, 4.6762147f, 4.675837f, 4.6754594f, 4.6750813f, 4.6747036f, 4.6743255f, 4.5918255f, 4.3690753f, 4.1463256f, 3.9235754f, 3.7008255f, 3.4780755f, 3.509124f, 3.7314186f, 3.9534414f, 4.174845f, 4.394262f, 4.6136174f, 4.685715f, 4.685715f, 4.685715f, 4.685715f, 4.685715f, 4.6836996f, 4.6816835f, 4.679668f, 4.677652f, 4.6756363f, 4.6736207f, 4.6716046f, 4.6694527f, 4.581201f, 4.3607154f, 4.138512f, 3.9163086f, 3.6941054f, 3.4719021f, 3.5204194f, 3.7427256f, 3.9647655f, 4.186197f, 4.4056597f, 4.6248536f, 4.694082f, 4.694082f, 4.694082f, 4.694082f, 4.694082f, 4.690482f, 4.6868825f, 4.683283f, 4.679683f, 4.6760836f, 4.672484f, 4.6688843f, 4.66458f, 4.5705767f, 4.352355f, 4.1301537f, 3.9079528f, 3.685752f, 3.4635508f, 3.5317147f, 3.7540326f, 3.97609f, 4.197549f, 4.417058f, 4.63609f, 4.7024484f, 4.7024484f, 4.7024484f, 4.7024484f, 4.7024484f, 4.697265f, 4.6920815f, 4.6868978f, 4.681714f, 4.676531f, 4.671347f, 4.6661634f, 4.659707f, 4.5599523f, 4.3439946f, 4.1217957f, 3.899597f, 3.6773982f, 3.4551995f, 3.5430098f, 3.7653396f, 3.9874141f, 4.2089014f, 4.428456f, 4.647326f, 4.7108154f, 4.7108154f, 4.7108154f, 4.7108154f, 4.7108154f, 4.7040477f, 4.6972804f, 4.6905127f, 4.6837454f, 4.6769776f, 4.6702104f, 4.6634426f, 4.654834f, 4.549328f, 4.335634f, 4.1134377f, 3.891241f, 3.6690445f, 3.446848f, 3.554305f, 3.7766466f, 3.9987385f, 4.220253f, 4.4398537f, 4.658562f, 4.719182f, 4.719182f, 4.719182f, 4.719182f, 4.719182f, 4.7108307f, 4.702479f, 4.6941276f, 4.685776f, 4.677425f, 4.6690736f, 4.660722f, 4.649961f, 4.538703f, 4.327274f, 4.1050797f, 3.8828852f, 3.6606908f, 3.4384966f, 3.5560486f, 3.7787986f, 4.001549f, 4.2242985f, 4.4470487f, 4.6697984f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.717613f, 4.707678f, 4.6977425f, 4.687807f, 4.6778717f, 4.667937f, 4.6580014f, 4.645088f, 4.528079f, 4.3189135f, 4.096721f, 3.8745294f, 3.6523373f, 3.4301453f, 3.5560486f, 3.7787986f, 4.001549f, 4.2242985f, 4.4470487f, 4.6697984f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7172246f, 4.7069006f, 4.6965766f, 4.6862526f, 4.6759286f, 4.6656046f, 4.6552806f, 4.6402154f, 4.517454f, 4.310553f, 4.088363f, 3.8661735f, 3.6439836f, 3.421794f, 3.5560486f, 3.7787986f, 4.001549f, 4.2242985f, 4.4470487f, 4.6697984f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.716836f, 4.7061234f, 4.6954107f, 4.684698f, 4.673985f, 4.6632724f, 4.6525598f, 4.6353426f, 4.5068297f, 4.3021927f, 4.080005f, 3.8578176f, 3.63563f, 3.4134426f, 3.5560486f, 3.7787986f, 4.001549f, 4.2242985f, 4.4470487f, 4.6697984f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7164474f, 4.705346f, 4.6942444f, 4.683143f, 4.672042f, 4.6609406f, 4.6498394f, 4.63047f, 4.4962053f, 4.2938323f, 4.071647f, 3.8494618f, 3.6272764f, 3.405091f, 3.5560486f, 3.7787986f, 4.001549f, 4.2242985f, 4.4470487f, 4.6697984f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7160587f, 4.7045684f, 4.6930785f, 4.6815886f, 4.6700983f, 4.6586084f, 4.6471186f, 4.625597f, 4.485581f, 4.285472f, 4.0632887f, 3.8411057f, 3.6189227f, 3.3967397f, 3.5560486f, 3.7787986f, 4.001549f, 4.2242985f, 4.4470487f, 4.6697984f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.7275486f, 4.71567f, 4.703791f, 4.6919127f, 4.6800337f, 4.668155f, 4.6562767f, 4.6443977f, 4.6207237f, 4.4749565f, 4.2771115f, 4.0549307f, 3.83275f, 3.610569f, 3.3883884f, 3.5485196f, 3.7695172f, 3.989461f, 4.207012f, 4.422554f, 4.6380954f, 4.6917205f, 4.6917205f, 4.6917205f, 4.6917205f, 4.6917205f, 4.6845713f, 4.6774225f, 4.6702733f, 4.663124f, 4.6559753f, 4.648826f, 4.641677f, 4.615851f, 4.464332f, 4.268751f, 4.0465727f, 3.824394f, 3.6022155f, 3.3800368f, 3.5236416f, 3.744664f, 3.964695f, 4.182367f, 4.3968873f, 4.6063924f, 4.6558924f, 4.6558924f, 4.6558924f, 4.6558924f, 4.6558924f, 4.653473f, 4.6510534f, 4.6486344f, 4.6462145f, 4.6437955f, 4.641376f, 4.6389565f, 4.610978f, 4.4537077f, 4.2603908f, 4.0382147f, 3.8160381f, 3.5938618f, 3.3716855f, 3.4987638f, 3.7198105f, 3.939929f, 4.157721f, 4.3718066f, 4.5746894f, 4.6200647f, 4.6218615f, 4.623658f, 4.625455f, 4.6272516f, 4.6290483f, 4.630845f, 4.6326423f, 4.634439f, 4.6362357f, 4.6362357f, 4.6362357f, 4.6061053f, 4.4430833f, 4.2520304f, 4.029856f, 3.8076823f, 3.5855083f, 3.3633342f, 3.473886f, 3.6949573f, 3.9151633f, 4.133075f, 4.3467264f, 4.5429864f, 4.5842366f, 4.5897117f, 4.595187f, 4.6006627f, 4.606138f, 4.6116133f, 4.617089f, 4.6225643f, 4.62804f, 4.633515f, 4.633515f, 4.633515f, 4.6012325f, 4.432459f, 4.24367f, 4.021498f, 3.7993264f, 3.5771546f, 3.3549829f, 3.449008f, 3.6701038f, 3.8903973f, 4.1084294f, 4.3216457f, 4.5112834f, 4.5484085f, 4.5575624f, 4.566716f, 4.5758705f, 4.5850244f, 4.594178f, 4.6033325f, 4.6124864f, 4.62164f, 4.6307945f, 4.6307945f, 4.6307945f, 4.5963597f, 4.421834f, 4.2353096f, 4.01314f, 3.7909706f, 3.568801f, 3.3466313f, 3.4241302f, 3.6452503f, 3.8656313f, 4.0837836f, 4.296565f, 4.4795804f, 4.5125804f, 4.525413f, 4.5382457f, 4.5510783f, 4.5639105f, 4.576743f, 4.589576f, 4.6024084f, 4.615241f, 4.6280737f, 4.6280737f, 4.6280737f, 4.5914865f, 4.4112096f, 4.226949f, 4.004782f, 3.7826147f, 3.5604475f, 3.33828f, 3.3992524f, 3.620397f, 3.8408654f, 4.059138f, 4.2714844f, 4.4478774f, 4.4767523f, 4.4932637f, 4.5097747f, 4.526286f, 4.542797f, 4.559308f, 4.5758195f, 4.5923305f, 4.608842f, 4.625353f, 4.625353f, 4.625353f, 4.5866137f, 4.4026012f, 4.2185893f, 3.996424f, 3.7742589f, 3.5520937f, 3.3299286f, 3.3743746f, 3.5955436f, 3.8160994f, 4.034492f, 4.2464037f, 4.4161744f, 4.440924f, 4.461114f, 4.4813037f, 4.501494f, 4.521683f, 4.541873f, 4.5620627f, 4.5822525f, 4.6024423f, 4.622632f, 4.622632f, 4.622632f, 4.581741f, 4.3959846f, 4.210229f, 3.988066f, 3.765903f, 3.54374f, 3.3215773f, 3.3494968f, 3.5706904f, 3.7913337f, 4.009846f, 4.221323f, 4.3844714f, 4.4080153f, 4.4315596f, 4.4551034f, 4.478647f, 4.5021915f, 4.5257354f, 4.5492797f, 4.5728235f, 4.5963674f, 4.6199117f, 4.6199117f, 4.6199117f, 4.576868f, 4.389368f, 4.2018685f, 3.9797077f, 3.7575471f, 3.5353866f, 3.313226f, 3.3246188f, 3.545837f, 3.7665677f, 3.9852006f, 4.196243f, 4.3527684f, 4.3792105f, 4.405653f, 4.432095f, 4.458537f, 4.4849796f, 4.5114217f, 4.537864f, 4.5643063f, 4.5907483f, 4.617191f, 4.617191f, 4.617191f, 4.5719953f, 4.3827515f, 4.193508f, 3.9713497f, 3.7491913f, 3.5270329f, 3.3048744f, 3.299741f, 3.5209835f, 3.7418017f, 3.9605548f, 4.171162f, 4.3210654f, 4.3504057f, 4.3797464f, 4.4090867f, 4.438427f, 4.4677677f, 4.497108f, 4.5264487f, 4.555789f, 4.5851297f, 4.61447f, 4.61447f, 4.61447f, 4.5671225f, 4.376135f, 4.185148f, 3.9629915f, 3.7408354f, 3.5186791f, 3.296523f, 3.2748632f, 3.49613f, 3.717036f, 3.935909f, 4.1460814f, 4.2893624f, 4.321601f, 4.35384f, 4.3860784f, 4.4183173f, 4.450556f, 4.482795f, 4.5150332f, 4.547272f, 4.5795107f, 4.611749f, 4.611749f, 4.611749f, 4.562249f, 4.3695183f, 4.1767874f, 3.9546335f, 3.7324796f, 3.5103257f, 3.2881718f, 3.2499855f, 3.4712768f, 3.6922698f, 3.9112632f, 4.121001f, 4.2576594f, 4.2892528f, 4.320846f, 4.3524394f, 4.3840327f, 4.415626f, 4.4472194f, 4.478813f, 4.5104065f, 4.542f, 4.573593f, 4.573593f, 4.573593f, 4.54925f, 4.3588386f, 4.168427f, 3.9462752f, 3.7241237f, 3.501972f, 3.2798202f, 3.2251074f, 3.4464233f, 3.667504f, 3.8866174f, 4.09592f, 4.225956f, 4.245557f, 4.2651577f, 4.2847586f, 4.3043594f, 4.3239603f, 4.343561f, 4.3631616f, 4.3827624f, 4.4023633f, 4.421964f, 4.421964f, 4.421964f, 4.409656f, 4.284861f, 4.1600666f, 3.9379172f, 3.7157679f, 3.4936185f, 3.271469f, 3.2002296f, 3.42157f, 3.642738f, 3.8619716f, 4.07084f, 4.1444874f, 4.157072f, 4.169657f, 4.182242f, 4.1948266f, 4.2074113f, 4.219996f, 4.2325807f, 4.245166f, 4.2577505f, 4.270335f, 4.270335f, 4.270335f, 4.264181f, 4.225956f, 4.151706f, 3.929559f, 3.707412f, 3.4852648f, 3.2631176f, 3.1753519f, 3.3907075f, 3.6008587f, 3.7980683f, 3.952708f, 3.9867063f, 4.001373f, 4.0160394f, 4.0307064f, 4.045373f, 4.0600395f, 4.074706f, 4.089373f, 4.1040397f, 4.118706f, 4.118706f, 4.118706f, 4.118706f, 4.118706f, 4.118706f, 4.0955124f, 3.9101849f, 3.695256f, 3.4757504f, 3.2547662f }; internal static Vector3 Size(string kind) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0115: 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_013f: Unknown result type (might be due to invalid IL or missing references) return (Vector3)(kind switch { "C0" => new Vector3(1.02f, 0.85f, 0.96f), "C1" => new Vector3(0.76f, 0.59f, 0.73f), "C2" => new Vector3(0.52f, 0.4f, 0.53f), "C3" => new Vector3(0.34f, 0.27f, 0.44f), "B0" => new Vector3(1.12f, 1.47f, 1.12f), "B1" => new Vector3(0.66f, 0.865f, 0.66f), "B2" => new Vector3(0.46f, 0.603f, 0.46f), _ => throw new ArgumentException(kind), }); } } [BepInPlugin("greypoint.loxwagon", "LoxWagon", "0.7.3")] public sealed class HaldorWagonPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class RegisterNetworkPrefab { private static void Postfix(ZNetScene __instance) { try { if ((Object)(object)_prefab == (Object)null) { _prefab = CreatePrefab(__instance); } if (!((Object)(object)_prefab == (Object)null)) { if (!__instance.m_prefabs.Contains(_prefab)) { __instance.m_prefabs.Add(_prefab); } ((Dictionary<int, GameObject>)AccessTools.Field(typeof(ZNetScene), "m_namedPrefabs").GetValue(__instance))[StringExtensionMethods.GetStableHashCode("greypoint_LoxWagon")] = _prefab; PatchBeasts(); RegisterBuildPiece(ObjectDB.instance); } } catch (Exception ex) { Log.LogError((object)("Network prefab registration failed: " + ex)); } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class FinishBuildRegistration { private static void Postfix() { RegisterBuildPiece(ObjectDB.instance); } } [HarmonyPatch(typeof(Player), "PlacePiece")] private static class ActivatePlacedWagon { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return InsertActivation(instructions, "Player.PlacePiece"); } } [HarmonyPatch(typeof(ZNetScene), "CreateObject")] private static class ActivateLoadedWagon { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { return InsertActivation(instructions, "ZNetScene.CreateObject"); } } [HarmonyPatch(typeof(ObjectDB), "Awake")] private static class RegisterHammerPiece { private static void Postfix(ObjectDB __instance) { RegisterBuildPiece(__instance); } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] private static class RegisterHammerPieceAfterCopy { private static void Postfix(ObjectDB __instance) { RegisterBuildPiece(__instance); } } [HarmonyPatch(typeof(Vagon), "CanAttach")] private static class LoxAttachmentCheck { private static void Postfix(Vagon __instance, GameObject go, ref bool __result) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)__instance).GetComponent<LoxWagonController>() == (Object)null) { return; } Character val = (((Object)(object)go != (Object)null) ? go.GetComponent<Character>() : null); if (AllowHumanPulling.Value) { __result = __result && val is Player; if (!__result) { ((Component)__instance).GetComponent<LoxWagonController>().LogCheckFailure(go); } } else { __result = (Object)(object)val != (Object)null && val.IsTamed() && !val.IsDead() && Utils.GetPrefabName(go) == "Lox" && (Object)(object)go.GetComponent<Rigidbody>() != (Object)null && ((Component)__instance).transform.up.y >= 0.1f && Vector3.Distance(go.transform.TransformPoint(__instance.m_attachOffset), __instance.m_attachPoint.position) < __instance.m_detachDistance; if (!__result) { ((Component)__instance).GetComponent<LoxWagonController>().LogCheckFailure(go); } } } } [HarmonyPatch(typeof(Vagon), "Detach")] private static class TraceDetach { private static void Prefix(Vagon __instance) { LoxWagonController component = ((Component)__instance).GetComponent<LoxWagonController>(); if ((Object)(object)component != (Object)null) { component.LogDetach(); component.ReleaseCollisionPairs(); } } } [HarmonyPatch(typeof(ImpactEffect), "OnCollisionEnter")] private static class NoWagonImpactDamage { private static bool Prefix(ImpactEffect __instance, Collision info) { if ((Object)(object)((Component)__instance).GetComponentInParent<LoxWagonController>() == (Object)null) { if (info != null && !((Object)(object)info.collider == (Object)null)) { return (Object)(object)((Component)info.collider).GetComponentInParent<LoxWagonController>() == (Object)null; } return true; } return false; } } [HarmonyPatch(typeof(Player), "FindHoverObject")] private static class IncludeWagonTriggers { private static void Postfix(ref GameObject hover) { if ((Object)(object)hover == (Object)null || (Object)(object)hover.GetComponent<WagonHotspot>() != (Object)null || (Object)(object)hover.GetComponent<WagonSeat>() != (Object)null) { return; } LoxWagonController componentInParent = hover.GetComponentInParent<LoxWagonController>(); if (!((Object)(object)componentInParent == (Object)null)) { if ((Object)(object)hover != (Object)(object)((Component)componentInParent).gameObject) { hover = null; return; } Transform val = ((Component)componentInParent).transform.Find("CargoAccess-1"); hover = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null); } } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { MethodInfo original = AccessTools.Method(typeof(Physics), "RaycastNonAlloc", new Type[5] { typeof(Vector3), typeof(Vector3), typeof(RaycastHit[]), typeof(float), typeof(int) }, (Type[])null); foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.Calls(instruction, original)) { instruction.operand = AccessTools.Method(typeof(HaldorWagonPlugin), "RaycastWithWagonTriggers", (Type[])null, (Type[])null); } yield return instruction; } } } [HarmonyPatch(typeof(Vagon), "SetMass")] private static class ReportWagonMass { private static void Postfix(Vagon __instance, float __0) { LoxWagonController component = ((Component)__instance).GetComponent<LoxWagonController>(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { component.ReportMass(__0); } } } [HarmonyPatch(typeof(Vagon), "UpdateAudio")] private static class CleanWheelAudioReferences { private static void Prefix(Vagon __instance) { if ((Object)(object)((Component)__instance).GetComponent<LoxWagonController>() == (Object)null) { return; } if (__instance.m_wheels == null) { __instance.m_wheels = (Rigidbody[])(object)new Rigidbody[0]; } else if (__instance.m_wheels.Any((Rigidbody w) => (Object)(object)w == (Object)null)) { __instance.m_wheels = __instance.m_wheels.Where((Rigidbody w) => (Object)(object)w != (Object)null).ToArray(); } } } [HarmonyPatch(typeof(Hud), "SetupPieceInfo")] private static class EnsureRecipeDisplaySlots { private static readonly FieldInfo Slots = AccessTools.Field(typeof(Hud), "m_requirementItems"); private static void Prefix(Hud __instance, Piece piece) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)piece == (Object)null || (Object)(object)((Component)piece).GetComponent<LoxWagonController>() == (Object)null) { return; } GameObject[] array = (GameObject[])Slots.GetValue(__instance); int num = piece.m_resources.Length + (((Object)(object)piece.m_craftingStation != (Object)null) ? 1 : 0); if (array == null || array.Length == 0 || array.Length >= num) { return; } List<GameObject> list = new List<GameObject>(array); GameObject val = array[^1]; RectTransform component = val.GetComponent<RectTransform>(); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, -40f); if (array.Length > 1 && (Object)(object)component != (Object)null) { RectTransform component2 = array[^2].GetComponent<RectTransform>(); if ((Object)(object)component2 != (Object)null) { val2 = component.anchoredPosition - component2.anchoredPosition; } } while (list.Count < num) { GameObject val3 = Object.Instantiate<GameObject>(val, val.transform.parent, false); ((Object)val3).name = "LoxWagonRequirement" + list.Count; RectTransform component3 = val3.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null && (Object)(object)component3 != (Object)null) { component3.anchoredPosition = component.anchoredPosition + val2 * (float)(list.Count - array.Length + 1); } val3.SetActive(false); list.Add(val3); } Slots.SetValue(__instance, list.ToArray()); Log.LogInfo((object)("Expanded recipe display slots to " + num)); } } [HarmonyPatch(typeof(Vagon), "Interact")] private static class BlockHandPull { private static bool Prefix(Vagon __instance, Humanoid character, bool hold, ref bool __result) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) LoxWagonController component = ((Component)__instance).GetComponent<LoxWagonController>(); if ((Object)(object)component == (Object)null) { return true; } if (AllowHumanPulling.Value) { if (!(character is Player)) { __result = false; return false; } __instance.m_attachOffset = new Vector3(0f, 0.8f, 0f); __instance.m_detachDistance = 2f; if (!hold) { component.BeginHumanTrace(character); } return true; } __result = component.Interact(character, hold); return false; } } [HarmonyPatch(typeof(Vagon), "GetHoverText")] private static class HitchHoverText { private static bool Prefix(Vagon __instance, ref string __result) { if ((Object)(object)((Component)__instance).GetComponent<LoxWagonController>() == (Object)null) { return true; } __result = Localization.instance.Localize("Wagon\n[<color=yellow><b>$KEY_Use</b></color>] " + ((!__instance.IsAttached()) ? (AllowHumanPulling.Value ? "Pull wagon" : "Attach Lox") : (AllowHumanPulling.Value ? "Detach player" : "Detach Lox"))); return false; } } internal const string PrefabName = "greypoint_LoxWagon"; internal static ManualLogSource Log; private Harmony _harmony; internal static ConfigEntry<bool> AllowHumanPulling; internal static ConfigEntry<float> CargoMassScale; internal static ConfigEntry<float> BaseChassisMass; private static GameObject _prefab; private static bool _beastsPatched; private void Awake() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); IDictionary dictionary = ((propertyInfo != null) ? (propertyInfo.GetValue(((BaseUnityPlugin)this).Config, null) as IDictionary) : null); if (dictionary != null) { dictionary.Remove((object)new ConfigDefinition("Diagnostics", "HumanPullTest")); dictionary.Remove((object)new ConfigDefinition("Diagnostics", "ArticulatedChassisTest")); } AllowHumanPulling = ((BaseUnityPlugin)this).Config.Bind<bool>("Wagon", "AllowHumanPulling", false, "Use player pulling at the hitch instead of lox hitching. Default false. Restart required; match settings on all peers."); BaseChassisMass = ((BaseUnityPlugin)this).Config.Bind<float>("Wagon", "BaseChassisMass", 65f, "Empty chassis mass, distributed across the articulated assembly. Restart required; match settings on all peers."); CargoMassScale = ((BaseUnityPlugin)this).Config.Bind<float>("Wagon", "CargoMassScale", 0.6f, "Multiplier on vanilla cargo mass contribution. Does not change empty mass. Restart required; match settings on all peers."); ((BaseUnityPlugin)this).Config.Save(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Active wagon config: BaseChassisMass=" + BaseChassisMass.Value + " CargoMassScale=" + CargoMassScale.Value + " (existing config values are retained)")); _harmony = new Harmony("greypoint.loxwagon"); _harmony.PatchAll(typeof(HaldorWagonPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LoxWagon 0.7.3 loading"); } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } } private static IEnumerable<CodeInstruction> InsertActivation(IEnumerable<CodeInstruction> instructions, string target) { bool found = false; foreach (CodeInstruction instruction in instructions) { yield return instruction; MethodInfo methodInfo = instruction.operand as MethodInfo; if (!(instruction.opcode != OpCodes.Call) && !(methodInfo == null) && !(methodInfo.Name != "Instantiate") && methodInfo.IsGenericMethod && !(methodInfo.GetGenericArguments()[0] != typeof(GameObject)) && methodInfo.GetParameters().Length == 3) { found = true; yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(HaldorWagonPlugin), "ActivateInstance", (Type[])null, (Type[])null)); } } if (!found) { Log.LogError((object)("Could not patch wagon activation in " + target)); } } private static GameObject ActivateInstance(GameObject instance) { if ((Object)(object)instance != (Object)null && ((Object)instance).name.StartsWith("greypoint_LoxWagon(", StringComparison.Ordinal)) { instance.SetActive(true); Log.LogInfo((object)("Activated wagon instance; network view valid: " + ((Object)(object)instance.GetComponent<ZNetView>() != (Object)null && instance.GetComponent<ZNetView>().IsValid()))); } return instance; } private static void RegisterBuildPiece(ObjectDB db) { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown if ((Object)(object)db == (Object)null || (Object)(object)_prefab == (Object)null) { return; } GameObject itemPrefab = db.GetItemPrefab("Hammer"); if ((Object)(object)itemPrefab == (Object)null) { return; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null || (Object)(object)component.m_itemData.m_shared.m_buildPieces == (Object)null) { return; } PieceTable buildPieces = component.m_itemData.m_shared.m_buildPieces; Piece component2 = _prefab.GetComponent<Piece>(); KeyValuePair<string, int>[] obj = new KeyValuePair<string, int>[6] { new KeyValuePair<string, int>("FineWood", 40), new KeyValuePair<string, int>("IronNails", 20), new KeyValuePair<string, int>("BlackMetal", 10), new KeyValuePair<string, int>("LoxPelt", 10), new KeyValuePair<string, int>("LinenThread", 10), new KeyValuePair<string, int>("Tar", 10) }; List<Requirement> list = new List<Requirement>(); KeyValuePair<string, int>[] array = obj; for (int i = 0; i < array.Length; i++) { KeyValuePair<string, int> keyValuePair = array[i]; GameObject itemPrefab2 = db.GetItemPrefab(keyValuePair.Key); if ((Object)(object)itemPrefab2 == (Object)null) { Log.LogWarning((object)("Missing recipe item " + keyValuePair.Key)); return; } list.Add(new Requirement { m_resItem = itemPrefab2.GetComponent<ItemDrop>(), m_amount = keyValuePair.Value, m_recover = true }); } component2.m_craftingStation = null; component2.m_resources = list.ToArray(); if (!buildPieces.m_pieces.Any((GameObject p) => (Object)(object)p != (Object)null && ((Object)p).name == "greypoint_LoxWagon")) { buildPieces.m_pieces.Add(_prefab); } Log.LogInfo((object)"Hammer recipe registered"); } private static GameObject CreatePrefab(ZNetScene scene) { //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) GameObject val = ((IEnumerable<GameObject>)scene.m_prefabs).FirstOrDefault((Func<GameObject, bool>)((GameObject p) => (Object)(object)p != (Object)null && ((Object)p).name == "Cart")); GameObject val2 = ((IEnumerable<GameObject>)scene.m_prefabs).FirstOrDefault((Func<GameObject, bool>)((GameObject p) => (Object)(object)p != (Object)null && ((Object)p).name == "trader_wagon_destructable")); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { Log.LogError((object)"Missing vanilla Cart or trader_wagon_destructable prefab"); return null; } bool activeSelf = val.activeSelf; val.SetActive(false); GameObject val3; try { val3 = Object.Instantiate<GameObject>(val); } finally { val.SetActive(activeSelf); } ((Object)val3).name = "greypoint_LoxWagon"; val3.SetActive(false); Piece component = val3.GetComponent<Piece>(); Vagon component2 = val3.GetComponent<Vagon>(); Container componentInChildren = val3.GetComponentInChildren<Container>(true); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || (Object)(object)componentInChildren == (Object)null) { Log.LogError((object)"Cart prefab lacks Piece, Vagon, or Container"); Object.Destroy((Object)(object)val3); return null; } WearNTear component3 = val3.GetComponent<WearNTear>(); if ((Object)(object)component3 == (Object)null) { Log.LogError((object)"Cart prefab lacks wagon durability"); Object.Destroy((Object)(object)val3); return null; } component3.m_health = 1200f; component.m_name = "Wagon"; component.m_description = "A merchant wagon drawn by a tamed lox."; component2.m_name = "Wagon"; component2.m_container = componentInChildren; component2.m_playerExtraPullMass = 0f; component2.m_detachDistance = (AllowHumanPulling.Value ? 2f : 8f); component2.m_attachOffset = (AllowHumanPulling.Value ? new Vector3(0f, 0.8f, 0f) : new Vector3(0f, 1.25f, 0f)); component2.m_baseMass = Mathf.Clamp(BaseChassisMass.Value, 30f, 200f); component2.m_itemWeightMassFactor *= Mathf.Clamp(CargoMassScale.Value, 0f, 1f); componentInChildren.m_name = "Wagon"; componentInChildren.m_width = 8; componentInChildren.m_height = 4; Renderer[] componentsInChildren = val3.GetComponentsInChildren<Renderer>(true); for (int num = 0; num < componentsInChildren.Length; num++) { componentsInChildren[num].enabled = false; } CopyVisualMeshes(val2.transform, val3.transform); AddBodyColliderAndInteractionPoints(val3, component2, componentInChildren); try { WheelMeshBuilder.Build(val3); } catch (Exception ex) { Log.LogWarning((object)("Visual wheels unavailable: " + ex.Message)); } WagonThumbnail.Apply(val3); try { ArticulatedChassis.Build(val3, ((IEnumerable<GameObject>)scene.m_prefabs).FirstOrDefault((Func<GameObject, bool>)((GameObject p) => (Object)(object)p != (Object)null && ((Object)p).name == "BatteringRam"))); } catch (Exception ex2) { Log.LogError((object)("Articulated chassis failed: " + ex2)); Object.DestroyImmediate((Object)(object)val3); return null; } AddShaftHotspots(val3, component2); try { WagonBench.Build(val3); } catch (Exception ex3) { Log.LogWarning((object)("Raised bench unavailable: " + ex3.Message)); } WagonSeat.Build(val3); try { WagonCargo.Build(val3, val); } catch (Exception ex4) { Log.LogWarning((object)("Visible cargo unavailable: " + ex4.Message)); } Floating[] componentsInChildren2 = val3.GetComponentsInChildren<Floating>(true); for (int num = 0; num < componentsInChildren2.Length; num++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[num]); } ImpactEffect[] componentsInChildren3 = val3.GetComponentsInChildren<ImpactEffect>(true); for (int num = 0; num < componentsInChildren3.Length; num++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[num]); } val3.AddComponent<LoxWagonController>(); Log.LogInfo((object)"Built wagon with articulated four-wheel chassis"); return val3; } private static void CopyVisualMeshes(Transform source, Transform target) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) Transform transform = new GameObject("HaldorWagonVisual").transform; transform.SetParent(target, false); int num = 0; MeshRenderer[] componentsInChildren = ((Component)source).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val in componentsInChildren) { MeshFilter component = ((Component)val).GetComponent<MeshFilter>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.sharedMesh == (Object)null)) { GameObject val2 = new GameObject("visual_" + num++); val2.transform.SetParent(transform, false); Matrix4x4 val3 = source.worldToLocalMatrix * ((Component)val).transform.localToWorldMatrix; val2.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val3)).GetColumn(3)); val2.transform.localRotation = Quaternion.LookRotation(Vector4.op_Implicit(((Matrix4x4)(ref val3)).GetColumn(2)), Vector4.op_Implicit(((Matrix4x4)(ref val3)).GetColumn(1))); Transform transform2 = val2.transform; Vector4 column = ((Matrix4x4)(ref val3)).GetColumn(0); float magnitude = ((Vector4)(ref column)).magnitude; column = ((Matrix4x4)(ref val3)).GetColumn(1); float magnitude2 = ((Vector4)(ref column)).magnitude; column = ((Matrix4x4)(ref val3)).GetColumn(2); transform2.localScale = new Vector3(magnitude, magnitude2, ((Vector4)(ref column)).magnitude); val2.AddComponent<MeshFilter>().sharedMesh = component.sharedMesh; ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterials = ((Renderer)val).sharedMaterials; } } Log.LogInfo((object)("Copied " + num + " merchant wagon mesh parts")); } private unsafe static void AddBodyColliderAndInteractionPoints(GameObject wagon, Vagon cart, Container storage) { //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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing refere