Please disclose if your mod was created primarily 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 ValheimRAFT v1.5.0
plugins\ValheimRAFT.dll
Decompiled 2 years 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.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.GUI; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.U2D; using UnityEngine.UI; using ValheimRAFT; using ValheimRAFT.UI; using ValheimRAFT.Util; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.0.0")] [module: UnverifiableCode] [module: System.Runtime.CompilerServices.RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class BoardingRampComponent : MonoBehaviour, Interactable, Hoverable { public enum BoardingRampState { Closed, Closing, Opening, Open } public BoardingRampState m_state = BoardingRampState.Closing; public float m_stateProgress; public float m_stateChangeDuration = 0.5f; public int m_segments = 8; public float m_segmentLength = 2f; public float m_segmentOverlap = 0.2f; public float m_segmentHeight = 0.05f; public float m_maxRampRotation; private GameObject m_segmentObject; private List<GameObject> m_segmentObjects = new List<GameObject>(); private List<Transform> m_ropeAttach1 = new List<Transform>(); private List<Transform> m_ropeAttach2 = new List<Transform>(); private LineRenderer m_rope1; private LineRenderer m_rope2; private GameObject m_ramp; private Transform m_winch1; private Transform m_winch2; private Transform m_winch1Rope; private Transform m_winch2Rope; private bool m_lastHitRamp; private Vector3 m_hitPosition; private bool m_updateRamp; private Quaternion m_desiredRotation; private float m_rotSpeed; private Color m_hitColor; private float m_hitDistance; private ZNetView m_nview; private int m_groundRayMask; private static RaycastHit[] m_rayHits = (RaycastHit[])(object)new RaycastHit[30]; private float m_lastBridgeProgress = -1f; private static EditRampComponent m_editPanel; private void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); m_groundRayMask = LayerMask.GetMask(new string[8] { "Default", "static_solid", "Default_small", "piece", "terrain", "blocker", "WaterVolume", "Water" }); m_ramp = ((Component)((Component)this).transform.Find("Ramp")).gameObject; m_segmentObject = ((Component)((Component)this).transform.Find("Ramp/Segment")).gameObject; m_rope1 = ((Component)((Component)this).transform.Find("Rope1")).GetComponent<LineRenderer>(); m_rope2 = ((Component)((Component)this).transform.Find("Rope2")).GetComponent<LineRenderer>(); m_winch1 = ((Component)this).transform.Find("Winch1/Cylinder"); m_winch2 = ((Component)this).transform.Find("Winch2/Cylinder"); m_winch1Rope = ((Component)this).transform.Find("Winch1/Pole/RopeAttach"); m_winch2Rope = ((Component)this).transform.Find("Winch2/Pole/RopeAttach"); m_segmentObject.SetActive(ZNetView.m_forceDisableInit); if (ZNetView.m_forceDisableInit) { ((Component)m_rope1).gameObject.SetActive(false); ((Component)m_rope2).gameObject.SetActive(false); m_segmentObject.SetActive(true); ((Behaviour)this).enabled = false; } else { m_nview.Register<byte>("RPC_SetState", (Action<long, byte>)RPC_SetState); m_nview.Register<byte>("RPC_SetSegmentCount", (Action<long, byte>)RPC_SetSegmentCount); m_updateRamp = true; LoadZDO(); } } private void RPC_SetState(long sender, byte state) { if (m_nview.IsOwner()) { SetState((BoardingRampState)state); } } private void LoadZDO() { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { m_state = (BoardingRampState)m_nview.m_zdo.GetInt("MB_m_state", 0); m_segments = m_nview.m_zdo.GetInt("MB_m_segments", 5); } } public void RPC_SetSegmentCount(long sender, byte segmentCount) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsOwner()) { SetSegmentCount(segmentCount); } } public void SetSegmentCount(int segmentCount) { if (segmentCount != m_segments) { if (Object.op_Implicit((Object)(object)m_nview) && !m_nview.IsOwner()) { m_nview.InvokeRPC("RPC_SetSegmentCount", new object[1] { (byte)segmentCount }); } else { m_segments = segmentCount; m_nview.m_zdo.Set("MB_m_segments", m_segments); } } } private void CreateSegments() { //IL_0097: 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) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) while (m_segments < m_segmentObjects.Count) { int index = m_segmentObjects.Count - 1; Object.Destroy((Object)(object)m_segmentObjects[index]); Object.Destroy((Object)(object)m_ropeAttach1[index]); Object.Destroy((Object)(object)m_ropeAttach2[index]); m_segmentObjects.RemoveAt(index); m_ropeAttach1.RemoveAt(index); m_ropeAttach2.RemoveAt(index); } for (int i = m_segmentObjects.Count; i < m_segments; i++) { GameObject val = Object.Instantiate<GameObject>(m_segmentObject, ((Component)this).transform.position + new Vector3(0f, (0f - m_segmentHeight) * (float)i, m_segmentLength * (float)i), Quaternion.identity, m_ramp.transform); val.transform.localRotation = Quaternion.identity; val.transform.localScale = new Vector3(1f + (float)i * 0.0001f, 1f + (float)i * 0.0001f, 1f + (float)i * 0.0001f); m_segmentObjects.Add(val); m_ropeAttach1.Add(val.transform.Find("SegmentAnchor/Pole1/RopeAttach")); m_ropeAttach2.Add(val.transform.Find("SegmentAnchor/Pole2/RopeAttach")); val.SetActive(true); } } private void Update() { if (Object.op_Implicit((Object)(object)m_nview) && !m_nview.IsOwner()) { BoardingRampState @int = (BoardingRampState)m_nview.m_zdo.GetInt("MB_m_state", 0); if (@int != m_state) { switch (@int) { case BoardingRampState.Closed: case BoardingRampState.Closing: m_state = BoardingRampState.Closing; break; case BoardingRampState.Opening: case BoardingRampState.Open: m_state = BoardingRampState.Opening; break; } } m_segments = m_nview.m_zdo.GetInt("MB_m_segments", 5); } if (m_segmentObjects.Count != m_segments) { CreateSegments(); ForceRampUpdate(); } CheckRampFloor(); if (m_state == BoardingRampState.Closing) { m_stateProgress = Mathf.Clamp01(m_stateProgress - Time.deltaTime / (m_stateChangeDuration * (float)m_segments)); UpdateRamp(); if (m_stateProgress <= 0f) { m_state = BoardingRampState.Closed; } } else if (m_state == BoardingRampState.Opening) { m_stateProgress = Mathf.Clamp01(m_stateProgress + Time.deltaTime / (m_stateChangeDuration * (float)m_segments)); UpdateRamp(); if (m_stateProgress >= 1f) { m_state = BoardingRampState.Open; } } else if (m_updateRamp) { UpdateRamp(); } } private void SetState(BoardingRampState state) { if (m_state == state) { return; } m_state = state; if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { if (m_nview.IsOwner()) { m_nview.m_zdo.Set("MB_m_state", (int)state); return; } m_nview.InvokeRPC("RPC_SetState", new object[1] { (byte)state }); } } private bool LinecastNonSelf(Vector3 start, Vector3 end, out RaycastHit hit) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) Vector3 val = end - start; return RaycastNonSelf(start, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude, out hit); } private bool RaycastNonSelf(Vector3 start, Vector3 dir, float dist, out RaycastHit hit) { //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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) int num = Physics.RaycastNonAlloc(start, dir, m_rayHits, dist, m_groundRayMask, (QueryTriggerInteraction)1); int num2 = 0; bool flag = false; for (int i = 0; i < num; i++) { if (!((RaycastHit)(ref m_rayHits[i])).transform.IsChildOf(((Component)this).transform.parent ?? ((Component)this).transform) && (!flag || ((RaycastHit)(ref m_rayHits[num2])).distance > ((RaycastHit)(ref m_rayHits[i])).distance)) { num2 = i; flag = true; } } hit = m_rayHits[num2]; return flag; } private void CheckRampFloor() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_024d: 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_0224: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026e: 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) if (m_state == BoardingRampState.Closed || m_state == BoardingRampState.Closing) { m_updateRamp |= m_state == BoardingRampState.Closing || m_ramp.transform.eulerAngles.x != -90f; } else { if (m_state != BoardingRampState.Opening && m_state != BoardingRampState.Open) { return; } m_updateRamp = true; float num = m_segmentLength * (float)m_segments; float num2 = 1f * (m_segmentLength - m_segmentOverlap) * (float)m_segments; Vector3 val = m_ramp.transform.TransformPoint(new Vector3(0f, (0f - m_segmentHeight) * (float)m_segments, num2)); Vector3 position = m_ramp.transform.position; Vector3 val2 = val - position; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 up = m_ramp.transform.up; if (LinecastNonSelf(position, val, out var hit)) { m_hitColor = Color.green; m_hitDistance = ((RaycastHit)(ref hit)).distance / num2; if (num * 0.94f > ((RaycastHit)(ref hit)).distance) { m_hitColor = Color.black; LinecastNonSelf(((RaycastHit)(ref hit)).point + normalized * 0.1f + up, ((RaycastHit)(ref hit)).point + normalized * 0.1f - up, out hit); } if ((double)Vector3.Dot(((RaycastHit)(ref hit)).normal, Vector3.up) < 0.5) { m_hitColor = Color.white; LinecastNonSelf(((RaycastHit)(ref hit)).point + up, ((RaycastHit)(ref hit)).point - up, out hit); } m_lastHitRamp = true; m_hitPosition = ((RaycastHit)(ref hit)).point; m_updateRamp = true; } else if (m_lastHitRamp && LinecastNonSelf(position - up * 0.3f, val - up * 0.3f, out hit)) { m_hitColor = Color.magenta; } else if (!m_lastHitRamp && RaycastNonSelf(val + new Vector3(0f, 5f, 0f), Vector3.down, 1000f, out hit)) { m_hitColor = Color.blue; m_hitPosition = ((RaycastHit)(ref hit)).point; m_hitDistance = 1f; m_updateRamp = true; m_lastHitRamp = false; } else { m_lastHitRamp = false; } } } public void ForceRampUpdate() { m_updateRamp = true; m_lastBridgeProgress = -1f; } private void UpdateRamp() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00d0: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!m_updateRamp) { return; } m_updateRamp = false; if (m_state == BoardingRampState.Closed || m_state == BoardingRampState.Closing) { m_desiredRotation = ((m_stateProgress < 1f / (float)m_segments) ? Quaternion.Euler(-90f, 0f, 0f) : m_ramp.transform.localRotation); m_rotSpeed = 90f; } else { Vector3 val = m_hitPosition - (((Component)this).transform.position - new Vector3(0f, m_hitDistance * m_segmentHeight * (float)m_segments, 0f)); m_desiredRotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized); Quaternion val2 = Quaternion.Inverse(((Component)this).transform.rotation) * m_desiredRotation; m_desiredRotation = Quaternion.Euler(((Quaternion)(ref val2)).eulerAngles.x, 0f, 0f); m_rotSpeed = Mathf.Clamp(Quaternion.Angle(m_ramp.transform.localRotation, m_desiredRotation) * 5f, 0f, 90f); } m_ramp.transform.localRotation = Quaternion.RotateTowards(m_ramp.transform.localRotation, m_desiredRotation, Time.deltaTime * m_rotSpeed); ((Component)m_winch1).transform.localRotation = Quaternion.Euler(m_stateProgress * 1000f * (float)m_segments, 0f, -90f); ((Component)m_winch2).transform.localRotation = Quaternion.Euler(m_stateProgress * 1000f * (float)m_segments, 0f, -90f); float stateProgress = m_stateProgress; if (m_lastBridgeProgress != stateProgress) { m_lastBridgeProgress = stateProgress; for (int i = 1; i < m_segmentObjects.Count; i++) { float num = Mathf.Clamp01(stateProgress * (float)m_segmentObjects.Count / (float)i); m_segmentObjects[i].transform.position = m_ramp.transform.TransformPoint(new Vector3(0f, (0f - m_segmentHeight) * (float)i, num * (m_segmentLength - m_segmentOverlap) * (float)i)); } } UpdateRopes(); } private void UpdateRopes() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) m_rope1.positionCount = m_segmentObjects.Count + 1; m_rope2.positionCount = m_segmentObjects.Count + 1; m_rope1.SetPosition(m_segmentObjects.Count, ((Component)m_rope1).transform.InverseTransformPoint(m_winch1Rope.position)); m_rope2.SetPosition(m_segmentObjects.Count, ((Component)m_rope2).transform.InverseTransformPoint(m_winch2Rope.position)); for (int i = 0; i < m_segmentObjects.Count; i++) { m_rope1.SetPosition(m_segmentObjects.Count - (i + 1), ((Component)m_rope1).transform.InverseTransformPoint(m_ropeAttach1[i].position)); m_rope2.SetPosition(m_segmentObjects.Count - (i + 1), ((Component)m_rope2).transform.InverseTransformPoint(m_ropeAttach2[i].position)); } } private void OnDrawGizmos() { //IL_0001: 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) Gizmos.color = m_hitColor; Gizmos.DrawSphere(m_hitPosition, 0.3f); } public string GetHoverName() { return ""; } public string GetHoverText() { string text = ((m_state == BoardingRampState.Open || m_state == BoardingRampState.Opening) ? "$mb_boarding_ramp_retract" : "$mb_boarding_ramp_extend"); return Localization.instance.Localize("[<color=yellow><b>$KEY_Use</b></color>] " + text) + Localization.instance.Localize("\n[<color=yellow><b>$KEY_AltPlace + $KEY_Use</b></color>] $mb_boarding_ramp_edit"); } public bool Interact(Humanoid user, bool hold, bool alt) { if (alt) { if (m_editPanel == null) { m_editPanel = new EditRampComponent(); } m_editPanel.ShowPanel(this); return true; } if (!hold) { if (m_state == BoardingRampState.Open || m_state == BoardingRampState.Opening) { SetState(BoardingRampState.Closing); } else if (m_state == BoardingRampState.Closing || m_state == BoardingRampState.Closed) { SetState(BoardingRampState.Opening); } } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } } public class CultivatableComponent : MonoBehaviour { private ZNetView m_nview; private static Dictionary<int, List<int>> m_childObjects = new Dictionary<int, List<int>>(); private static readonly int MBCultivatableParentIdHash = StringExtensionMethods.GetStableHashCode("MBCultivatableParentId"); public static readonly KeyValuePair<int, int> MBCultivatableParentHash = ZDO.GetHashZDOID("MBCultivatableParent"); private float textureScale = 8f; public bool isCultivatable { get; set; } = true; public void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); WearNTear component = ((Component)this).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } } public void Start() { UpdateMaterial(); } public void UpdateMaterial() { //IL_0050: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0076: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00d5: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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) Vector2 val = (Object.op_Implicit((Object)(object)((Component)this).transform.parent) ? new Vector2(0f - ((Component)this).transform.localPosition.x, 0f - ((Component)this).transform.localPosition.z) : new Vector2(0f - ((Component)this).transform.position.x, 0f - ((Component)this).transform.position.z)); val /= textureScale; float num = (Object.op_Implicit((Object)(object)((Component)this).transform.parent) ? (0f - ((Component)this).transform.localEulerAngles.y) : (0f - ((Component)this).transform.eulerAngles.y)); num /= 360f; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(((Component)this).transform.localScale.x, ((Component)this).transform.localScale.z); val2 /= textureScale; MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Material material = ((Renderer)componentsInChildren[i]).material; material.SetTextureOffset("_MainTex", val); material.SetTextureScale("_MainTex", val2); material.SetTextureOffset("_MainNormal", val); material.SetTextureScale("_MainNormal", val2); material.SetFloat("_MainRotation", num); } } private void OnDestroyed() { int orCreatePersistantID = ZDOPersistantID.Instance.GetOrCreatePersistantID(m_nview.m_zdo); if (!m_childObjects.TryGetValue(orCreatePersistantID, out var value)) { return; } for (int i = 0; i < value.Count; i++) { ZDO zDO = ZDOPersistantID.Instance.GetZDO(value[i]); if (zDO == null) { continue; } ZNetView val = ZNetScene.instance.FindInstance(zDO); if (Object.op_Implicit((Object)(object)val)) { if ((Object)(object)((Component)this).gameObject == (Object)(object)val || ((Component)this).transform.IsChildOf(((Component)val).transform)) { ZLog.LogWarning((object)$" gameObject == obj || transform.IsChildOf(obj.transform) {((Component)this).gameObject} == {val} || {((Component)this).transform.IsChildOf(((Component)val).transform)}"); continue; } WearNTear component = ((Component)val).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component)) { component.Destroy(); continue; } ZNetView component2 = ((Component)val).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component2)) { component2.Destroy(); } } else { ZDOMan.instance.DestroyZDO(zDO); } } m_childObjects.Remove(orCreatePersistantID); } public string GetHoverName() { return ""; } public string GetHoverText() { return ""; } public bool Interact(Humanoid user, bool hold, bool alt) { return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public void AddNewChild(ZNetView child) { AddNewChild(ZDOPersistantID.Instance.GetOrCreatePersistantID(m_nview.m_zdo), child); } public static void InitPiece(ZNetView netview) { int parentID = GetParentID(netview); if (parentID != 0) { AddChild(parentID, netview); } } public static int GetParentID(ZNetView netview) { //IL_0020: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) int num = netview.m_zdo.GetInt(MBCultivatableParentIdHash, 0); if (num == 0) { ZDOID zDOID = netview.m_zdo.GetZDOID(MBCultivatableParentHash); if (zDOID != ZDOID.None) { ZDO zDO = ZDOMan.instance.GetZDO(zDOID); num = ((zDO == null) ? ZDOPersistantID.ZDOIDToId(zDOID) : ZDOPersistantID.Instance.GetOrCreatePersistantID(zDO)); netview.m_zdo.Set(MBCultivatableParentIdHash, num, false); } } return num; } public static void AddNewChild(int parent, ZNetView child) { child.m_zdo.Set(MBCultivatableParentIdHash, parent, false); AddChild(parent, child); } public static void AddChild(int parent, ZNetView child) { StaticPhysics component = ((Component)child).GetComponent<StaticPhysics>(); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } AddChild(parent, ZDOPersistantID.Instance.GetOrCreatePersistantID(child.m_zdo)); } private static void AddChild(int parent, int child) { if (parent != 0) { if (!m_childObjects.TryGetValue(parent, out var value)) { value = new List<int>(); m_childObjects.Add(parent, value); } value.Add(child); } } } public class CustomMastComponent : MastComponent { public GameObject m_upperBeam; public GameObject m_lowerBeam; public float m_upperBeamLength; public float m_lowerBeamLength; public float m_upperBeamWidth; public float m_lowerBeamWidth; public bool m_upperBeamEnabled; public bool m_lowerBeamEnabled; public RopeAnchorComponent m_upperBeamLeftAnchor; public RopeAnchorComponent m_upperBeamRightAnchor; public RopeAnchorComponent m_lowerBeamLeftAnchor; public RopeAnchorComponent m_lowerBeamRightAnchor; public ZNetView m_nview; public SailComponent m_sailComponent; public void Awake() { m_sailCloth = ((Component)this).GetComponent<Cloth>(); m_nview = ((Component)this).GetComponent<ZNetView>(); m_sailComponent = ((Component)this).GetComponent<SailComponent>(); } public void LoadZDO() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { Vector3 vec = m_nview.m_zdo.GetVec3("MBMast_upperBeam", new Vector3(1f, 1f, 1f)); m_upperBeamLength = vec.x; m_upperBeamWidth = vec.y; m_upperBeamEnabled = vec.z == 1f; Vector3 vec2 = m_nview.m_zdo.GetVec3("MBMast_lowerBeam", new Vector3(1f, 1f, 1f)); m_lowerBeamLength = vec2.x; m_lowerBeamWidth = vec2.y; m_lowerBeamEnabled = vec2.z == 1f; m_upperBeam.transform.localScale = new Vector3(m_upperBeamLength, m_upperBeamWidth, m_upperBeamWidth); m_upperBeam.SetActive(m_upperBeamEnabled); m_lowerBeam.transform.localScale = new Vector3(m_lowerBeamLength, m_lowerBeamWidth, m_lowerBeamWidth); m_lowerBeam.SetActive(m_lowerBeamEnabled); } } } public class MastComponent : MonoBehaviour { public GameObject m_sailObject; public Cloth m_sailCloth; internal bool m_allowSailRotation; internal bool m_allowSailShrinking; internal bool m_disableCloth; } public class MoveableBaseRootComponent : MonoBehaviour { public static readonly KeyValuePair<int, int> MBParentHash = ZDO.GetHashZDOID("MBParent"); public static readonly int MBCharacterParentHash = StringExtensionMethods.GetStableHashCode("MBCharacterParent"); public static readonly int MBCharacterOffsetHash = StringExtensionMethods.GetStableHashCode("MBCharacterOFfset"); public static readonly int MBParentIdHash = StringExtensionMethods.GetStableHashCode("MBParentId"); public static readonly int MBPositionHash = StringExtensionMethods.GetStableHashCode("MBPosition"); public static readonly int MBRotationHash = StringExtensionMethods.GetStableHashCode("MBRotation"); public static readonly int MBRotationVecHash = StringExtensionMethods.GetStableHashCode("MBRotationVec"); internal static Dictionary<int, List<ZNetView>> m_pendingPieces = new Dictionary<int, List<ZNetView>>(); internal static Dictionary<int, List<ZDO>> m_allPieces = new Dictionary<int, List<ZDO>>(); internal static Dictionary<int, List<ZDOID>> m_dynamicObjects = new Dictionary<int, List<ZDOID>>(); internal MoveableBaseShipComponent m_moveableBaseShip; internal Rigidbody m_rigidbody; internal ZNetView m_nview; internal Rigidbody m_syncRigidbody; internal Ship m_ship; internal List<ZNetView> m_pieces = new List<ZNetView>(); internal List<MastComponent> m_mastPieces = new List<MastComponent>(); internal List<RudderComponent> m_rudderPieces = new List<RudderComponent>(); internal List<ZNetView> m_portals = new List<ZNetView>(); internal List<RopeLadderComponent> m_ladders = new List<RopeLadderComponent>(); internal List<BoardingRampComponent> m_boardingRamps = new List<BoardingRampComponent>(); private Vector2i m_sector; private Bounds m_bounds; internal BoxCollider m_blockingcollider; internal BoxCollider m_floatcollider; internal BoxCollider m_onboardcollider; internal int m_id; public bool m_statsOverride; private static bool itemsRemovedDuringWait; public void Awake() { m_rigidbody = ((Component)this).gameObject.AddComponent<Rigidbody>(); m_rigidbody.isKinematic = true; m_rigidbody.interpolation = (RigidbodyInterpolation)1; m_rigidbody.mass = 99999f; if (ZNet.instance.IsServer()) { ((MonoBehaviour)this).StartCoroutine("UpdatePieceSectors"); } } public void CleanUp() { ((MonoBehaviour)this).StopCoroutine("ActivatePendingPieces"); if (!Object.op_Implicit((Object)(object)ZNetScene.instance) || m_id == 0) { return; } for (int i = 0; i < m_pieces.Count; i++) { ZNetView val = m_pieces[i]; if (Object.op_Implicit((Object)(object)val)) { ((Component)val).transform.SetParent((Transform)null); AddInactivePiece(m_id, val); } } List<Player> allPlayers = Player.GetAllPlayers(); for (int j = 0; j < allPlayers.Count; j++) { if (Object.op_Implicit((Object)(object)allPlayers[j]) && (Object)(object)((Component)allPlayers[j]).transform.parent == (Object)(object)((Component)this).transform) { ((Component)allPlayers[j]).transform.SetParent((Transform)null); } } } private void Sync() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)m_syncRigidbody)) { m_rigidbody.MovePosition(((Component)m_syncRigidbody).transform.position); m_rigidbody.MoveRotation(((Component)m_syncRigidbody).transform.rotation); } } public void FixedUpdate() { Sync(); } public void LateUpdate() { Sync(); if (!ZNet.instance.IsServer()) { UpdateAllPieces(); } } public void UpdateAllPieces() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector2i zone = ZoneSystem.instance.GetZone(((Component)this).transform.position); if (!(zone != m_sector)) { return; } m_sector = zone; for (int i = 0; i < m_pieces.Count; i++) { ZNetView val = m_pieces[i]; if (!Object.op_Implicit((Object)(object)val)) { m_pieces.RemoveAt(i); i--; } else { val.m_zdo.SetPosition(((Component)this).transform.position); } } } public IEnumerator UpdatePieceSectors() { while (true) { if (!m_allPieces.TryGetValue(m_id, out var list)) { yield return (object)new WaitForSeconds(5f); continue; } Vector3 pos = ((Component)this).transform.position; Vector2i sector = ZoneSystem.instance.GetZone(pos); float realtimeSinceStartup = Time.realtimeSinceStartup; if (sector != m_sector) { m_sector = sector; for (int i = 0; i < list.Count; i++) { ZDO val = list[i]; if (!(val.GetSector() != sector)) { continue; } if (val.GetInt(MBParentIdHash, 0) != m_id) { Logger.LogWarning((object)"Invalid piece in piece list found, removing."); list.FastRemoveAt(i); i--; continue; } val.SetPosition(pos); if (Time.realtimeSinceStartup - realtimeSinceStartup > 0.1f) { itemsRemovedDuringWait = false; yield return (object)new WaitForEndOfFrame(); realtimeSinceStartup = Time.realtimeSinceStartup; if (itemsRemovedDuringWait) { i = 0; } } } } yield return (object)new WaitForEndOfFrame(); list = null; } } internal float GetColliderBottom() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) return ((Component)m_blockingcollider).transform.position.y + m_blockingcollider.center.y - m_blockingcollider.size.y / 2f; } public static void AddInactivePiece(int id, ZNetView netview) { if (!m_pendingPieces.TryGetValue(id, out var value)) { value = new List<ZNetView>(); m_pendingPieces.Add(id, value); } value.Add(netview); WearNTear component = ((Component)netview).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component)) { ((Behaviour)component).enabled = false; } } public void RemovePiece(ZNetView netview) { if (m_pieces.Remove(netview)) { MastComponent component = ((Component)netview).GetComponent<MastComponent>(); if (Object.op_Implicit((Object)(object)component)) { m_mastPieces.Remove(component); } RudderComponent component2 = ((Component)netview).GetComponent<RudderComponent>(); if (Object.op_Implicit((Object)(object)component2)) { m_rudderPieces.Remove(component2); } BoardingRampComponent component3 = ((Component)netview).GetComponent<BoardingRampComponent>(); if (Object.op_Implicit((Object)(object)component3)) { m_boardingRamps.Remove(component3); } if (Object.op_Implicit((Object)(object)((Component)netview).GetComponent<TeleportWorld>())) { m_portals.Remove(netview); } RopeLadderComponent component4 = ((Component)netview).GetComponent<RopeLadderComponent>(); if (Object.op_Implicit((Object)(object)component4)) { m_ladders.Remove(component4); component4.m_mbroot = null; } UpdateStats(); } } private void UpdateStats() { } public void DestroyPiece(WearNTear wnt) { ZNetView component = ((Component)wnt).GetComponent<ZNetView>(); RemovePiece(component); UpdatePieceCount(); if (GetPieceCount() == 0) { ((Component)m_ship).GetComponent<WearNTear>().Destroy(); Object.Destroy((Object)(object)((Component)this).gameObject); } } public void ActivatePendingPiecesCoroutine() { ((MonoBehaviour)this).StartCoroutine("ActivatePendingPieces"); } public IEnumerator ActivatePendingPieces() { if (!Object.op_Implicit((Object)(object)m_nview) || m_nview.m_zdo == null) { yield return null; } int id = ZDOPersistantID.Instance.GetOrCreatePersistantID(m_nview.m_zdo); if (m_pendingPieces.TryGetValue(id, out var list)) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); for (int i = 0; i < list.Count; i++) { ZNetView val = list[i]; if (Object.op_Implicit((Object)(object)val)) { ActivatePiece(val); if (!ZNetScene.instance.InLoadingScreen() && stopwatch.ElapsedMilliseconds >= 10) { yield return (object)new WaitForEndOfFrame(); stopwatch.Restart(); } } } list.Clear(); m_pendingPieces.Remove(id); } if (m_dynamicObjects.TryGetValue(m_id, out var value)) { Vector3 val3 = default(Vector3); for (int j = 0; j < value.Count; j++) { GameObject val2 = ZNetScene.instance.FindInstance(value[j]); if (!Object.op_Implicit((Object)(object)val2)) { continue; } ZNetView componentInParent = val2.GetComponentInParent<ZNetView>(); if (!Object.op_Implicit((Object)(object)componentInParent) || componentInParent.m_zdo == null) { continue; } if (ZDOExtraData.s_vec3.TryGetValue(componentInParent.m_zdo.m_uid, out var value2)) { if (value2.TryGetValue(MBCharacterOffsetHash, ref val3)) { ((Component)componentInParent).transform.position = val3 + ((Component)this).transform.position; } val3 = default(Vector3); } ZDOExtraData.RemoveInt(componentInParent.m_zdo.m_uid, MBCharacterParentHash); ZDOExtraData.RemoveVec3(componentInParent.m_zdo.m_uid, MBCharacterOffsetHash); value2 = null; } m_dynamicObjects.Remove(m_id); } yield return null; } public static void AddDynamicParent(ZNetView source, GameObject target) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) MoveableBaseRootComponent componentInParent = target.GetComponentInParent<MoveableBaseRootComponent>(); if (Object.op_Implicit((Object)(object)componentInParent)) { source.m_zdo.Set(MBCharacterParentHash, componentInParent.m_id, false); source.m_zdo.Set(MBCharacterOffsetHash, ((Component)source).transform.position - ((Component)componentInParent).transform.position); } } public static void AddDynamicParent(ZNetView source, GameObject target, Vector3 offset) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) MoveableBaseRootComponent componentInParent = target.GetComponentInParent<MoveableBaseRootComponent>(); if (Object.op_Implicit((Object)(object)componentInParent)) { source.m_zdo.Set(MBCharacterParentHash, componentInParent.m_id, false); source.m_zdo.Set(MBCharacterOffsetHash, offset); } } public static void InitZDO(ZDO zdo) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) _ = zdo.m_prefab; StringExtensionMethods.GetStableHashCode("MBRaft"); int parentID = GetParentID(zdo); if (parentID != 0) { if (!m_allPieces.TryGetValue(parentID, out var value)) { value = new List<ZDO>(); m_allPieces.Add(parentID, value); } value.Add(zdo); } int @int = zdo.GetInt(MBCharacterParentHash, 0); if (@int != 0) { if (!m_dynamicObjects.TryGetValue(@int, out var value2)) { value2 = new List<ZDOID>(); m_dynamicObjects.Add(@int, value2); } value2.Add(zdo.m_uid); } } public static void RemoveZDO(ZDO zdo) { int parentID = GetParentID(zdo); if (parentID != 0 && m_allPieces.TryGetValue(parentID, out var value)) { value.FastRemove(zdo); itemsRemovedDuringWait = true; } } private static int GetParentID(ZDO zdo) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) int num = zdo.GetInt(MBParentIdHash, 0); if (num == 0) { ZDOID zDOID = zdo.GetZDOID(MBParentHash); if (zDOID != ZDOID.None) { ZDO zDO = ZDOMan.instance.GetZDO(zDOID); num = ((zDO == null) ? ZDOPersistantID.ZDOIDToId(zDOID) : ZDOPersistantID.Instance.GetOrCreatePersistantID(zDO)); zdo.Set(MBParentIdHash, num, false); int mBRotationVecHash = MBRotationVecHash; Quaternion quaternion = zdo.GetQuaternion(MBRotationHash, Quaternion.identity); zdo.Set(mBRotationVecHash, ((Quaternion)(ref quaternion)).eulerAngles); zdo.RemoveZDOID(MBParentHash); ZDOHelper.Remove<Quaternion>(ZDOExtraData.s_quats, zDOID, MBRotationHash); } } return num; } public static void InitPiece(ZNetView netview) { Rigidbody componentInChildren = ((Component)netview).GetComponentInChildren<Rigidbody>(); if (Object.op_Implicit((Object)(object)componentInChildren) && !componentInChildren.isKinematic) { return; } int parentID = GetParentID(netview.m_zdo); if (parentID == 0) { return; } GameObject gameObject = ZDOPersistantID.Instance.GetGameObject(parentID); if (Object.op_Implicit((Object)(object)gameObject)) { MoveableBaseShipComponent component = gameObject.GetComponent<MoveableBaseShipComponent>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.m_baseRoot)) { component.m_baseRoot.ActivatePiece(netview); } } else { AddInactivePiece(parentID, netview); } } public void ActivatePiece(ZNetView netview) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)netview)) { ((Component)netview).transform.SetParent(((Component)this).transform); ((Component)netview).transform.localPosition = netview.m_zdo.GetVec3(MBPositionHash, Vector3.zero); ((Component)netview).transform.localRotation = Quaternion.Euler(netview.m_zdo.GetVec3(MBRotationVecHash, Vector3.zero)); WearNTear component = ((Component)netview).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component)) { ((Behaviour)component).enabled = true; } AddPiece(netview); } } public void AddTemporaryPiece(Piece piece) { ((Component)piece).transform.SetParent(((Component)this).transform); } public void AddNewPiece(Piece piece) { if (Object.op_Implicit((Object)(object)piece) && Object.op_Implicit((Object)(object)piece.m_nview)) { AddNewPiece(piece.m_nview); } } public void AddNewPiece(ZNetView netview) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) ((Component)netview).transform.SetParent(((Component)this).transform); if (netview.m_zdo != null) { netview.m_zdo.Set(MBParentIdHash, ZDOPersistantID.Instance.GetOrCreatePersistantID(m_nview.m_zdo), false); netview.m_zdo.Set(MBPositionHash, ((Component)netview).transform.localPosition); ZDO zdo = netview.m_zdo; int mBRotationVecHash = MBRotationVecHash; Quaternion localRotation = ((Component)netview).transform.localRotation; zdo.Set(mBRotationVecHash, ((Quaternion)(ref localRotation)).eulerAngles); } AddPiece(netview); InitZDO(netview.m_zdo); } public void AddPiece(ZNetView netview) { //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown m_pieces.Add(netview); UpdatePieceCount(); EncapsulateBounds(netview); WearNTear component = ((Component)netview).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component) && ValheimRaftEntrypoint.Instance.MakeAllPiecesWaterProof.Value) { component.m_noRoofWear = false; } CultivatableComponent component2 = ((Component)netview).GetComponent<CultivatableComponent>(); if (Object.op_Implicit((Object)(object)component2)) { component2.UpdateMaterial(); } MastComponent component3 = ((Component)netview).GetComponent<MastComponent>(); if (Object.op_Implicit((Object)(object)component3)) { m_mastPieces.Add(component3); } BoardingRampComponent component4 = ((Component)netview).GetComponent<BoardingRampComponent>(); if (Object.op_Implicit((Object)(object)component4)) { component4.ForceRampUpdate(); m_boardingRamps.Add(component4); } RudderComponent component5 = ((Component)netview).GetComponent<RudderComponent>(); if (Object.op_Implicit((Object)(object)component5)) { if (!Object.op_Implicit((Object)(object)component5.m_controls)) { component5.m_controls = ((Component)netview).GetComponentInChildren<ShipControlls>(); } if (!Object.op_Implicit((Object)(object)component5.m_wheel)) { component5.m_wheel = ((Component)netview).transform.Find("controls/wheel"); } component5.m_controls.m_nview = m_nview; component5.m_controls.m_ship = ((Component)m_moveableBaseShip).GetComponent<Ship>(); m_rudderPieces.Add(component5); } if (Object.op_Implicit((Object)(object)((Component)netview).GetComponent<TeleportWorld>())) { m_portals.Add(netview); } RopeLadderComponent component6 = ((Component)netview).GetComponent<RopeLadderComponent>(); if (Object.op_Implicit((Object)(object)component6)) { m_ladders.Add(component6); component6.m_mbroot = this; } MeshRenderer[] componentsInChildren = ((Component)netview).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { Material[] sharedMaterials = ((Renderer)val).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = new Material(sharedMaterials[j]); val2.SetFloat("_RippleDistance", 0f); val2.SetFloat("_ValueNoise", 0f); sharedMaterials[j] = val2; } ((Renderer)val).sharedMaterials = sharedMaterials; } } Rigidbody[] componentsInChildren2 = ((Component)netview).GetComponentsInChildren<Rigidbody>(); for (int k = 0; k < componentsInChildren2.Length; k++) { if (componentsInChildren2[k].isKinematic) { Object.Destroy((Object)(object)componentsInChildren2[k]); } } UpdateStats(); } private void UpdatePieceCount() { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { m_nview.m_zdo.Set("MBPieceCount", m_pieces.Count); } } public void EncapsulateBounds(ZNetView netview) { //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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_014a: 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) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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) Piece component = ((Component)netview).GetComponent<Piece>(); List<Collider> list = (Object.op_Implicit((Object)(object)component) ? ((StaticTarget)component).GetAllColliders() : new List<Collider>(((Component)netview).GetComponentsInChildren<Collider>())); Door componentInChildren = ((Component)netview).GetComponentInChildren<Door>(); RopeLadderComponent component2 = ((Component)netview).GetComponent<RopeLadderComponent>(); RopeAnchorComponent component3 = ((Component)netview).GetComponent<RopeAnchorComponent>(); if (!Object.op_Implicit((Object)(object)componentInChildren) && !Object.op_Implicit((Object)(object)component2) && !Object.op_Implicit((Object)(object)component3)) { ((Bounds)(ref m_bounds)).Encapsulate(((Component)netview).transform.localPosition); } for (int i = 0; i < list.Count; i++) { Physics.IgnoreCollision(list[i], (Collider)(object)m_blockingcollider, true); Physics.IgnoreCollision(list[i], (Collider)(object)m_floatcollider, true); Physics.IgnoreCollision(list[i], (Collider)(object)m_onboardcollider, true); } m_blockingcollider.size = new Vector3(((Bounds)(ref m_bounds)).size.x, 3f, ((Bounds)(ref m_bounds)).size.z); m_blockingcollider.center = new Vector3(((Bounds)(ref m_bounds)).center.x, -0.2f, ((Bounds)(ref m_bounds)).center.z); m_floatcollider.size = new Vector3(((Bounds)(ref m_bounds)).size.x, 3f, ((Bounds)(ref m_bounds)).size.z); m_floatcollider.center = new Vector3(((Bounds)(ref m_bounds)).center.x, -0.2f, ((Bounds)(ref m_bounds)).center.z); m_onboardcollider.size = ((Bounds)(ref m_bounds)).size; m_onboardcollider.center = ((Bounds)(ref m_bounds)).center; } internal int GetPieceCount() { if (!Object.op_Implicit((Object)(object)m_nview) || m_nview.m_zdo == null) { return m_pieces.Count; } return m_nview.m_zdo.GetInt("MBPieceCount", m_pieces.Count); } } public class MoveableBaseShipComponent : MonoBehaviour { [Flags] public enum MBFlags { None = 0, IsAnchored = 1, HideMesh = 2 } internal MoveableBaseRootComponent m_baseRoot; internal Rigidbody m_rigidbody; internal Ship m_ship; internal ZNetView m_nview; internal GameObject m_baseRootObject; internal ZSyncTransform m_zsync; public float m_targetHeight; public float m_balanceForce = 0.03f; public float m_liftForce = 20f; public MBFlags m_flags; public void Awake() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) Ship component = ((Component)this).GetComponent<Ship>(); m_nview = ((Component)this).GetComponent<ZNetView>(); m_zsync = ((Component)this).GetComponent<ZSyncTransform>(); m_ship = ((Component)this).GetComponent<Ship>(); m_baseRootObject = new GameObject { name = "MoveableBase", layer = 0 }; m_baseRoot = m_baseRootObject.AddComponent<MoveableBaseRootComponent>(); m_nview.Register<bool>("SetAnchor", (Action<long, bool>)delegate(long sender, bool state) { RPC_SetAnchor(sender, state); }); m_nview.Register<bool>("SetVisual", (Action<long, bool>)delegate(long sender, bool state) { RPC_SetVisual(sender, state); }); m_baseRoot.m_moveableBaseShip = this; m_baseRoot.m_nview = m_nview; m_baseRoot.m_ship = component; m_baseRoot.m_id = ZDOPersistantID.Instance.GetOrCreatePersistantID(m_nview.m_zdo); m_rigidbody = ((Component)this).GetComponent<Rigidbody>(); m_baseRoot.m_syncRigidbody = m_rigidbody; m_rigidbody.mass = 1000f; m_baseRootObject.transform.SetParent((Transform)null); m_baseRootObject.transform.position = ((Component)this).transform.position; m_baseRootObject.transform.rotation = ((Component)this).transform.rotation; Transform obj = ((Component)component).transform.Find("ship/visual/mast"); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } Transform obj2 = ((Component)component).transform.Find("ship/colliders/log"); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } Transform obj3 = ((Component)component).transform.Find("ship/colliders/log (1)"); if (obj3 != null) { ((Component)obj3).gameObject.SetActive(false); } Transform obj4 = ((Component)component).transform.Find("ship/colliders/log (2)"); if (obj4 != null) { ((Component)obj4).gameObject.SetActive(false); } Transform obj5 = ((Component)component).transform.Find("ship/colliders/log (3)"); if (obj5 != null) { ((Component)obj5).gameObject.SetActive(false); } UpdateVisual(); BoxCollider[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren<BoxCollider>(); m_baseRoot.m_onboardcollider = ((IEnumerable<BoxCollider>)componentsInChildren).FirstOrDefault((Func<BoxCollider, bool>)((BoxCollider k) => ((Object)((Component)k).gameObject).name == "OnboardTrigger")); ((Component)m_baseRoot.m_onboardcollider).transform.localScale = new Vector3(1f, 1f, 1f); m_baseRoot.m_floatcollider = component.m_floatCollider; ((Component)m_baseRoot.m_floatcollider).transform.localScale = new Vector3(1f, 1f, 1f); m_baseRoot.m_blockingcollider = ((Component)((Component)component).transform.Find("ship/colliders/Cube")).GetComponentInChildren<BoxCollider>(); ((Component)m_baseRoot.m_blockingcollider).transform.localScale = new Vector3(1f, 1f, 1f); ((Component)m_baseRoot.m_blockingcollider).gameObject.layer = ValheimRaftEntrypoint.CustomRaftLayer; ((Component)((Component)m_baseRoot.m_blockingcollider).transform.parent).gameObject.layer = ValheimRaftEntrypoint.CustomRaftLayer; ZLog.Log((object)$"Activating MBRoot: {m_baseRoot.m_id}"); m_baseRoot.ActivatePendingPiecesCoroutine(); FirstTimeCreation(); } public void UpdateVisual() { if (m_nview.m_zdo != null) { m_flags = (MBFlags)m_nview.m_zdo.GetInt("MBFlags", (int)m_flags); ((Component)((Component)this).transform.Find("ship/visual")).gameObject.SetActive(!m_flags.HasFlag(MBFlags.HideMesh)); ((Component)((Component)this).transform.Find("interactive")).gameObject.SetActive(!m_flags.HasFlag(MBFlags.HideMesh)); } } public void OnDestroy() { if (Object.op_Implicit((Object)(object)m_baseRoot)) { m_baseRoot.CleanUp(); Object.Destroy((Object)(object)((Component)m_baseRoot).gameObject); } } private void FirstTimeCreation() { //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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (m_baseRoot.GetPieceCount() != 0) { return; } GameObject prefab = ZNetScene.instance.GetPrefab("wood_floor"); for (float num = -1f; num < 1.01f; num += 2f) { for (float num2 = -2f; num2 < 2.01f; num2 += 2f) { Vector3 val = ((Component)this).transform.TransformPoint(new Vector3(num, 0.45f, num2)); ZNetView component = Object.Instantiate<GameObject>(prefab, val, ((Component)this).transform.rotation).GetComponent<ZNetView>(); m_baseRoot.AddNewPiece(component); } } } internal void Accend() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (m_flags.HasFlag(MBFlags.IsAnchored)) { SetAnchor(state: false); } if (!ValheimRaftEntrypoint.Instance.AllowFlight.Value) { m_targetHeight = 0f; } else { if (!Object.op_Implicit((Object)(object)m_baseRoot) || !Object.op_Implicit((Object)(object)m_baseRoot.m_floatcollider)) { return; } m_targetHeight = Mathf.Clamp(((Component)m_baseRoot.m_floatcollider).transform.position.y + 1f, ZoneSystem.instance.m_waterLevel, 200f); } m_nview.m_zdo.Set("MBTargetHeight", m_targetHeight); } internal void Descent() { //IL_0078: 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) if (m_flags.HasFlag(MBFlags.IsAnchored)) { SetAnchor(state: false); } _ = m_targetHeight; if (!ValheimRaftEntrypoint.Instance.AllowFlight.Value) { m_targetHeight = 0f; } else { if (!Object.op_Implicit((Object)(object)m_baseRoot) || !Object.op_Implicit((Object)(object)m_baseRoot.m_floatcollider)) { return; } m_targetHeight = Mathf.Clamp(((Component)m_baseRoot.m_floatcollider).transform.position.y - 1f, ZoneSystem.instance.m_waterLevel, 200f); if (((Component)m_baseRoot.m_floatcollider).transform.position.y - 1f <= ZoneSystem.instance.m_waterLevel) { m_targetHeight = 0f; } } m_nview.m_zdo.Set("MBTargetHeight", m_targetHeight); } internal void UpdateStats(bool flight) { if (!Object.op_Implicit((Object)(object)m_rigidbody) || !Object.op_Implicit((Object)(object)m_baseRoot) || m_baseRoot.m_statsOverride) { return; } m_rigidbody.mass = 3000f; m_rigidbody.angularDrag = (flight ? 1f : 0f); m_rigidbody.drag = (flight ? 1f : 0f); if (Object.op_Implicit((Object)(object)m_ship)) { m_ship.m_angularDamping = (flight ? 5f : 0.8f); m_ship.m_backwardForce = 1f; m_ship.m_damping = (flight ? 5f : 0.35f); m_ship.m_dampingSideway = (flight ? 3f : 0.3f); m_ship.m_force = 3f; m_ship.m_forceDistance = 5f; m_ship.m_sailForceFactor = (flight ? 0.2f : 0.05f); m_ship.m_stearForce = (flight ? 0.2f : 1f); m_ship.m_stearVelForceFactor = 1.3f; m_ship.m_waterImpactDamage = 0f; ImpactEffect component = ((Component)m_ship).GetComponent<ImpactEffect>(); if (Object.op_Implicit((Object)(object)component)) { component.m_interval = 0.1f; component.m_minVelocity = 0.1f; component.m_damages.m_damage = 100f; } } } internal void SetAnchor(bool state) { m_nview.InvokeRPC("SetAnchor", new object[1] { state }); } public void RPC_SetAnchor(long sender, bool state) { m_flags = (state ? (m_flags | MBFlags.IsAnchored) : (m_flags & ~MBFlags.IsAnchored)); m_nview.m_zdo.Set("MBFlags", (int)m_flags); } internal void SetVisual(bool state) { m_nview.InvokeRPC("SetVisual", new object[1] { state }); } public void RPC_SetVisual(long sender, bool state) { m_flags = (state ? (m_flags | MBFlags.HideMesh) : (m_flags & ~MBFlags.HideMesh)); m_nview.m_zdo.Set("MBFlags", (int)m_flags); UpdateVisual(); } } public class PierComponent : MonoBehaviour { public ZNetView m_nview; public GameObject m_segmentObject; public float m_segmentHeight; public float m_baseOffset; private int m_terrainLayer; private List<GameObject> m_segmentObjects = new List<GameObject>(); public void Awake() { m_terrainLayer = LayerMask.GetMask(new string[1] { "terrain" }); if (ZNetView.m_forceDisableInit) { WearNTear component = ((Component)this).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.m_new)) { component.m_new.SetActive(false); } m_segmentObject.SetActive(false); Collider[] componentsInChildren = m_segmentObject.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } m_segmentObject.layer = LayerMask.NameToLayer("ghost"); Transform[] components = m_segmentObject.GetComponents<Transform>(); for (int j = 0; j < components.Length; j++) { ((Component)components[j]).gameObject.layer = m_segmentObject.layer; } ((MonoBehaviour)this).InvokeRepeating("UpdateSegments", 0.5f, 0.1f); } UpdateSegments(); } private void UpdateSegments() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, ZoneSystem.instance.m_waterLevel + m_baseOffset, ((Component)this).transform.position.z); RaycastHit[] array = Physics.RaycastAll(((Component)this).transform.position, Vector3.down, 100f, m_terrainLayer); float num = 0f; for (int i = 0; i < array.Length; i++) { if (num < ((RaycastHit)(ref array[i])).distance) { num = ((RaycastHit)(ref array[i])).distance; } } int num2 = Mathf.CeilToInt(num / m_segmentHeight); for (int j = m_segmentObjects.Count; j < num2; j++) { GameObject item = Object.Instantiate<GameObject>(m_segmentObject, ((Component)this).transform.position, Quaternion.identity, ((Component)this).transform); m_segmentObjects.Add(item); } while (m_segmentObjects.Count > num2) { Object.Destroy((Object)(object)m_segmentObjects[m_segmentObjects.Count - 1]); m_segmentObjects.RemoveAt(m_segmentObjects.Count - 1); } for (int k = 0; k < m_segmentObjects.Count; k++) { GameObject obj = m_segmentObjects[k]; obj.SetActive(true); obj.transform.localPosition = new Vector3(0f, (0f - m_segmentHeight) * (float)(k + 1), 0f); obj.transform.localRotation = Quaternion.identity; } } } public class RopeAnchorComponent : MonoBehaviour, Interactable, Hoverable { private class Rope { internal GameObject m_ropeTarget; internal RopeAttachmentTarget m_ropeAnchorTarget; internal GameObject m_ropeObject; internal LineRenderer m_rope; internal BoxCollider m_collider; internal float m_ropeAttachDistance; internal RopeComponent m_ropeComponent; internal Transform m_targetTransform; } private struct RopeAttachmentTarget { public int Id { get; } public byte Index { get; } public RopeAttachmentTarget(int id, byte index) { this = default(RopeAttachmentTarget); Id = id; Index = index; } public override int GetHashCode() { return (Id << 1) & Index; } public override bool Equals(object obj) { if (obj is RopeAttachmentTarget ropeAttachmentTarget && ropeAttachmentTarget.Index == Index) { return ropeAttachmentTarget.Id == Id; } return false; } public static bool operator ==(RopeAttachmentTarget a, RopeAttachmentTarget b) { if (a.Index == b.Index) { return a.Id == b.Id; } return false; } public static bool operator !=(RopeAttachmentTarget a, RopeAttachmentTarget b) { if (a.Index == b.Index) { return a.Id != b.Id; } return true; } } public float m_maxRopeDistance = 64f; internal LineRenderer m_rope; internal ZNetView m_nview; internal Rigidbody m_rigidbody; public static RopeAnchorComponent m_draggingRopeFrom; private List<Rope> m_ropes = new List<Rope>(); private List<Rope> m_updatingRopes = new List<Rope>(); private uint m_zdoDataRevision; private float m_lastRopeCheckTime; internal static GameObject m_draggingRopeTo; private static readonly Dictionary<string, string[]> m_attachmentPoints = GetAttachmentPoints(); public void Awake() { m_rigidbody = ((Component)this).GetComponentInParent<Rigidbody>(); m_rope = ((Component)this).GetComponent<LineRenderer>(); m_nview = ((Component)this).GetComponent<ZNetView>(); WearNTear component = ((Component)this).GetComponent<WearNTear>(); component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(DestroyAllRopes)); LoadFromZDO(); } private void DestroyAllRopes() { while (m_ropes.Count > 0) { RemoveRopeAt(0); } } public string GetHoverName() { return ""; } public string GetHoverText() { if ((Object)(object)m_draggingRopeTo != (Object)(object)this) { return Localization.instance.Localize("[<color=yellow><b>$KEY_Use</b></color>] $mb_rope_anchor_attach_to"); } return Localization.instance.Localize("[<color=yellow><b>$KEY_Use</b></color>] $mb_rope_anchor_attach"); } public bool Interact(Humanoid user, bool hold, bool alt) { if (!Object.op_Implicit((Object)(object)m_draggingRopeFrom)) { m_draggingRopeFrom = this; ((Renderer)m_rope).enabled = true; } else if ((Object)(object)m_draggingRopeFrom == (Object)(object)this) { if ((Object)(object)m_draggingRopeTo != (Object)(object)this) { AttachRope(m_draggingRopeTo, GetIndexAtLocation(m_draggingRopeTo)); } m_draggingRopeFrom = null; ((Renderer)m_rope).enabled = false; } else { m_draggingRopeFrom.AttachRope(this); ((Renderer)m_draggingRopeFrom.m_rope).enabled = false; m_draggingRopeFrom = null; ((Renderer)m_rope).enabled = false; } return true; } private static Dictionary<string, string[]> GetAttachmentPoints() { Dictionary<string, string[]> dictionary = new Dictionary<string, string[]>(); dictionary.Add("Karve(Clone)", new string[5] { "ship/ropes/mastrope", "ship/ropes/RopeAttachLeft_bottom_front", "ship/ropes/RopeAttachLeft_bottom_back", "ship/ropes/RopeAttachRight_bottom_front (1)", "ship/ropes/RopeAttachRight_bottom_back (1)" }); dictionary.Add("VikingShip(Clone)", new string[8] { "interactive/front", "interactive/mast", "interactive/ladder_right", "interactive/ladder_left", "ship/visual/ropes/RopeAttachLeft_bottom_front", "ship/visual/ropes/RopeAttachLeft_bottom_back", "ship/visual/ropes/RopeAttachRight_bottom_front (1)", "ship/visual/ropes/RopeAttachRight_bottom_back (1)" }); dictionary.Add("Deer(Clone)", new string[1] { "Visual/CG/Pelvis/Spine/Spine1/Spine2/Neck" }); dictionary.Add("Boar(Clone)", new string[1] { "Visual/CG/Pelvis/Spine/Spine1/Spine2/Neck" }); dictionary.Add("Boar_piggy(Clone)", new string[1] { "Visual/CG/Pelvis/Spine/Spine1/Spine2/Neck" }); dictionary.Add("Neck(Clone)", new string[1] { "Visual/Armature/Hips/Spine/Spine1/Neck" }); return dictionary; } private Transform GetAttachmentTransform(GameObject go, RopeAttachmentTarget target) { if (m_attachmentPoints.TryGetValue(((Object)go).name, out var value) && target.Index >= 0 && value.Length > target.Index) { Transform val = go.transform.Find(value[target.Index]); if (Object.op_Implicit((Object)(object)val)) { return val; } } return go.transform; } private byte GetIndexAtLocation(GameObject go) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) ZNetView componentInParent = go.GetComponentInParent<ZNetView>(); if (!Object.op_Implicit((Object)(object)componentInParent)) { return 0; } if (m_attachmentPoints.TryGetValue(((Object)((Component)componentInParent).gameObject).name, out var value)) { Vector3 position = ((Component)Player.m_localPlayer).transform.position; byte result = 0; float num = float.MaxValue; for (int i = 0; i < value.Length; i++) { string text = value[i]; Transform val = ((Component)componentInParent).transform.Find(text); if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = position - val.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { result = (byte)i; num = sqrMagnitude; } } } return result; } return 0; } private void AttachRope(GameObject gameObject, byte index) { ZNetView componentInParent = gameObject.GetComponentInParent<ZNetView>(); if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.m_zdo != null) { ZLog.Log((object)$"AttachRope {index}"); RopeAttachmentTarget target = new RopeAttachmentTarget(ZDOPersistantID.Instance.GetOrCreatePersistantID(componentInParent.m_zdo), index); if (!RemoveRopeWithID(target)) { CreateNewRope(target); SaveToZDO(); CheckRopes(); } } } private void AttachRope(RopeAnchorComponent ropeAnchorComponent) { int orCreatePersistantID = ZDOPersistantID.Instance.GetOrCreatePersistantID(ropeAnchorComponent.GetParentZDO()); if (!RemoveRopeWithID(new RopeAttachmentTarget(orCreatePersistantID, 0)) && !((Object)(object)ropeAnchorComponent == (Object)(object)this) && !ropeAnchorComponent.RemoveRopeWithID(new RopeAttachmentTarget(orCreatePersistantID, 0))) { CreateNewRope(new RopeAttachmentTarget(orCreatePersistantID, 0)); SaveToZDO(); CheckRopes(); } } private void CreateNewRope(RopeAttachmentTarget target) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) Rope rope = new Rope(); rope.m_ropeAnchorTarget = target; rope.m_ropeObject = new GameObject("MBRope"); rope.m_ropeObject.layer = LayerMask.NameToLayer("piece_nonsolid"); rope.m_collider = rope.m_ropeObject.AddComponent<BoxCollider>(); rope.m_collider.size = new Vector3(0.1f, 0.1f, 0.1f); rope.m_ropeComponent = rope.m_ropeObject.AddComponent<RopeComponent>(); rope.m_rope = rope.m_ropeObject.AddComponent<LineRenderer>(); rope.m_rope.widthMultiplier = m_rope.widthMultiplier; ((Renderer)rope.m_rope).material = ((Renderer)m_rope).material; rope.m_rope.textureMode = (LineTextureMode)1; rope.m_ropeObject.transform.SetParent(((Component)this).transform.parent); rope.m_ropeObject.transform.localPosition = Vector3.zero; m_ropes.Add(rope); } private ZDO GetParentZDO() { if (!Object.op_Implicit((Object)(object)m_nview) || m_nview.m_zdo == null) { return null; } return m_nview.m_zdo; } private bool RemoveRopeWithID(RopeAttachmentTarget target) { for (int i = 0; i < m_ropes.Count; i++) { if (m_ropes[i].m_ropeAnchorTarget == target) { RemoveRopeAt(i); return true; } } return false; } private void SaveToZDO() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { ZPackage val = new ZPackage(); byte b = 2; val.Write(b); for (int i = 0; i < m_ropes.Count; i++) { val.Write(m_ropes[i].m_ropeAnchorTarget.Id); val.Write(m_ropes[i].m_ropeAnchorTarget.Index); } m_nview.m_zdo.Set("MBRopeAnchor_Ropes", val.GetArray()); } } private void LoadFromZDO() { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.m_zdo != null) { List<RopeAttachmentTarget> list = new List<RopeAttachmentTarget>(); GetRopesFromZDO(list); for (int i = 0; i < list.Count; i++) { CreateNewRope(list[i]); } } } public bool UseItem(Humanoid user, ItemData item) { return false; } public void LateUpdate() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_nview) || m_nview.m_zdo == null) { return; } if (!m_nview.IsOwner() && m_nview.m_zdo.DataRevision != m_zdoDataRevision) { UpdateRopesFromZDO(); } if (((Renderer)m_rope).enabled && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { m_rope.SetPosition(0, ((Component)this).transform.position); if (Object.op_Implicit((Object)(object)m_draggingRopeTo)) { byte indexAtLocation = GetIndexAtLocation(m_draggingRopeTo); Transform attachmentTransform = GetAttachmentTransform(m_draggingRopeTo, new RopeAttachmentTarget(0, indexAtLocation)); if (Object.op_Implicit((Object)(object)attachmentTransform)) { m_rope.SetPosition(1, attachmentTransform.position); } } else { m_rope.SetPosition(1, ((Component)((Humanoid)Player.m_localPlayer).m_visEquipment.m_rightHand).transform.position); } } if (Time.time - m_lastRopeCheckTime > 2f) { CheckRopes(); m_lastRopeCheckTime = Time.time; } for (int i = 0; i < m_updatingRopes.Count; i++) { Rope rope = m_updatingRopes[i]; if (Object.op_Implicit((Object)(object)rope.m_ropeObject) && Object.op_Implicit((Object)(object)rope.m_ropeTarget)) { Vector3 val = ((Component)this).transform.position - rope.m_targetTransform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (m_nview.IsOwner() && (magnitude > m_maxRopeDistance || magnitude > rope.m_ropeAttachDistance + 8f)) { RemoveUpdatingRopeAt(i); continue; } rope.m_rope.SetPosition(0, ((Component)this).transform.position); rope.m_rope.SetPosition(1, rope.m_targetTransform.position); } else { m_updatingRopes.RemoveAt(i); i--; } } } private void CheckRopes() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < m_ropes.Count; i++) { Rope rope = m_ropes[i]; if (Object.op_Implicit((Object)(object)rope.m_ropeTarget)) { continue; } rope.m_ropeTarget = ZDOPersistantID.Instance.GetGameObject(rope.m_ropeAnchorTarget.Id); if (!Object.op_Implicit((Object)(object)rope.m_ropeTarget)) { if (ZNet.instance.IsServer() && ZDOPersistantID.Instance.GetZDO(rope.m_ropeAnchorTarget.Id) == null) { RemoveRopeAt(i); i--; } continue; } Transform attachmentTransform = GetAttachmentTransform(rope.m_ropeTarget, rope.m_ropeAnchorTarget); Vector3 val = ((Component)this).transform.position - attachmentTransform.position; rope.m_ropeAttachDistance = ((Vector3)(ref val)).magnitude; rope.m_targetTransform = attachmentTransform; Rigidbody componentInParent = rope.m_ropeTarget.GetComponentInParent<Rigidbody>(); if (Object.op_Implicit((Object)(object)componentInParent)) { SpringJoint spring = rope.m_ropeComponent.GetSpring(); Rigidbody component = ((Component)rope.m_ropeComponent).GetComponent<Rigidbody>(); component.isKinematic = true; component.useGravity = false; spring.maxDistance = rope.m_ropeAttachDistance + 2f; spring.minDistance = 0f; spring.spring = 10000f; ((Joint)spring).connectedBody = componentInParent; ((Joint)spring).autoConfigureConnectedAnchor = false; ((Joint)spring).anchor = ((Component)component).transform.InverseTransformPoint(((Component)this).transform.position); ((Joint)spring).connectedAnchor = ((Component)componentInParent).transform.InverseTransformPoint(attachmentTransform.position); } if ((!Object.op_Implicit((Object)(object)componentInParent) && (Object)(object)rope.m_ropeTarget.transform.parent == (Object)(object)((Component)this).transform.parent) || (Object)(object)componentInParent == (Object)(object)m_rigidbody) { rope.m_rope.useWorldSpace = false; rope.m_rope.SetPosition(0, ((Component)rope.m_rope).transform.InverseTransformPoint(((Component)this).transform.position)); rope.m_rope.SetPosition(1, ((Component)rope.m_rope).transform.InverseTransformPoint(rope.m_targetTransform.position)); } else { m_updatingRopes.Add(rope); } } } private void UpdateRopesFromZDO() { m_zdoDataRevision = m_nview.m_zdo.DataRevision; HashSet<RopeAttachmentTarget> hashSet = new HashSet<RopeAttachmentTarget>(); GetRopesFromZDO(hashSet); for (int i = 0; i < m_ropes.Count; i++) { Rope rope = m_ropes[i]; if (!hashSet.Contains(rope.m_ropeAnchorTarget)) { RemoveRopeAt(i); i--; } } foreach (RopeAttachmentTarget ropeId in hashSet) { if (!m_ropes.Any((Rope k) => k.m_ropeAnchorTarget == ropeId)) { CreateNewRope(ropeId); } } } public static int GetRopeTarget(ZDOID zdoid) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) ZDO zDO = ZDOMan.instance.GetZDO(zdoid); if (zDO != null) { return ZDOPersistantID.Instance.GetOrCreatePersistantID(zDO); } return ZDOPersistantID.ZDOIDToId(zdoid); } private void GetRopesFromZDO(ICollection<RopeAttachmentTarget> ropeIds) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) try { byte[] byteArray = m_nview.m_zdo.GetByteArray("MBRopeAnchor_Ropes", (byte[])null); if (byteArray != null && byteArray.Length != 0) { ZPackage val = new ZPackage(byteArray); byte b = val.ReadByte(); while (val.GetPos() < val.Size()) { ropeIds.Add(new RopeAttachmentTarget((b <= 1) ? GetRopeTarget(val.ReadZDOID()) : val.ReadInt(), val.ReadByte())); } } } catch (Exception) { Logger.LogInfo((object)"ValheimRaft:RopeAnchorComponent - error gettting rope ZDO"); } } private void RemoveUpdatingRopeAt(int i) { int num = m_ropes.IndexOf(m_updatingRopes[i]); if (num != -1) { RemoveRopeAt(num); } } private void RemoveRopeAt(int i) { Object.Destroy((Object)(object)m_ropes[i].m_ropeObject); m_ropes.RemoveAt(i); SaveToZDO(); } } public class RudderComponent : MonoBehaviour { public ShipControlls m_controls; public Transform m_wheel; public List<Transform> m_spokes = new List<Transform>(); public Vector3 m_leftHandPosition = new Vector3(0f, 0f, 2f); public Vector3 m_rightHandPosition = new Vector3(0f, 0f, -2f); public float m_holdWheelTime = 0.7f; public float m_wheelRotationFactor = 4f; public float m_handIKSpeed = 0.2f; private float m_movingLeftAlpha; private float m_movingRightAlpha; private Transform m_currentLeftHand; private Transform m_currentRightHand; private Transform m_targetLeftHand; private Transform m_targetRightHand; public void UpdateSpokes() { m_spokes.Clear(); m_spokes.AddRange(from k in ((Component)m_wheel).GetComponentsInChildren<Transform>() where ((Object)((Component)k).gameObject).name.StartsWith("grabpoint") select k); } public void UpdateIK(Animator animator) { //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_004e: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0272: 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_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_wheel)) { return; } if (!Object.op_Implicit((Object)(object)m_currentLeftHand)) { m_currentLeftHand = GetNearestSpoke(((Component)this).transform.TransformPoint(m_leftHandPosition)); } if (!Object.op_Implicit((Object)(object)m_currentRightHand)) { m_currentRightHand = GetNearestSpoke(((Component)this).transform.TransformPoint(m_rightHandPosition)); } if (!Object.op_Implicit((Object)(object)m_targetLeftHand) && !Object.op_Implicit((Object)(object)m_targetRightHand)) { Vector3 val = ((Component)this).transform.InverseTransformPoint(m_currentLeftHand.position); Vector3 val2 = ((Component)this).transform.InverseTransformPoint(m_currentRightHand.position); if (val.z < 0.2f) { Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(0f, (val.y > 0.5f) ? (-2f) : 2f, 0f); m_targetLeftHand = GetNearestSpoke(((Component)this).transform.TransformPoint(m_leftHandPosition + val3)); m_movingLeftAlpha = Time.time; } else if (val2.z > -0.2f) { Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(0f, (val2.y > 0.5f) ? (-2f) : 2f, 0f); m_targetRightHand = GetNearestSpoke(((Component)this).transform.TransformPoint(m_rightHandPosition + val4)); m_movingRightAlpha = Time.time; } } float num = Mathf.Clamp01((Time.time - m_movingLeftAlpha) / m_handIKSpeed); float num2 = Mathf.Clamp01((Time.time - m_movingRightAlpha) / m_handIKSpeed); float num3 = Mathf.Sin(num * (float)Math.PI) * (1f - m_holdWheelTime) + m_holdWheelTime; float num4 = Mathf.Sin(num2 * (float)Math.PI) * (1f - m_holdWheelTime) + m_holdWheelTime; if (Object.op_Implicit((Object)(object)m_targetLeftHand) && num > 0.99f) { m_currentLeftHand = m_targetLeftHand; m_targetLeftHand = null; } if (Object.op_Implicit((Object)(object)m_targetRightHand) && num2 > 0.99f) { m_currentRightHand = m_targetRightHand; m_targetRightHand = null; } Vector3 val5 = (Object.op_Implicit((Object)(object)m_targetLeftHand) ? Vector3.Lerp(((Component)m_currentLeftHand).transform.position, ((Component)m_targetLeftHand).transform.position, num) : ((Component)m_currentLeftHand).transform.position); Vector3 val6 = (Object.op_Implicit((Object)(object)m_targetRightHand) ? Vector3.Lerp(((Component)m_currentRightHand).transform.position, ((Component)m_targetRightHand).transform.position, num2) : ((Component)m_currentRightHand).transform.position); Quaternion rotation; if (!Object.op_Implicit((Object)(object)m_targetLeftHand)) { rotation = ((Component)m_currentLeftHand).transform.rotation; _ = ((Quaternion)(ref rotation)).eulerAngles; } else { rotation = ((Component)m_currentLeftHand).transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; rotation = ((Component)m_targetLeftHand).transform.rotation; Vector3.Slerp(eulerAngles, ((Quaternion)(ref rotation)).eulerAngles, num); } animator.SetIKPositionWeight((AvatarIKGoal)2, num3); animator.SetIKPosition((AvatarIKGoal)2, val5); animator.SetIKPositionWeight((AvatarIKGoal)3, num4); animator.SetIKPosition((AvatarIKGoal)3, val6); } public Transform GetNearestSpoke(Vector3 position) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Transform val = null; float num = 0f; for (int i = 0; i < m_spokes.Count; i++) { Transform val2 = m_spokes[i]; Vector3 val3 = ((Component)val2).transform.position - position; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if ((Object)(object)val == (Object)null || sqrMagnitude < num) { val = val2; num = sqrMagnitude; } } return val; } } public class SailComponent : MonoBehaviour, Interactable, Hoverable { [Flags] public enum SailFlags { None = 0, AllowSailShrinking = 1, DisableCloth = 2 } [Flags] public enum SailLockedSide { None = 0, A = 1, B = 2, C = 4, D = 8, Everything = 0xF } private MastComponent m_mastComponent; public ZNetView m_nview; public SkinnedMeshRenderer m_mesh; public MeshCollider m_meshCollider; public Cloth m_sailCloth; public GameObject m_sailObject; public List<Vector3> m_sailCorners = new List<Vector3>(); public float m_sailSubdivision = 0.5f; public static List<SailComponent> m_sailComponents = new List<SailComponent>(); public static float m_maxDistanceSqr = 1024f; private static EditSailComponentPanel m_editPanel = null; internal static bool m_sailInit = true; public SailFlags m_sailFlags; public float m_windMultiplier = 10f; public float m_clothRandomAccelerationFactor = 0.5f; public SailLockedSide m_lockedSailSides; public SailLockedSide m_lockedSailCorners; public int m_patternHash; public Vector2 m_patternScale; public Vector2 m_patternOffset; public Color m_patternColor; public float m_patternRotation; public int m_logoHash; public Vector2 m_logoScale; public Vector2 m_logoOffset; public Color m_logoColor; public float m_logoRotation; private int m_mainHash; private Vector2 m_mainScale; private Vector2 m_mainOffset; private Color m_mainColor; public void Awake() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown m_sailComponents.Add(this); m_mastComponent = ((Component)this).GetComponent<MastComponent>(); m_sailObject = ((Component)((Component)this).transform.Find("Sail")).gameObject; m_sailCloth = m_sailObject.GetComponent<Cloth>(); if (Object.op_Implicit((Object)m_sailCloth)) { m_sailCloth.useTethers = false; m_sailCloth.useGravity = true; m_sailCloth.bendingStiffness = 1f; } m_mesh = m_sailObject.GetComponent<SkinnedMeshRenderer>(); m_meshCollider = m_sailObject.GetComponent<MeshCollider>(); m_nview = ((Component)this).GetComponent<ZNetView>(); if (m_sailInit) { LoadZDO(); } else if (!ZNetView.m_forceDisableInit) { ((MonoBehaviour)this).InvokeRepeating("LoadZDO", 5f, 5f); } } public void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector3 windForce = EnvMan.instance.GetWindForce(); m_sailCloth.externalAcceleration = windForce * m_windMultiplier; m_sailCloth.randomAcceleration = windForce * (m_windMultiplier * m_clothRandomAccelerationFactor); } public void OnDestroy() { m_sailComponents.Remove(this); } public void SetAllowSailShrinking(bool allow) { if (Object.op_Implicit((Object)(object)m_mastComponent)) { m_sailFlags = (allow ? (m_sailFlags | SailFlags.AllowSailShrinking) : (m_sailFlags & ~SailFlags.AllowSailShrinking)); m_mastComponent.m_allowSailShrinking = allow; } } public void SetDisableCloth(bool allow) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)m_mastComponent)) { m_sailFlags = (allow ? (m_sailFlags | SailFlags.DisableCloth) : (m_sailFlags & ~SailFlags.DisableCloth)); m_mastComponent.m_disableCloth = allow; if (Object.op_Implicit((Object)m_sailCloth) && m_sailCloth.enabled != !allow) { m_sailCloth.enabled = !allow; } } } public void LoadFromMaterial() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) Material sailMaterial = GetSailMaterial(); Texture texture = sailMaterial.GetTexture("_MainTex"); if (CustomTextur