Decompiled source of Extra Snap Points Made Easy v2.0.1
ExtraSnapsMadeEasy.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExtraSnapsMadeEasy.Configs; using ExtraSnapsMadeEasy.Extensions; using ExtraSnapsMadeEasy.ExtraSnapPoints; using ExtraSnapsMadeEasy.Models; using ExtraSnapsMadeEasy.Patches; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ExtraSnapPointsMadeEasy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ExtraSnapPointsMadeEasy")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b2e20761-66b2-4727-a49f-fc11433a2125")] [assembly: AssemblyFileVersion("2.0.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.1.0")] [module: UnverifiableCode] public sealed class ConfigurationManagerAttributes { public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput); public bool? ShowRangeAsPercent; public Action<ConfigEntryBase> CustomDrawer; public CustomHotkeyDrawerFunc CustomHotkeyDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public string Description; public string DispName; public int? Order; public bool? ReadOnly; public bool? IsAdvanced; public Func<object, string> ObjToStr; public Func<string, object> StrToObj; } namespace ExtraSnapsMadeEasy { [BepInPlugin("Searica.Valheim.ExtraSnapPointsMadeEasy", "ExtraSnapPointsMadeEasy", "2.0.1")] internal sealed class ExtraSnapsPlugin : BaseUnityPlugin { public const string PluginName = "ExtraSnapPointsMadeEasy"; public const string Author = "Searica"; public const string PluginGUID = "Searica.Valheim.ExtraSnapPointsMadeEasy"; public const string PluginVersion = "2.0.1"; internal static ExtraSnapsPlugin Instance; private const string MainSection = "1 - Global"; private const string SnapModeSection = "2 - Manual Snapping"; private const string ExtraSnapsSection = "3 - \u200bExtra Snap Points"; private const string PrefabSnapSettings = "4 - Individual Snap Point Settings"; internal static readonly Dictionary<string, ConfigEntry<bool>> SnapPointSettings = new Dictionary<string, ConfigEntry<bool>>(); public ConfigEntry<bool> VanillaManualSnapEnabled { get; private set; } public ConfigEntry<KeyCode> TogglePreciseSnap { get; private set; } public ConfigEntry<KeyCode> ToggleManualSnap { get; private set; } public ConfigEntry<KeyCode> ToggleGridSnap { get; private set; } public ConfigEntry<KeyCode> CycleGridPrecision { get; private set; } public ConfigEntry<KeyCode> IterateSourceSnapPoints { get; private set; } public ConfigEntry<KeyCode> IterateTargetSnapPoints { get; private set; } public ConfigEntry<bool> ResetSnapsOnNewPiece { get; private set; } public ConfigEntry<bool> EnableExtraSnapPoints { get; private set; } public ConfigEntry<bool> EnableLineSnapPoints { get; private set; } public ConfigEntry<bool> EnableTriangleSnapPoints { get; private set; } public ConfigEntry<bool> EnableRect2DSnapPoints { get; private set; } public ConfigEntry<bool> EnableRoofTopSnapPoints { get; private set; } public ConfigEntry<bool> EnableTerrainOpSnapPoints { get; private set; } internal ConfigEntry<MessageType> NotificationType { get; private set; } internal bool ShouldUpdateExtraSnaps { get; set; } private void Awake() { Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Config.Init("Searica.Valheim.ExtraSnapPointsMadeEasy"); SetUpConfigEntries(); ((BaseUnityPlugin)this).Config.Save(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Searica.Valheim.ExtraSnapPointsMadeEasy"); Game.isModded = true; ((BaseUnityPlugin)this).Config.SetupWatcher(); ConfigFileManager.CheckForConfigManager(); ConfigFileManager.OnConfigWindowClosed += delegate { ExtraSnapsAdder.AddExtraSnapPoints("Config settings changed, re-initializing"); }; ConfigFileManager.OnConfigFileReloaded += delegate { ExtraSnapsAdder.AddExtraSnapPoints("Config settings changed after reloading config file, re-initializing"); }; } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } public void SetUpConfigEntries() { Log.Verbosity = ((BaseUnityPlugin)this).Config.BindConfig("1 - Global", "Verbosity", LogLevel.Low, "Low will log basic information about the mod. Medium will log information that is useful for troubleshooting. High will log a lot of information, do not set it to this without good reason as it will slow down your game."); VanillaManualSnapEnabled = ((BaseUnityPlugin)this).Config.BindConfig("1 - Global", "Vanilla Manual Snapping", value: false, "Whether vanilla manual snapping is enabled. If disabled then the vanilla keybinds for manual snapping will have no effect."); TogglePreciseSnap = ((BaseUnityPlugin)this).Config.BindConfig<KeyCode>("2 - Manual Snapping", "Toggle Manual+ Snap Mode", (KeyCode)308, "This key will enable or disable manual snapping mode."); ToggleManualSnap = ((BaseUnityPlugin)this).Config.BindConfig<KeyCode>("2 - Manual Snapping", "Toggle Manual Snap Mode", (KeyCode)301, "This key will enable or disable manual closest snapping mode."); ToggleGridSnap = ((BaseUnityPlugin)this).Config.BindConfig<KeyCode>("2 - Manual Snapping", "Toggle Grid Snap Mode", (KeyCode)284, "This key will enable or disable snap to grid mode."); CycleGridPrecision = ((BaseUnityPlugin)this).Config.BindConfig<KeyCode>("2 - Manual Snapping", "Cycle Grid Snap Precision", (KeyCode)285, "This key will change the precision of the grid in when in grid mode."); IterateSourceSnapPoints = ((BaseUnityPlugin)this).Config.BindConfig<KeyCode>("2 - Manual Snapping", "Iterate Placing Piece Snap Points", (KeyCode)113, "This key will cycle through the snap points on the piece you are placing."); IterateTargetSnapPoints = ((BaseUnityPlugin)this).Config.BindConfig<KeyCode>("2 - Manual Snapping", "Iterate Targeted Piece Points", (KeyCode)101, "This key will cycle through the snap points on the piece you are attaching to."); ResetSnapsOnNewPiece = ((BaseUnityPlugin)this).Config.BindConfig("2 - Manual Snapping", "Reset Snaps On New Piece", value: false, "Controls if the selected snap point is reset for each placement, defaults to not reset.This means your selections carry over between placements."); NotificationType = ((BaseUnityPlugin)this).Config.BindConfig<MessageType>("2 - Manual Snapping", "Notification Type", (MessageType)2, "Set the type of notification for when manual snapping mode is changed or selected snap points are changed. \"Center\" will display in the center of the screen in large yellow text. \"TopLeft\" will display under the hotkey bar in small white text."); EnableExtraSnapPoints = ((BaseUnityPlugin)this).Config.BindConfig("3 - \u200bExtra Snap Points", "Extra Snap Points", value: true, "Globally enable/disable all extra snap points."); EnableExtraSnapPoints.SettingChanged += SnapSettingChanged; EnableLineSnapPoints = ((BaseUnityPlugin)this).Config.BindConfig("3 - \u200bExtra Snap Points", "Extra Snap Points: Line", value: true, "Enabled adds extra snap points for all \"Line\" pieces. Disabled will prevent extra snap points being added to any \"Line\" pieces."); EnableLineSnapPoints.SettingChanged += SnapSettingChanged; EnableTriangleSnapPoints = ((BaseUnityPlugin)this).Config.BindConfig("3 - \u200bExtra Snap Points", "Extra Snap Points: Triangle", value: true, "Enabled adds extra snap points for all \"Triangle\" pieces. Disabled will prevent extra snap points being added to any \"Triangle\" pieces."); EnableTriangleSnapPoints.SettingChanged += SnapSettingChanged; EnableRect2DSnapPoints = ((BaseUnityPlugin)this).Config.BindConfig("3 - \u200bExtra Snap Points", "Extra Snap Points: 2D-Rectangle", value: true, "Enabled adds extra snap points for all \"Rect2D\" pieces. Disabled will prevent extra snap points being added to any \"Rect2D\" pieces."); EnableRect2DSnapPoints.SettingChanged += SnapSettingChanged; EnableRoofTopSnapPoints = ((BaseUnityPlugin)this).Config.BindConfig("3 - \u200bExtra Snap Points", "Extra Snap Points: Roof Top", value: true, "Enabled adds extra snap points for all \"RoofTop\" pieces. Disabled will prevent extra snap points being added to any \"RoofTop\" pieces."); EnableRoofTopSnapPoints.SettingChanged += SnapSettingChanged; EnableTerrainOpSnapPoints = ((BaseUnityPlugin)this).Config.BindConfig("3 - \u200bExtra Snap Points", "Extra Snap Points: Terrain", value: false, "Enabled adds extra snap points for all \"TerrainOp\" pieces like the level ground tool in the Hoe. Disabled will prevent extra snap points being added to any \"TerrainOp\" pieces."); EnableTerrainOpSnapPoints.SettingChanged += SnapSettingChanged; } internal ConfigEntry<bool> LoadConfig(GameObject gameObject) { ConfigEntry<bool> val = ((BaseUnityPlugin)this).Config.BindConfig("4 - Individual Snap Point Settings", ((Object)gameObject).name, value: true, "Set to true/enabled to enable snap points for this prefab and false/disabled to disable them."); val.SettingChanged += SnapSettingChanged; SnapPointSettings[((Object)gameObject).name] = val; return val; } private void SnapSettingChanged(object o, EventArgs e) { if (!ShouldUpdateExtraSnaps) { ShouldUpdateExtraSnaps = true; } } public void ReInitExtraSnapPoints() { ExtraSnapsAdder.AddExtraSnapPoints("External mod triggered a re-initialization, adding extra snap points", forceUpdate: true); } } internal enum LogLevel { Low, Medium, High } internal static class Log { internal static ManualLogSource _logSource; private const BindingFlags AllBindings = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty; internal static ConfigEntry<LogLevel> Verbosity { get; set; } internal static LogLevel VerbosityLevel => Verbosity.Value; internal static bool IsVerbosityLow => Verbosity.Value >= LogLevel.Low; internal static bool IsVerbosityMedium => Verbosity.Value >= LogLevel.Medium; internal static bool IsVerbosityHigh => Verbosity.Value >= LogLevel.High; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data, LogLevel level = LogLevel.Low) { if (Verbosity == null || VerbosityLevel >= level) { _logSource.LogInfo(data); } } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } internal static void LogGameObject(GameObject prefab, bool includeChildren = false) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown LogInfo("***** " + ((Object)prefab).name + " *****"); Component[] components = prefab.GetComponents<Component>(); for (int i = 0; i < components.Length; i++) { LogComponent(components[i]); } if (!includeChildren) { return; } LogInfo("***** " + ((Object)prefab).name + " (children) *****"); foreach (Transform item in prefab.transform) { Transform val = item; LogInfo(" - " + ((Object)((Component)val).gameObject).name); components = ((Component)val).gameObject.GetComponents<Component>(); for (int i = 0; i < components.Length; i++) { LogComponent(components[i]); } } } internal static void LogComponent(Component compo) { LogInfo("--- " + ((object)compo).GetType().Name + ": " + ((Object)compo).name + " ---"); PropertyInfo[] properties = ((object)compo).GetType().GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty); foreach (PropertyInfo propertyInfo in properties) { LogInfo($" - {propertyInfo.Name} = {propertyInfo.GetValue(compo)}"); } FieldInfo[] fields = ((object)compo).GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty); foreach (FieldInfo fieldInfo in fields) { LogInfo($" - {fieldInfo.Name} = {fieldInfo.GetValue(compo)}"); } } } } namespace ExtraSnapsMadeEasy.SnapKeyHints { internal sealed class KeyHintInfo { public enum KeyHintVisibility { DoNotChange, Show, Hide } internal sealed class HorizontalLayoutSettings { public float minHeight = -1f; public float preferredHeight = -1f; public float flexibleHeight = -1f; public float minWidth = -1f; public float preferredWidth = -1f; public float flexibleWidth = -1f; } internal sealed class KeyHintConfig { internal string TransformPath; internal ConfigEntry<KeyCode> KeyConfig; internal string RawKeyText; internal KeyHintVisibility Visibility; public bool ShouldChangeVisibility => Visibility != KeyHintVisibility.DoNotChange; public bool ShouldHide => Visibility == KeyHintVisibility.Hide; public bool ShouldShow => Visibility == KeyHintVisibility.Show; public string KeyText { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (KeyConfig == null) { return RawKeyText; } KeyCode value = KeyConfig.Value; return ((object)(KeyCode)(ref value)).ToString(); } } public KeyHintConfig() { } public KeyHintConfig(string transformPath, ConfigEntry<KeyCode> keyConfig, string rawKeyText = "", KeyHintVisibility visibility = KeyHintVisibility.DoNotChange) { TransformPath = transformPath; KeyConfig = keyConfig; RawKeyText = rawKeyText; Visibility = visibility; } } public GameObject BoundObject; public string TransformPath; public HorizontalLayoutSettings HoriLayoutSettings = new HorizontalLayoutSettings(); public Dictionary<string, string> HintText; public int PreferredTextWidth = -1; public List<KeyHintConfig> KeyHintConfigs; public bool IsValid() { return (Object)(object)BoundObject != (Object)null; } public void SetParentObject(KeyHints keyHints) { Transform val = ((Component)keyHints).transform.Find(TransformPath); if ((Object)(object)val == (Object)null) { Log.LogWarning(TransformPath + " is no longer valid, could not find Snap key hint"); } else { BoundObject = ((Component)val).gameObject; } } public void SubscribeToKeyConfigUpdates(bool performInitialUpdate) { if (performInitialUpdate) { UpdateKeyHintUI(); } foreach (KeyHintConfig keyHintConfig in KeyHintConfigs) { keyHintConfig.KeyConfig.SettingChanged += delegate { UpdateKeyHintUI(); }; } } public void UpdateKeyHintUI() { if (!IsValid()) { return; } TextMeshProUGUI val2 = default(TextMeshProUGUI); LayoutElement val3 = default(LayoutElement); foreach (KeyValuePair<string, string> item in HintText) { Transform val = BoundObject.transform.Find(item.Key); if (!((Object)(object)val == (Object)null) && ((Component)val).TryGetComponent<TextMeshProUGUI>(ref val2)) { ((TMP_Text)val2).text = item.Value; if (PreferredTextWidth > 0 && ((Component)val).TryGetComponent<LayoutElement>(ref val3)) { val3.preferredWidth = PreferredTextWidth; } } } TextMeshProUGUI val5 = default(TextMeshProUGUI); foreach (KeyHintConfig keyHintConfig in KeyHintConfigs) { Transform val4 = BoundObject.transform.Find(keyHintConfig.TransformPath); if (!((Object)(object)val4 == (Object)null) && ((Component)val4).TryGetComponent<TextMeshProUGUI>(ref val5)) { ((TMP_Text)val5).text = keyHintConfig.KeyText; if (keyHintConfig.ShouldChangeVisibility && TryGetKeyHintTransformPathParent(keyHintConfig, out var keyHintParent)) { ((Component)keyHintParent).gameObject.SetActive(keyHintConfig.ShouldShow); } } } Log.LogInfo("Updated " + ((Object)BoundObject).name + " key hint"); } public void SetVisibility(bool visible) { if (IsValid()) { BoundObject.SetActive(visible); } } private bool TryGetKeyHintTransformPathParent(KeyHintConfig keyHintConfig, out Transform keyHintParent) { string text = keyHintConfig.TransformPath.Split(new char[1] { '/' })[0]; keyHintParent = BoundObject.transform.Find(text); return (Object)(object)keyHintParent != (Object)null; } internal void CreateKeysIfNeeded() { if (!IsValid()) { return; } Transform keyHintParent = null; string text = null; foreach (KeyHintConfig keyHintConfig in KeyHintConfigs) { if (Object.op_Implicit((Object)(object)BoundObject.transform.Find(keyHintConfig.TransformPath)) && TryGetKeyHintTransformPathParent(keyHintConfig, out keyHintParent)) { text = keyHintConfig.TransformPath; break; } } if (keyHintParent == null) { Log.LogError("Could not create a template key for " + ((Object)BoundObject).name); } foreach (KeyHintConfig keyHintConfig2 in KeyHintConfigs) { if (keyHintConfig2.TransformPath == text || Object.op_Implicit((Object)(object)BoundObject.transform.Find(keyHintConfig2.TransformPath))) { continue; } Transform val = Object.Instantiate<GameObject>(((Component)keyHintParent).gameObject, keyHintParent.parent).transform; string[] array = keyHintConfig2.TransformPath.Split(new char[1] { '/' }); for (int i = 0; i < array.Length; i++) { if (val.childCount > 1) { Log.LogError("TransformPath " + text + " has branching children."); throw new ArgumentException("TransformPath " + text + " has branching children."); } ((Object)val).name = array[i]; if (val.childCount == 1) { val = val.GetChild(0); } else if (i != array.Length - 1) { Log.LogError("TransformPath " + text + " is missing children."); throw new ArgumentException("TransformPath " + text + " is missing children."); } } } } } [HarmonyPatch] internal static class KeyHintPatches { private const string ToggleSnapModeHintInternalName = "ToggleSnapMode"; private const string CurrentSnapModeHintInternalName = "CurrentSnapMode"; internal static readonly KeyHintInfo CycleSnapsHintInfo = new KeyHintInfo { BoundObject = null, TransformPath = "BuildHints/Keyboard/Snap", HintText = new Dictionary<string, string> { { "Text", "Next snap point<br>Placing / Target" } }, PreferredTextWidth = 130, KeyHintConfigs = new List<KeyHintInfo.KeyHintConfig> { new KeyHintInfo.KeyHintConfig("key_bkg/Key", ExtraSnapsPlugin.Instance.IterateSourceSnapPoints), new KeyHintInfo.KeyHintConfig("key_bkg (1)/Key", ExtraSnapsPlugin.Instance.IterateTargetSnapPoints) } }; internal static readonly KeyHintInfo AltPlaceHintInfo = new KeyHintInfo { BoundObject = null, TransformPath = "BuildHints/Keyboard/AltPlace", HintText = new Dictionary<string, string> { { "Text", "Disable<br>snapping" } }, PreferredTextWidth = 90, KeyHintConfigs = new List<KeyHintInfo.KeyHintConfig>() }; internal static readonly KeyHintInfo ToggleSnapModeHintInfo = new KeyHintInfo { BoundObject = null, TransformPath = "BuildHints/Keyboard/ToggleSnapMode", HintText = new Dictionary<string, string> { { "Text", "Toggle snap mode<br>Manual/Manual+/Grid" } }, PreferredTextWidth = 170, KeyHintConfigs = new List<KeyHintInfo.KeyHintConfig> { new KeyHintInfo.KeyHintConfig("key_bkg/Key", ExtraSnapsPlugin.Instance.ToggleManualSnap), new KeyHintInfo.KeyHintConfig("key_bkg (1)/Key", ExtraSnapsPlugin.Instance.TogglePreciseSnap), new KeyHintInfo.KeyHintConfig("key_bkg (2)/Key", ExtraSnapsPlugin.Instance.ToggleGridSnap) } }; internal static readonly KeyHintInfo CurrentSnapModeHintInfo = new KeyHintInfo { BoundObject = null, TransformPath = "BuildHints/Keyboard/CurrentSnapMode", HintText = new Dictionary<string, string> { { "Text", "Snap<br>Mode" } }, PreferredTextWidth = 50, KeyHintConfigs = new List<KeyHintInfo.KeyHintConfig> { new KeyHintInfo.KeyHintConfig("key_bkg/Key", null, SnapModeManager.CurrentSnapModeName) } }; [HarmonyPostfix] [HarmonyPatch(typeof(KeyHints), "Awake")] internal static void KeyHints_Awake_Postfix(KeyHints __instance) { if (Object.op_Implicit((Object)(object)__instance)) { CycleSnapsHintInfo.SetParentObject(__instance); CycleSnapsHintInfo.SubscribeToKeyConfigUpdates(performInitialUpdate: true); AltPlaceHintInfo.SetParentObject(__instance); AltPlaceHintInfo.UpdateKeyHintUI(); AltPlaceHintInfo.SetVisibility(SnapModeManager.IsAutoSnapMode); SnapModeManager.OnSnapModeChanged += delegate { AltPlaceHintInfo.SetVisibility(SnapModeManager.IsAutoSnapMode); }; ToggleSnapModeHintInfo.BoundObject = Object.Instantiate<GameObject>(AltPlaceHintInfo.BoundObject, AltPlaceHintInfo.BoundObject.transform.parent); ((Object)ToggleSnapModeHintInfo.BoundObject).name = "ToggleSnapMode"; ToggleSnapModeHintInfo.CreateKeysIfNeeded(); ToggleSnapModeHintInfo.SubscribeToKeyConfigUpdates(performInitialUpdate: true); CurrentSnapModeHintInfo.BoundObject = Object.Instantiate<GameObject>(AltPlaceHintInfo.BoundObject, AltPlaceHintInfo.BoundObject.transform.parent); ((Object)CurrentSnapModeHintInfo.BoundObject).name = "CurrentSnapMode"; CurrentSnapModeHintInfo.UpdateKeyHintUI(); SnapModeManager.OnSnapModeChanged += delegate { CurrentSnapModeHintInfo.KeyHintConfigs[0].RawKeyText = SnapModeManager.CurrentSnapModeName; CurrentSnapModeHintInfo.UpdateKeyHintUI(); }; } } } } namespace ExtraSnapsMadeEasy.Patches { [HarmonyPatch] internal static class DisableVanillaManualSnapPatches { [HarmonyPrefix] [HarmonyPriority(0)] [HarmonyPatch(typeof(Player), "UpdatePlacementGhost")] internal static void UpdatePlacementGhost_Postfix(Player __instance) { ResetManualSnapPointToAuto(); } internal static void ResetManualSnapPointToAuto() { if (!ExtraSnapsPlugin.Instance.VanillaManualSnapEnabled.Value && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { Player.m_localPlayer.m_manualSnapPoint = -1; } } [HarmonyTranspiler] [HarmonyPatch(typeof(Player), "UpdatePlacementGhost")] internal static IEnumerable<CodeInstruction> UpdatePlacementGhost_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) CodeMatch[] array = (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Player), "m_tempSnapPoints1"), (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(List<Transform>), "Clear", (Type[])null, (Type[])null), (string)null) }; return new CodeMatcher(instructions, (ILGenerator)null).MatchStartForward(array).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Action>((Action)ResetManualSnapPointToAuto) }).InstructionEnumeration(); } } [HarmonyPatch] internal class SnapModeManager { private static int CurrentSourceSnap = 0; private static int CurrentTargetSnap = 0; internal static SnapModes.SnapMode CurrentSnapMode; internal static GridSnapping.GridPrecision CurrentGridPrecision; private static float CurrentGridPrecisionValue = GridSnapping.GridPrecisionMap[GridSnapping.GridPrecision.Low]; private static Transform currentTargetParent; private static Transform currentSourceParent; private static readonly List<Transform> TempSourceSnapPoints = new List<Transform>(); private static readonly List<Transform> TempTargetSnapPoints = new List<Transform>(); internal static string CurrentSnapModeName => SnapModes.SnapModeNames[CurrentSnapMode]; internal static bool IsAutoSnapMode => CurrentSnapMode == SnapModes.SnapMode.Auto; internal static bool IsPreciseSnapMode => CurrentSnapMode == SnapModes.SnapMode.Precise; internal static bool IsManualSnapMode => CurrentSnapMode == SnapModes.SnapMode.Manual; internal static bool IsGridSnapMode => CurrentSnapMode == SnapModes.SnapMode.Grid; internal static event Action OnSnapModeChanged; private static void InvokeOnSnapModeChanged() { SnapModeManager.OnSnapModeChanged?.SafeInvoke(); } [HarmonyPostfix] [HarmonyPatch(typeof(Player), "UpdatePlacementGhost")] private static void UpdatePlacementGhostPostfix(Player __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) if (!Object.op_Implicit((Object)(object)__instance) || !((Character)__instance).InPlaceMode() || ((Character)__instance).IsDead()) { return; } SnapModes.SnapMode currentSnapMode = CurrentSnapMode; if (Input.GetKeyDown(ExtraSnapsPlugin.Instance.TogglePreciseSnap.Value)) { CurrentSnapMode = ((!IsPreciseSnapMode) ? SnapModes.SnapMode.Precise : SnapModes.SnapMode.Auto); } else if (Input.GetKeyDown(ExtraSnapsPlugin.Instance.ToggleManualSnap.Value)) { CurrentSnapMode = ((!IsManualSnapMode) ? SnapModes.SnapMode.Manual : SnapModes.SnapMode.Auto); } else if (Input.GetKeyDown(ExtraSnapsPlugin.Instance.ToggleGridSnap.Value)) { CurrentSnapMode = ((!IsGridSnapMode) ? SnapModes.SnapMode.Grid : SnapModes.SnapMode.Auto); } if (CurrentSnapMode != currentSnapMode) { InvokeOnSnapModeChanged(); ((Character)__instance).Message(ExtraSnapsPlugin.Instance.NotificationType.Value, "Snap Mode: " + CurrentSnapModeName, 0, (Sprite)null); } if (Object.op_Implicit((Object)(object)__instance.m_placementGhost) && CurrentSnapMode != 0) { if (IsPreciseSnapMode || IsManualSnapMode) { SnapManually(ref __instance); } if (IsGridSnapMode) { SnapToGrid(ref __instance); } } } private static void SnapToGrid(ref Player player) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00df: 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) Piece val = default(Piece); if (!Object.op_Implicit((Object)(object)player) || !Object.op_Implicit((Object)(object)player.m_placementGhost) || !player.m_placementGhost.TryGetComponent<Piece>(ref val)) { return; } if (Input.GetKeyDown(ExtraSnapsPlugin.Instance.CycleGridPrecision.Value)) { if (CurrentGridPrecision == GridSnapping.GridPrecision.Low) { CurrentGridPrecision = GridSnapping.GridPrecision.High; } else { CurrentGridPrecision = GridSnapping.GridPrecision.Low; } CurrentGridPrecisionValue = GridSnapping.GridPrecisionMap[CurrentGridPrecision]; ((Character)player).Message(ExtraSnapsPlugin.Instance.NotificationType.Value, $"Grid Precision: {CurrentGridPrecisionValue}", 0, (Sprite)null); } Vector3 position = player.m_placementGhost.transform.position; position.x = position.x.RoundToNearest(CurrentGridPrecisionValue); position.z = position.z.RoundToNearest(CurrentGridPrecisionValue); player.m_placementGhost.transform.position = position; } private static void SnapManually(ref Player player) { //IL_00c5: 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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) Piece val = default(Piece); if (!Object.op_Implicit((Object)(object)player) || !Object.op_Implicit((Object)(object)player.m_placementGhost) || (!player.m_placementGhost.TryGetComponent<Piece>(ref val) && Object.op_Implicit((Object)(object)val)) || !TryGetTargetPiece(player, val, out var targetPiece)) { return; } if ((Object)(object)currentSourceParent != (Object)(object)((Component)val).transform) { if (ExtraSnapsPlugin.Instance.ResetSnapsOnNewPiece.Value || CurrentSourceSnap < 0) { CurrentSourceSnap = 0; } currentSourceParent = ((Component)val).transform; } if ((Object)(object)currentTargetParent != (Object)(object)((Component)targetPiece).transform) { if (ExtraSnapsPlugin.Instance.ResetSnapsOnNewPiece.Value || CurrentTargetSnap < 0) { CurrentTargetSnap = 0; } currentTargetParent = ((Component)targetPiece).transform; } int currentSourceSnap = CurrentSourceSnap; if (Input.GetKeyDown(ExtraSnapsPlugin.Instance.IterateSourceSnapPoints.Value)) { CurrentSourceSnap++; } int currentTargetSnap = CurrentTargetSnap; if (Input.GetKeyDown(ExtraSnapsPlugin.Instance.IterateTargetSnapPoints.Value)) { CurrentTargetSnap++; } TempSourceSnapPoints.Clear(); val.GetSnapPoints(TempSourceSnapPoints); TempTargetSnapPoints.Clear(); targetPiece.GetSnapPoints(TempTargetSnapPoints); if (TempSourceSnapPoints.Count == 0 || TempTargetSnapPoints.Count == 0) { Log.LogInfo("No snap points!"); return; } if (CurrentSourceSnap >= TempSourceSnapPoints.Count) { CurrentSourceSnap = 0; } if (CurrentTargetSnap >= TempTargetSnapPoints.Count) { CurrentTargetSnap = 0; } Transform val2 = TempSourceSnapPoints[CurrentSourceSnap]; Transform val3; switch (CurrentSnapMode) { case SnapModes.SnapMode.Precise: val3 = TempTargetSnapPoints[CurrentTargetSnap]; break; case SnapModes.SnapMode.Manual: { if (!Object.op_Implicit((Object)(object)player.m_placementMarkerInstance)) { return; } Vector3 markerPosition = player.m_placementMarkerInstance.transform.position; val3 = TempTargetSnapPoints.OrderBy((Transform snapPoint) => Vector3.Distance(markerPosition, snapPoint.position)).First(); break; } default: return; } if (currentSourceSnap != CurrentSourceSnap) { string text = (HasFriendlySnapName(val2) ? ((Object)val2).name : $"Point {CurrentSourceSnap + 1}"); ((Character)player).Message(ExtraSnapsPlugin.Instance.NotificationType.Value, "Placing Snap Point: " + text, 0, (Sprite)null); } if (IsPreciseSnapMode && currentTargetSnap != CurrentTargetSnap) { string text2 = (HasFriendlySnapName(val3) ? ((Object)val3).name : $"Point {CurrentTargetSnap + 1}"); ((Character)player).Message(ExtraSnapsPlugin.Instance.NotificationType.Value, "Target Snap Point: " + text2, 0, (Sprite)null); } Transform transform = player.m_placementGhost.transform; transform.position += val3.position - val2.position; } private static bool TryGetTargetPiece(Player player, Piece placementGhostPiece, out Piece targetPiece) { bool flag = placementGhostPiece.m_waterPiece || placementGhostPiece.m_noInWater; Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); Heightmap val3 = default(Heightmap); Collider val4 = default(Collider); player.PieceRayTest(ref val, ref val2, ref targetPiece, ref val3, ref val4, flag); return Object.op_Implicit((Object)(object)targetPiece); } private static bool HasFriendlySnapName(Transform snapPoint) { string name = ((Object)snapPoint).name; if (name != null) { return !(name == "_snappoint"); } return false; } } [HarmonyPatch(typeof(ZoneSystem))] internal class ZoneSystemPatch { [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch("Start")] public static void Start() { ExtraSnapsAdder.AddExtraSnapPoints("Adding extra snap points", forceUpdate: true); } } } namespace ExtraSnapsMadeEasy.Models { internal static class GridSnapping { internal enum GridPrecision { Low, High } internal static Dictionary<GridPrecision, float> GridPrecisionMap = new Dictionary<GridPrecision, float> { { GridPrecision.High, 0.5f }, { GridPrecision.Low, 1f } }; } internal sealed class NamedSnapPoint { public Vector3 LocalPosition { get; } public string Name { get; } public int? RequestedIndex { get; } public NamedSnapPoint(Vector3 localPosition, string name, int? requestedIndex = null) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) LocalPosition = localPosition; Name = name; RequestedIndex = requestedIndex; } public NamedSnapPoint(float x, float y, float z, string name, int? requestedIndex = null) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) LocalPosition = new Vector3(x, y, z); Name = name; RequestedIndex = requestedIndex; } public override string ToString() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return $"{LocalPosition} [{Name}]"; } } internal static class SnapModes { internal enum SnapMode { Auto, Manual, Precise, Grid } internal static readonly Dictionary<SnapMode, string> SnapModeNames = new Dictionary<SnapMode, string> { { SnapMode.Auto, "Auto" }, { SnapMode.Manual, "Manual" }, { SnapMode.Precise, "Manual+" }, { SnapMode.Grid, "Grid" } }; private static string AutoModeName => SnapModeNames[SnapMode.Auto]; internal static string GetSnapModeNames(string separator = "/") { return string.Join(separator, SnapModeNames.Values.Where((string x) => x != AutoModeName).ToArray()); } } internal static class SnapPointNames { public const string TOP = "$hud_snappoint_top"; public const string BOTTOM = "$hud_snappoint_bottom"; public const string CENTER = "$hud_snappoint_center"; public const string CORNER = "$hud_snappoint_corner"; public const string EDGE = "$hud_snappoint_edge"; public const string MID = "$hud_snappoint_mid"; public const string INNER = "$hud_snappoint_inner"; public const string OUTER = "Outer"; public const string SNAPPOINT = "Snappoint"; public const string ORIGIN = "Origin"; public const string EXTRA = "Extra"; public const string TAG = "snappoint"; public const string DEFAULT_NAME = "_snappoint"; } } namespace ExtraSnapsMadeEasy.ExtraSnapPoints { internal class ExtraSnapsAdder { private static readonly NamedSnapPoint[] Empty = Array.Empty<NamedSnapPoint>(); private static readonly NamedSnapPoint[] OriginSnapPointArray = new NamedSnapPoint[1] { new NamedSnapPoint(Vector3.zero, "Origin") }; private static readonly HashSet<string> DoNotAddSnapPoints = new HashSet<string> { "piece_dvergr_spiralstair", "piece_dvergr_spiralstair_right" }; private static readonly string[] SkipIfStartsWithSubstrings = new string[6] { "_", "OLD_", "OLD", "vfx_", "sfx_", "fx_" }; private static readonly string[] SkipIfHasComponents = new string[25] { "Projectile", "Humanoid", "AnimalAI", "Character", "CreatureSpawner", "SpawnArea", "Fish", "RandomFlyingBird", "MusicLocation", "Aoe", "ItemDrop", "DungeonGenerator", "TerrainModifier", "EventZone", "LocationProxy", "LootSpawner", "Mister", "Ragdoll", "MineRock5", "TombStone", "LiquidVolume", "Gibber", "TimedDestruction", "ShipConstructor", "TriggerSpawner" }; internal static void AddExtraSnapPoints(string msg, bool forceUpdate = false) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { return; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "main" || (!ExtraSnapsPlugin.Instance.ShouldUpdateExtraSnaps && !forceUpdate)) { return; } Log.LogInfo(msg); List<GameObject> list = FindPrefabPieces(); SnapPointManager.Instance.ClearAddedSnapPoints(); if (!ExtraSnapsPlugin.Instance.EnableExtraSnapPoints.Value) { return; } Stopwatch stopwatch = Stopwatch.StartNew(); foreach (GameObject item in list) { try { NamedSnapPoint[] extraSnapPointsFor = GetExtraSnapPointsFor(item); SnapPointManager.Instance.AddSnapPointsToPrefab(item, extraSnapPointsFor); } catch (Exception arg) { Log.LogWarning($"Failed to add snappoints to {item}: {arg}"); } } stopwatch.Stop(); Log.LogInfo($"Adding snap points complete. Time: {stopwatch.ElapsedMilliseconds} ms."); ExtraSnapsPlugin.Instance.ShouldUpdateExtraSnaps = false; } internal static List<GameObject> FindPrefabPieces() { return (from piecePrefab in Resources.FindObjectsOfTypeAll<PieceTable>().SelectMany((PieceTable pieceTable) => pieceTable.m_pieces) where !SkipPrefab(piecePrefab) select piecePrefab).ToList(); } private static bool SkipPrefab(GameObject prefab) { if (!Object.op_Implicit((Object)(object)prefab)) { return true; } if (DoNotAddSnapPoints.Contains(((Object)prefab).name)) { return true; } if (((Object)prefab).name.StartsWithAny(SkipIfStartsWithSubstrings) || prefab.HasAnyComponent(SkipIfHasComponents) || Object.op_Implicit((Object)(object)prefab.GetComponentInChildren<Ship>()) || Object.op_Implicit((Object)(object)prefab.GetComponentInChildren<Vagon>()) || prefab.IsRepairPiece()) { return true; } return false; } private static NamedSnapPoint[] GetExtraSnapPointsFor(GameObject prefab) { //IL_1cea: Unknown result type (might be due to invalid IL or missing references) //IL_1cef: Unknown result type (might be due to invalid IL or missing references) //IL_1d05: Unknown result type (might be due to invalid IL or missing references) //IL_1d0a: Unknown result type (might be due to invalid IL or missing references) //IL_1d20: Unknown result type (might be due to invalid IL or missing references) //IL_1d25: Unknown result type (might be due to invalid IL or missing references) //IL_1d3b: Unknown result type (might be due to invalid IL or missing references) //IL_1d40: Unknown result type (might be due to invalid IL or missing references) //IL_1d56: Unknown result type (might be due to invalid IL or missing references) //IL_1d5b: Unknown result type (might be due to invalid IL or missing references) //IL_13ec: Unknown result type (might be due to invalid IL or missing references) //IL_13f1: Unknown result type (might be due to invalid IL or missing references) //IL_1407: Unknown result type (might be due to invalid IL or missing references) //IL_140c: Unknown result type (might be due to invalid IL or missing references) //IL_1422: Unknown result type (might be due to invalid IL or missing references) //IL_1427: Unknown result type (might be due to invalid IL or missing references) //IL_1b45: Unknown result type (might be due to invalid IL or missing references) //IL_1b4a: Unknown result type (might be due to invalid IL or missing references) //IL_1b60: Unknown result type (might be due to invalid IL or missing references) //IL_1b65: Unknown result type (might be due to invalid IL or missing references) //IL_1b7b: Unknown result type (might be due to invalid IL or missing references) //IL_1b80: Unknown result type (might be due to invalid IL or missing references) //IL_1b96: Unknown result type (might be due to invalid IL or missing references) //IL_1b9b: Unknown result type (might be due to invalid IL or missing references) //IL_1bb1: Unknown result type (might be due to invalid IL or missing references) //IL_1bb6: Unknown result type (might be due to invalid IL or missing references) //IL_1abb: Unknown result type (might be due to invalid IL or missing references) //IL_1ac0: Unknown result type (might be due to invalid IL or missing references) //IL_1ad6: Unknown result type (might be due to invalid IL or missing references) //IL_1adb: Unknown result type (might be due to invalid IL or missing references) //IL_1af1: Unknown result type (might be due to invalid IL or missing references) //IL_1af6: Unknown result type (might be due to invalid IL or missing references) //IL_1b0c: Unknown result type (might be due to invalid IL or missing references) //IL_1b11: Unknown result type (might be due to invalid IL or missing references) //IL_1b27: Unknown result type (might be due to invalid IL or missing references) //IL_1b2c: Unknown result type (might be due to invalid IL or missing references) //IL_172d: Unknown result type (might be due to invalid IL or missing references) //IL_1732: Unknown result type (might be due to invalid IL or missing references) //IL_1748: Unknown result type (might be due to invalid IL or missing references) //IL_174d: Unknown result type (might be due to invalid IL or missing references) //IL_1763: Unknown result type (might be due to invalid IL or missing references) //IL_1768: Unknown result type (might be due to invalid IL or missing references) //IL_177e: Unknown result type (might be due to invalid IL or missing references) //IL_1783: Unknown result type (might be due to invalid IL or missing references) //IL_1799: Unknown result type (might be due to invalid IL or missing references) //IL_179e: Unknown result type (might be due to invalid IL or missing references) //IL_17b4: Unknown result type (might be due to invalid IL or missing references) //IL_17b9: Unknown result type (might be due to invalid IL or missing references) //IL_17cf: Unknown result type (might be due to invalid IL or missing references) //IL_17d4: Unknown result type (might be due to invalid IL or missing references) //IL_17ea: Unknown result type (might be due to invalid IL or missing references) //IL_17ef: Unknown result type (might be due to invalid IL or missing references) //IL_1805: Unknown result type (might be due to invalid IL or missing references) //IL_180a: Unknown result type (might be due to invalid IL or missing references) //IL_1821: Unknown result type (might be due to invalid IL or missing references) //IL_1826: Unknown result type (might be due to invalid IL or missing references) //IL_183d: Unknown result type (might be due to invalid IL or missing references) //IL_1842: Unknown result type (might be due to invalid IL or missing references) //IL_1581: Unknown result type (might be due to invalid IL or missing references) //IL_1586: Unknown result type (might be due to invalid IL or missing references) //IL_159c: Unknown result type (might be due to invalid IL or missing references) //IL_15a1: Unknown result type (might be due to invalid IL or missing references) //IL_15b7: Unknown result type (might be due to invalid IL or missing references) //IL_15bc: Unknown result type (might be due to invalid IL or missing references) //IL_15d2: Unknown result type (might be due to invalid IL or missing references) //IL_15d7: Unknown result type (might be due to invalid IL or missing references) //IL_15ed: Unknown result type (might be due to invalid IL or missing references) //IL_15f2: Unknown result type (might be due to invalid IL or missing references) //IL_1dfe: Unknown result type (might be due to invalid IL or missing references) //IL_1e03: Unknown result type (might be due to invalid IL or missing references) //IL_1e19: Unknown result type (might be due to invalid IL or missing references) //IL_1e1e: Unknown result type (might be due to invalid IL or missing references) //IL_1e34: Unknown result type (might be due to invalid IL or missing references) //IL_1e39: Unknown result type (might be due to invalid IL or missing references) //IL_1d74: Unknown result type (might be due to invalid IL or missing references) //IL_1d79: Unknown result type (might be due to invalid IL or missing references) //IL_1d8f: Unknown result type (might be due to invalid IL or missing references) //IL_1d94: Unknown result type (might be due to invalid IL or missing references) //IL_1daa: Unknown result type (might be due to invalid IL or missing references) //IL_1daf: Unknown result type (might be due to invalid IL or missing references) //IL_1dc5: Unknown result type (might be due to invalid IL or missing references) //IL_1dca: Unknown result type (might be due to invalid IL or missing references) //IL_1de0: Unknown result type (might be due to invalid IL or missing references) //IL_1de5: Unknown result type (might be due to invalid IL or missing references) //IL_1078: Unknown result type (might be due to invalid IL or missing references) //IL_107d: Unknown result type (might be due to invalid IL or missing references) //IL_1093: Unknown result type (might be due to invalid IL or missing references) //IL_1098: Unknown result type (might be due to invalid IL or missing references) //IL_10ae: Unknown result type (might be due to invalid IL or missing references) //IL_10b3: Unknown result type (might be due to invalid IL or missing references) //IL_10c9: Unknown result type (might be due to invalid IL or missing references) //IL_10ce: Unknown result type (might be due to invalid IL or missing references) //IL_10e4: Unknown result type (might be due to invalid IL or missing references) //IL_10e9: Unknown result type (might be due to invalid IL or missing references) //IL_10ff: Unknown result type (might be due to invalid IL or missing references) //IL_1104: Unknown result type (might be due to invalid IL or missing references) //IL_111a: Unknown result type (might be due to invalid IL or missing references) //IL_111f: Unknown result type (might be due to invalid IL or missing references) //IL_1135: Unknown result type (might be due to invalid IL or missing references) //IL_113a: Unknown result type (might be due to invalid IL or missing references) //IL_1150: Unknown result type (might be due to invalid IL or missing references) //IL_1155: Unknown result type (might be due to invalid IL or missing references) //IL_2173: Unknown result type (might be due to invalid IL or missing references) //IL_2178: Unknown result type (might be due to invalid IL or missing references) //IL_218e: Unknown result type (might be due to invalid IL or missing references) //IL_2193: Unknown result type (might be due to invalid IL or missing references) //IL_21a9: Unknown result type (might be due to invalid IL or missing references) //IL_21ae: Unknown result type (might be due to invalid IL or missing references) //IL_21c4: Unknown result type (might be due to invalid IL or missing references) //IL_21c9: Unknown result type (might be due to invalid IL or missing references) //IL_21df: Unknown result type (might be due to invalid IL or missing references) //IL_21e4: Unknown result type (might be due to invalid IL or missing references) //IL_163f: Unknown result type (might be due to invalid IL or missing references) //IL_1644: Unknown result type (might be due to invalid IL or missing references) //IL_165a: Unknown result type (might be due to invalid IL or missing references) //IL_165f: Unknown result type (might be due to invalid IL or missing references) //IL_1675: Unknown result type (might be due to invalid IL or missing references) //IL_167a: Unknown result type (might be due to invalid IL or missing references) //IL_1693: Unknown result type (might be due to invalid IL or missing references) //IL_1698: Unknown result type (might be due to invalid IL or missing references) //IL_16ae: Unknown result type (might be due to invalid IL or missing references) //IL_16b3: Unknown result type (might be due to invalid IL or missing references) //IL_16c9: Unknown result type (might be due to invalid IL or missing references) //IL_16ce: Unknown result type (might be due to invalid IL or missing references) //IL_16e4: Unknown result type (might be due to invalid IL or missing references) //IL_16e9: Unknown result type (might be due to invalid IL or missing references) //IL_16ff: Unknown result type (might be due to invalid IL or missing references) //IL_1704: Unknown result type (might be due to invalid IL or missing references) //IL_161a: Unknown result type (might be due to invalid IL or missing references) //IL_161f: Unknown result type (might be due to invalid IL or missing references) //IL_18fb: Unknown result type (might be due to invalid IL or missing references) //IL_1900: Unknown result type (might be due to invalid IL or missing references) //IL_1916: Unknown result type (might be due to invalid IL or missing references) //IL_191b: Unknown result type (might be due to invalid IL or missing references) //IL_1931: Unknown result type (might be due to invalid IL or missing references) //IL_1936: Unknown result type (might be due to invalid IL or missing references) //IL_194c: Unknown result type (might be due to invalid IL or missing references) //IL_1951: Unknown result type (might be due to invalid IL or missing references) //IL_1967: Unknown result type (might be due to invalid IL or missing references) //IL_196c: Unknown result type (might be due to invalid IL or missing references) //IL_1985: Unknown result type (might be due to invalid IL or missing references) //IL_198a: Unknown result type (might be due to invalid IL or missing references) //IL_19a0: Unknown result type (might be due to invalid IL or missing references) //IL_19a5: Unknown result type (might be due to invalid IL or missing references) //IL_19bb: Unknown result type (might be due to invalid IL or missing references) //IL_19c0: Unknown result type (might be due to invalid IL or missing references) //IL_19e8: Unknown result type (might be due to invalid IL or missing references) //IL_19ed: Unknown result type (might be due to invalid IL or missing references) //IL_1a03: Unknown result type (might be due to invalid IL or missing references) //IL_1a08: Unknown result type (might be due to invalid IL or missing references) //IL_1a1e: Unknown result type (might be due to invalid IL or missing references) //IL_1a23: Unknown result type (might be due to invalid IL or missing references) //IL_1a39: Unknown result type (might be due to invalid IL or missing references) //IL_1a3e: Unknown result type (might be due to invalid IL or missing references) //IL_1a54: Unknown result type (might be due to invalid IL or missing references) //IL_1a59: Unknown result type (might be due to invalid IL or missing references) //IL_0d8b: Unknown result type (might be due to invalid IL or missing references) //IL_0d90: Unknown result type (might be due to invalid IL or missing references) //IL_0da6: Unknown result type (might be due to invalid IL or missing references) //IL_0dab: Unknown result type (might be due to invalid IL or missing references) //IL_0dc1: Unknown result type (might be due to invalid IL or missing references) //IL_0dc6: Unknown result type (might be due to invalid IL or missing references) //IL_0ddc: Unknown result type (might be due to invalid IL or missing references) //IL_0de1: Unknown result type (might be due to invalid IL or missing references) //IL_0df7: Unknown result type (might be due to invalid IL or missing references) //IL_0dfc: Unknown result type (might be due to invalid IL or missing references) //IL_0e12: Unknown result type (might be due to invalid IL or missing references) //IL_0e17: Unknown result type (might be due to invalid IL or missing references) //IL_1c23: Unknown result type (might be due to invalid IL or missing references) //IL_1c28: Unknown result type (might be due to invalid IL or missing references) //IL_1c3e: Unknown result type (might be due to invalid IL or missing references) //IL_1c43: Unknown result type (might be due to invalid IL or missing references) //IL_1c59: Unknown result type (might be due to invalid IL or missing references) //IL_1c5e: Unknown result type (might be due to invalid IL or missing references) //IL_20e9: Unknown result type (might be due to invalid IL or missing references) //IL_20ee: Unknown result type (might be due to invalid IL or missing references) //IL_2104: Unknown result type (might be due to invalid IL or missing references) //IL_2109: Unknown result type (might be due to invalid IL or missing references) //IL_211f: Unknown result type (might be due to invalid IL or missing references) //IL_2124: Unknown result type (might be due to invalid IL or missing references) //IL_213a: Unknown result type (might be due to invalid IL or missing references) //IL_213f: Unknown result type (might be due to invalid IL or missing references) //IL_2155: Unknown result type (might be due to invalid IL or missing references) //IL_215a: Unknown result type (might be due to invalid IL or missing references) //IL_205f: Unknown result type (might be due to invalid IL or missing references) //IL_2064: Unknown result type (might be due to invalid IL or missing references) //IL_207a: Unknown result type (might be due to invalid IL or missing references) //IL_207f: Unknown result type (might be due to invalid IL or missing references) //IL_2095: Unknown result type (might be due to invalid IL or missing references) //IL_209a: Unknown result type (might be due to invalid IL or missing references) //IL_20b0: Unknown result type (might be due to invalid IL or missing references) //IL_20b5: Unknown result type (might be due to invalid IL or missing references) //IL_20cb: Unknown result type (might be due to invalid IL or missing references) //IL_20d0: Unknown result type (might be due to invalid IL or missing references) //IL_0ed8: Unknown result type (might be due to invalid IL or missing references) //IL_0edd: Unknown result type (might be due to invalid IL or missing references) //IL_0ef3: Unknown result type (might be due to invalid IL or missing references) //IL_0ef8: Unknown result type (might be due to invalid IL or missing references) //IL_0f0e: Unknown result type (might be due to invalid IL or missing references) //IL_0f13: Unknown result type (might be due to invalid IL or missing references) //IL_0f29: Unknown result type (might be due to invalid IL or missing references) //IL_0f2e: Unknown result type (might be due to invalid IL or missing references) //IL_0f44: Unknown result type (might be due to invalid IL or missing references) //IL_0f49: Unknown result type (might be due to invalid IL or missing references) //IL_144f: Unknown result type (might be due to invalid IL or missing references) //IL_1454: Unknown result type (might be due to invalid IL or missing references) //IL_146a: Unknown result type (might be due to invalid IL or missing references) //IL_146f: Unknown result type (might be due to invalid IL or missing references) //IL_1485: Unknown result type (might be due to invalid IL or missing references) //IL_148a: Unknown result type (might be due to invalid IL or missing references) //IL_14a0: Unknown result type (might be due to invalid IL or missing references) //IL_14a5: Unknown result type (might be due to invalid IL or missing references) //IL_14bb: Unknown result type (might be due to invalid IL or missing references) //IL_14c0: Unknown result type (might be due to invalid IL or missing references) //IL_0b41: Unknown result type (might be due to invalid IL or missing references) //IL_0b46: Unknown result type (might be due to invalid IL or missing references) //IL_0b5c: Unknown result type (might be due to invalid IL or missing references) //IL_0b61: Unknown result type (might be due to invalid IL or missing references) //IL_0b77: Unknown result type (might be due to invalid IL or missing references) //IL_0b7c: Unknown result type (might be due to invalid IL or missing references) //IL_0b92: Unknown result type (might be due to invalid IL or missing references) //IL_0b97: Unknown result type (might be due to invalid IL or missing references) //IL_0bad: Unknown result type (might be due to invalid IL or missing references) //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0bc8: Unknown result type (might be due to invalid IL or missing references) //IL_0bcd: Unknown result type (might be due to invalid IL or missing references) //IL_0be3: Unknown result type (might be due to invalid IL or missing references) //IL_0be8: Unknown result type (might be due to invalid IL or missing references) //IL_0bfe: Unknown result type (might be due to invalid IL or missing references) //IL_0c03: Unknown result type (might be due to invalid IL or missing references) //IL_0c19: Unknown result type (might be due to invalid IL or missing references) //IL_0c1e: Unknown result type (might be due to invalid IL or missing references) //IL_0c35: Unknown result type (might be due to invalid IL or missing references) //IL_0c3a: Unknown result type (might be due to invalid IL or missing references) //IL_0c51: Unknown result type (might be due to invalid IL or missing references) //IL_0c56: Unknown result type (might be due to invalid IL or missing references) //IL_0c6d: Unknown result type (might be due to invalid IL or missing references) //IL_0c72: Unknown result type (might be due to invalid IL or missing references) //IL_0c89: Unknown result type (might be due to invalid IL or missing references) //IL_0c8e: Unknown result type (might be due to invalid IL or missing references) //IL_0ca5: Unknown result type (might be due to invalid IL or missing references) //IL_0caa: Unknown result type (might be due to invalid IL or missing references) //IL_0e3f: Unknown result type (might be due to invalid IL or missing references) //IL_0e44: Unknown result type (might be due to invalid IL or missing references) //IL_0e5a: Unknown result type (might be due to invalid IL or missing references) //IL_0e5f: Unknown result type (might be due to invalid IL or missing references) //IL_0e75: Unknown result type (might be due to invalid IL or missing references) //IL_0e7a: Unknown result type (might be due to invalid IL or missing references) //IL_0e90: Unknown result type (might be due to invalid IL or missing references) //IL_0e95: Unknown result type (might be due to invalid IL or missing references) //IL_0eab: Unknown result type (might be due to invalid IL or missing references) //IL_0eb0: Unknown result type (might be due to invalid IL or missing references) //IL_1fc6: Unknown result type (might be due to invalid IL or missing references) //IL_1fcb: Unknown result type (might be due to invalid IL or missing references) //IL_1fe1: Unknown result type (might be due to invalid IL or missing references) //IL_1fe6: Unknown result type (might be due to invalid IL or missing references) //IL_1ffc: Unknown result type (might be due to invalid IL or missing references) //IL_2001: Unknown result type (might be due to invalid IL or missing references) //IL_2017: Unknown result type (might be due to invalid IL or missing references) //IL_201c: Unknown result type (might be due to invalid IL or missing references) //IL_2032: Unknown result type (might be due to invalid IL or missing references) //IL_2037: Unknown result type (might be due to invalid IL or missing references) //IL_1fa8: Unknown result type (might be due to invalid IL or missing references) //IL_1fad: Unknown result type (might be due to invalid IL or missing references) //IL_1ead: Unknown result type (might be due to invalid IL or missing references) //IL_1eb2: Unknown result type (might be due to invalid IL or missing references) //IL_1ec8: Unknown result type (might be due to invalid IL or missing references) //IL_1ecd: Unknown result type (might be due to invalid IL or missing references) //IL_1ee3: Unknown result type (might be due to invalid IL or missing references) //IL_1ee8: Unknown result type (might be due to invalid IL or missing references) //IL_137a: Unknown result type (might be due to invalid IL or missing references) //IL_137f: Unknown result type (might be due to invalid IL or missing references) //IL_1395: Unknown result type (might be due to invalid IL or missing references) //IL_139a: Unknown result type (might be due to invalid IL or missing references) //IL_13b0: Unknown result type (might be due to invalid IL or missing references) //IL_13b5: Unknown result type (might be due to invalid IL or missing references) //IL_0f72: Unknown result type (might be due to invalid IL or missing references) //IL_0f77: Unknown result type (might be due to invalid IL or missing references) //IL_0f8d: Unknown result type (might be due to invalid IL or missing references) //IL_0f92: Unknown result type (might be due to invalid IL or missing references) //IL_0fa8: Unknown result type (might be due to invalid IL or missing references) //IL_0fad: Unknown result type (might be due to invalid IL or missing references) //IL_0fc3: Unknown result type (might be due to invalid IL or missing references) //IL_0fc8: Unknown result type (might be due to invalid IL or missing references) //IL_0fde: Unknown result type (might be due to invalid IL or missing references) //IL_0fe3: Unknown result type (might be due to invalid IL or missing references) //IL_0ff9: Unknown result type (might be due to invalid IL or missing references) //IL_0ffe: Unknown result type (might be due to invalid IL or missing references) //IL_1014: Unknown result type (might be due to invalid IL or missing references) //IL_1019: Unknown result type (might be due to invalid IL or missing references) //IL_102f: Unknown result type (might be due to invalid IL or missing references) //IL_1034: Unknown result type (might be due to invalid IL or missing references) //IL_104a: Unknown result type (might be due to invalid IL or missing references) //IL_104f: Unknown result type (might be due to invalid IL or missing references) //IL_0cd7: Unknown result type (might be due to invalid IL or missing references) //IL_0cdc: Unknown result type (might be due to invalid IL or missing references) //IL_0cf2: Unknown result type (might be due to invalid IL or missing references) //IL_0cf7: Unknown result type (might be due to invalid IL or missing references) //IL_0d0d: Unknown result type (might be due to invalid IL or missing references) //IL_0d12: Unknown result type (might be due to invalid IL or missing references) //IL_0d28: Unknown result type (might be due to invalid IL or missing references) //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d43: Unknown result type (might be due to invalid IL or missing references) //IL_0d48: Unknown result type (might be due to invalid IL or missing references) //IL_0d5e: Unknown result type (might be due to invalid IL or missing references) //IL_0d63: Unknown result type (might be due to invalid IL or missing references) //IL_1ca3: Unknown result type (might be due to invalid IL or missing references) //IL_1275: Unknown result type (might be due to invalid IL or missing references) //IL_127a: Unknown result type (might be due to invalid IL or missing references) //IL_1290: Unknown result type (might be due to invalid IL or missing references) //IL_1295: Unknown result type (might be due to invalid IL or missing references) //IL_12ab: Unknown result type (might be due to invalid IL or missing references) //IL_12b0: Unknown result type (might be due to invalid IL or missing references) //IL_12c6: Unknown result type (might be due to invalid IL or missing references) //IL_12cb: Unknown result type (might be due to invalid IL or missing references) //IL_12e1: Unknown result type (might be due to invalid IL or missing references) //IL_12e6: Unknown result type (might be due to invalid IL or missing references) //IL_12fc: Unknown result type (might be due to invalid IL or missing references) //IL_1301: Unknown result type (might be due to invalid IL or missing references) //IL_1317: Unknown result type (might be due to invalid IL or missing references) //IL_131c: Unknown result type (might be due to invalid IL or missing references) //IL_1332: Unknown result type (might be due to invalid IL or missing references) //IL_1337: Unknown result type (might be due to invalid IL or missing references) //IL_134d: Unknown result type (might be due to invalid IL or missing references) //IL_1352: Unknown result type (might be due to invalid IL or missing references) //IL_1e52: Unknown result type (might be due to invalid IL or missing references) //IL_1e57: Unknown result type (might be due to invalid IL or missing references) //IL_1e6d: Unknown result type (might be due to invalid IL or missing references) //IL_1e72: Unknown result type (might be due to invalid IL or missing references) //IL_1e88: Unknown result type (might be due to invalid IL or missing references) //IL_1e8d: Unknown result type (might be due to invalid IL or missing references) //IL_13ce: Unknown result type (might be due to invalid IL or missing references) //IL_13d3: Unknown result type (might be due to invalid IL or missing references) //IL_186a: Unknown result type (might be due to invalid IL or missing references) //IL_186f: Unknown result type (might be due to invalid IL or missing references) //IL_1885: Unknown result type (might be due to invalid IL or missing references) //IL_188a: Unknown result type (might be due to invalid IL or missing references) //IL_18a0: Unknown result type (might be due to invalid IL or missing references) //IL_18a5: Unknown result type (might be due to invalid IL or missing references) //IL_18bb: Unknown result type (might be due to invalid IL or missing references) //IL_18c0: Unknown result type (might be due to invalid IL or missing references) //IL_18d6: Unknown result type (might be due to invalid IL or missing references) //IL_18db: Unknown result type (might be due to invalid IL or missing references) //IL_14e8: Unknown result type (might be due to invalid IL or missing references) //IL_14ed: Unknown result type (might be due to invalid IL or missing references) //IL_1503: Unknown result type (might be due to invalid IL or missing references) //IL_1508: Unknown result type (might be due to invalid IL or missing references) //IL_151e: Unknown result type (might be due to invalid IL or missing references) //IL_1523: Unknown result type (might be due to invalid IL or missing references) //IL_1539: Unknown result type (might be due to invalid IL or missing references) //IL_153e: Unknown result type (might be due to invalid IL or missing references) //IL_1554: Unknown result type (might be due to invalid IL or missing references) //IL_1559: Unknown result type (might be due to invalid IL or missing references) //IL_1f0f: Unknown result type (might be due to invalid IL or missing references) //IL_1f14: Unknown result type (might be due to invalid IL or missing references) //IL_1f2a: Unknown result type (might be due to invalid IL or missing references) //IL_1f2f: Unknown result type (might be due to invalid IL or missing references) //IL_1f45: Unknown result type (might be due to invalid IL or missing references) //IL_1f4a: Unknown result type (might be due to invalid IL or missing references) //IL_1f60: Unknown result type (might be due to invalid IL or missing references) //IL_1f65: Unknown result type (might be due to invalid IL or missing references) //IL_1f7b: Unknown result type (might be due to invalid IL or missing references) //IL_1f80: Unknown result type (might be due to invalid IL or missing references) //IL_1a9d: Unknown result type (might be due to invalid IL or missing references) //IL_1aa2: Unknown result type (might be due to invalid IL or missing references) //IL_117e: Unknown result type (might be due to invalid IL or missing references) //IL_1183: Unknown result type (might be due to invalid IL or missing references) //IL_1199: Unknown result type (might be due to invalid IL or missing references) //IL_119e: Unknown result type (might be due to invalid IL or missing references) //IL_11b4: Unknown result type (might be due to invalid IL or missing references) //IL_11b9: Unknown result type (might be due to invalid IL or missing references) //IL_11cf: Unknown result type (might be due to invalid IL or missing references) //IL_11d4: Unknown result type (might be due to invalid IL or missing references) //IL_11ea: Unknown result type (might be due to invalid IL or missing references) //IL_11ef: Unknown result type (might be due to invalid IL or missing references) //IL_1205: Unknown result type (might be due to invalid IL or missing references) //IL_120a: Unknown result type (might be due to invalid IL or missing references) //IL_1220: Unknown result type (might be due to invalid IL or missing references) //IL_1225: Unknown result type (might be due to invalid IL or missing references) //IL_123b: Unknown result type (might be due to invalid IL or missing references) //IL_1240: Unknown result type (might be due to invalid IL or missing references) //IL_1256: Unknown result type (might be due to invalid IL or missing references) //IL_125b: Unknown result type (might be due to invalid IL or missing references) //IL_1bcf: Unknown result type (might be due to invalid IL or missing references) //IL_1bd4: Unknown result type (might be due to invalid IL or missing references) //IL_1bea: Unknown result type (might be due to invalid IL or missing references) //IL_1bef: Unknown result type (might be due to invalid IL or missing references) //IL_1c05: Unknown result type (might be due to invalid IL or missing references) //IL_1c0a: Unknown result type (might be due to invalid IL or missing references) if (!ExtraSnapsPlugin.Instance.LoadConfig(prefab).Value) { return Empty; } switch (((Object)prefab).name) { case "wood_fence": return CreateNamedSnapPoints(((Vector3[])(object)new Vector3[14] { new Vector3(1f, -0.2f, 0f), new Vector3(-1f, -0.2f, 0f), new Vector3(1f, 0f, 0f), new Vector3(-1f, 0f, 0f), new Vector3(1f, 0.2f, 0f), new Vector3(-1f, 0.2f, 0f), new Vector3(1f, 0.4f, 0f), new Vector3(-1f, 0.4f, 0f), new Vector3(1f, 0.6f, 0f), new Vector3(-1f, 0.6f, 0f), new Vector3(1f, 0.8f, 0f), new Vector3(-1f, 0.8f, 0f), new Vector3(1f, 1f, 0f), new Vector3(-1f, 1f, 0f) }).ApplyZIndexFix()); case "piece_sharpstakes": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[6] { new Vector3(1.12f, -0.2f, 0f), new Vector3(-1.12f, -0.2f, 0f), new Vector3(1.12f, 0f, 0f), new Vector3(-1.12f, 0f, 0f), new Vector3(1.12f, 0.2f, 0f), new Vector3(-1.12f, 0.2f, 0f) }); case "piece_dvergr_sharpstakes": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[6] { new Vector3(-0.5f, -0.5f, 2f), new Vector3(-0.5f, -0.5f, -2f), new Vector3(-0.5f, 0f, 2f), new Vector3(-0.5f, 0f, -2f), new Vector3(1f, 1f, 2f), new Vector3(1f, 1f, -2f) }); case "itemstandh": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { new Vector3(0f, -0.0346f, 0f), new Vector3(0.1f, -0.0346f, 0f), new Vector3(-0.1f, -0.0346f, 0f), new Vector3(0f, -0.0346f, 0.1f), new Vector3(0f, -0.0346f, -0.1f) }); case "itemstand": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { new Vector3(0f, 0f, -0.06f), new Vector3(0.22f, 0f, -0.06f), new Vector3(-0.22f, 0f, -0.06f), new Vector3(0f, 0.22f, -0.06f), new Vector3(0f, -0.22f, -0.06f) }); case "piece_chest_wood": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[9] { new Vector3(0f, -0.01f, 0f), new Vector3(0.8f, -0.01f, 0.37f), new Vector3(0.8f, -0.01f, -0.37f), new Vector3(-0.8f, -0.01f, 0.37f), new Vector3(-0.8f, -0.01f, -0.37f), new Vector3(0.65f, 0.8f, 0.35f), new Vector3(0.65f, 0.8f, -0.35f), new Vector3(-0.65f, 0.8f, 0.35f), new Vector3(-0.65f, 0.8f, -0.35f) }); case "piece_chest": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[9] { new Vector3(0f, -0.01f, 0f), new Vector3(0.9f, -0.01f, 0.47f), new Vector3(0.9f, -0.01f, -0.47f), new Vector3(-0.9f, -0.01f, 0.47f), new Vector3(-0.9f, -0.01f, -0.47f), new Vector3(0.7f, 0.99f, 0.47f), new Vector3(0.7f, 0.99f, -0.47f), new Vector3(-0.7f, 0.99f, 0.47f), new Vector3(-0.7f, 0.99f, -0.47f) }); case "piece_chest_private": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[9] { new Vector3(0f, -0.01f, 0f), new Vector3(0.45f, -0.01f, 0.25f), new Vector3(0.45f, -0.01f, -0.25f), new Vector3(-0.45f, -0.01f, 0.25f), new Vector3(-0.45f, -0.01f, -0.25f), new Vector3(0.36f, 0.55f, 0.23f), new Vector3(0.36f, 0.55f, -0.23f), new Vector3(-0.36f, 0.55f, 0.23f), new Vector3(-0.36f, 0.55f, -0.23f) }); case "piece_chest_blackmetal": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[9] { Vector3.zero, new Vector3(1f, 0f, 0.5f), new Vector3(1f, 0f, -0.5f), new Vector3(-1f, 0f, 0.5f), new Vector3(-1f, 0f, -0.5f), new Vector3(0.85f, 1f, 0.5f), new Vector3(0.85f, 1f, -0.5f), new Vector3(-0.85f, 1f, 0.5f), new Vector3(-0.85f, 1f, -0.5f) }); case "piece_walltorch": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { new Vector3(-0.2f, 0f, 0f), new Vector3(-0.25f, 0f, 0f), new Vector3(-0.35f, 0f, 0f) }); case "piece_dvergr_lantern_pole": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[1] { Vector3.zero }); case "sign": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { Vector3.zero, new Vector3(0f, 0f, -0.05f), new Vector3(0f, 0f, -0.2f) }); case "ArmorStand": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { new Vector3(0f, -0.1f, 0f), new Vector3(0.5f, -0.1f, 0f), new Vector3(-0.5f, -0.1f, 0f), new Vector3(0f, -0.1f, 0.5f), new Vector3(0f, -0.1f, -0.5f) }); case "jute_carpet": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { new Vector3(0f, -0.01f, 0f), new Vector3(2f, -0.01f, -1.25f), new Vector3(2f, -0.01f, 1.25f), new Vector3(-2f, -0.01f, -1.25f), new Vector3(-2f, -0.01f, 1.25f) }); case "rug_fur": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { new Vector3(0f, -0.01f, 0f), new Vector3(1.25f, -0.01f, -2f), new Vector3(1.25f, -0.01f, 2f), new Vector3(-1.25f, -0.01f, -2f), new Vector3(-1.25f, -0.01f, 2f) }); case "jute_carpet_blue": case "rug_wolf": case "rug_deer": case "rug_hare": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[1] { new Vector3(0f, -0.01f, 0f) }); case "piece_blackmarble_throne": case "piece_chair": case "piece_throne01": case "piece_throne02": case "piece_chair02": case "piece_chair03": return GetOriginSnapPointIfNeeded(prefab); case "piece_logbench01": case "piece_bench01": case "piece_blackmarble_bench": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { Vector3.zero, new Vector3(-1f, 0f, 0f), new Vector3(1f, 0f, 0f) }); case "piece_cloth_hanging_door": case "piece_banner01": case "piece_banner11": case "piece_banner02": case "piece_banner03": case "piece_banner04": case "piece_banner05": case "piece_banner06": case "piece_banner07": case "piece_banner08": case "piece_banner09": case "piece_banner10": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(0.136f, 0f, 0f), new Vector3(-0.136f, 0f, 0f), new Vector3(0.236f, 0f, 0f), new Vector3(-0.236f, 0f, 0f) }); case "piece_cloth_hanging_door_blue2": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[11] { new Vector3(0f, 1.5f, 0f), new Vector3(0f, 1.5f, 2f), new Vector3(0f, 1.5f, -2f), new Vector3(0.28f, 1.5f, 2f), new Vector3(0.28f, 1.5f, -2f), new Vector3(-0.28f, 1.5f, -2f), new Vector3(-0.28f, 1.5f, 2f), new Vector3(0.472f, 1.5f, 2f), new Vector3(0.472f, 1.5f, -2f), new Vector3(-0.472f, 1.5f, -2f), new Vector3(-0.472f, 1.5f, 2f) }); case "piece_cloth_hanging_door_blue": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { new Vector3(0f, 4f, 0f), new Vector3(0.16f, 4f, 0f), new Vector3(-0.16f, 4f, 0f), new Vector3(0.36f, 4f, 0f), new Vector3(-0.36f, 4f, 0f) }); case "piece_workbench": case "piece_workbench_ext1": return GetOriginSnapPointIfNeeded(prefab); case "piece_workbench_ext2": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(1f, 0f, 0f), new Vector3(-1f, 0f, 0f), new Vector3(1f, 0f, -1f), new Vector3(-1f, 0f, -1f) }); case "piece_workbench_ext3": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { Vector3.zero, new Vector3(1f, 0f, 0f), new Vector3(-1f, 0f, 0f) }); case "piece_workbench_ext4": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { new Vector3(0f, 0f, -0.1f), new Vector3(1f, 0f, -0.1f), new Vector3(-1f, 0f, -0.1f), new Vector3(1f, 1f, -0.1f), new Vector3(-1f, 1f, -0.1f) }); case "forge_ext1": case "forge_ext2": case "forge_ext3": case "forge_ext4": case "forge_ext5": case "forge_ext6": case "forge": return GetOriginSnapPointIfNeeded(prefab); case "blackforge": case "blackforge_ext1": case "blackforge_ext2_vise": return GetOriginSnapPointIfNeeded(prefab); case "piece_magetable_ext": case "piece_magetable": case "piece_magetable_ext2": return GetOriginSnapPointIfNeeded(prefab); case "fermenter": case "piece_cauldron": case "cauldron_ext5_mortarandpestle": return GetOriginSnapPointIfNeeded(prefab); case "cauldron_ext1_spice": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[1] { new Vector3(0f, 1.25f, 0f) }); case "cauldron_ext3_butchertable": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(0.5f, 0f, -0.5f), new Vector3(0.5f, 0f, 0.5f), new Vector3(-0.5f, 0f, -0.5f), new Vector3(-0.5f, 0f, 0.5f) }); case "cauldron_ext4_pots": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(1f, 0f, 0f), new Vector3(1f, 1f, 0f), new Vector3(-1f, 0f, 0f), new Vector3(-1f, 1f, 0f) }); case "piece_cookingstation": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { Vector3.zero, new Vector3(-1f, 0f, 0f), new Vector3(1f, 0f, 0f) }); case "piece_cookingstation_iron": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { Vector3.zero, new Vector3(-2f, 0f, 0f), new Vector3(2f, 0f, 0f) }); case "hearth": return GetOriginSnapPointIfNeeded(prefab); case "wood_wall_log_4x0.5": case "wood_wall_log": return new NamedSnapPoint[3] { new NamedSnapPoint(0f, -0.25f, 0f, "$hud_snappoint_bottom $hud_snappoint_center"), new NamedSnapPoint(Vector3.zero, "$hud_snappoint_center"), new NamedSnapPoint(0f, 0.25f, 0f, "$hud_snappoint_top $hud_snappoint_center") }; case "bed": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(0.5f, 0f, -1.5f), new Vector3(0.5f, 0f, 1.5f), new Vector3(-0.5f, 0f, -1.5f), new Vector3(-0.5f, 0f, 1.5f) }); case "piece_bed02": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(1f, 0f, -1.5f), new Vector3(1f, 0f, 1.5f), new Vector3(-1f, 0f, -1.5f), new Vector3(-1f, 0f, 1.5f) }); case "piece_table": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { Vector3.zero, new Vector3(-1f, 0f, 0f), new Vector3(1f, 0f, 0f) }); case "piece_blackmarble_table": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { Vector3.zero, new Vector3(-1f, 0f, 0f), new Vector3(1f, 0f, 0f) }); case "piece_table_round": return GetOriginSnapPointIfNeeded(prefab); case "piece_table_oak": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[3] { Vector3.zero, new Vector3(-2f, 0f, 0f), new Vector3(2f, 0f, 0f) }); case "piece_bathtub": return GetOriginSnapPointIfNeeded(prefab); case "piece_stonecutter": case "piece_spinningwheel": case "piece_cartographytable": case "piece_artisanstation": return GetOriginSnapPointIfNeeded(prefab); case "piece_barber": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(1f, 0f, -0.75f), new Vector3(1f, 0f, 0.75f), new Vector3(-1f, 0f, -0.75f), new Vector3(-1f, 0f, 0.75f) }); case "piece_wisplure": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[1] { new Vector3(0f, -0.05f, 0f) }); case "eitrrefinery": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(2.75f, 0f, -1f), new Vector3(2.75f, 0f, 1f), new Vector3(-2.75f, 0f, -1f), new Vector3(-2.75f, 0f, 1f) }); case "windmill": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { new Vector3(0f, -0.005f, 0f), new Vector3(2f, -0.005f, -2f), new Vector3(2f, -0.005f, 2f), new Vector3(-2f, -0.005f, -2f), new Vector3(-2f, -0.005f, 2f) }); case "smelter": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(1f, 0f, -1f), new Vector3(1f, 0f, 1f), new Vector3(-1f, 0f, -1f), new Vector3(-1f, 0f, 1f) }); case "blastfurnace": return CreateNamedSnapPoints((Vector3[])(object)new Vector3[5] { Vector3.zero, new Vector3(2f, 0f, -1.25f), new Vector3(2f, 0f, 1.25f), new Vector3(-1.75f, 0f, -1.25f), new Vector3(-1.75f, 0f, 1.25f) }); case "Piece_grausten_pillarbase_tapered": return new NamedSnapPoint[2] { new NamedSnapPoint(0f, 0.75f, 0f, "$hud_snappoint_center"), new NamedSnapPoint(0f, 0.5f, 0f, "Floor Height $hud_snappoint_center") }; case "portal_wood": return new NamedSnapPoint[1] { new NamedSnapPoint(0f, -0.05f, 0f, "Origin") }; default: return GetCalculatedSnapPointsOrEmpty(prefab); } } private static NamedSnapPoint[] GetOriginSnapPointIfNeeded(GameObject prefab) { if (!prefab.HasOriginSnapPoint()) { return OriginSnapPointArray; } return Empty; } private static NamedSnapPoint[] GetCalculatedSnapPointsOrEmpty(GameObject prefab) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) List<Transform> snapPoints = prefab.GetSnapPoints(); if (snapPoints.Count == 1 || ShapeClassifier.IsCross(snapPoints)) { return Empty; } if (!ExtraSnapsPlugin.Instance.EnableTerrainOpSnapPoints.Value && prefab.IsTerrainOp()) { return Empty; } if (snapPoints.Count == 0) { if (prefab.IsCeilingBrazier()) { return new NamedSnapPoint[2] { new NamedSnapPoint(0f, 2f, 0f, "$hud_snappoint_top of Chain"), new NamedSnapPoint(0f, 1.5f, 0f, "Extra") }; } if (prefab.IsFloorBrazier()) { return new NamedSnapPoint[2] { new NamedSnapPoint(0f, -1f, 0f, "Base $hud_snappoint_center"), new NamedSnapPoint(0f, -0.25f, 0f, "$hud_snappoint_top") }; } if (prefab.IsTorch()) { return new NamedSnapPoint[2] { new NamedSnapPoint(Vector3.zero, "Origin"), new NamedSnapPoint(0f, -0.7f, 0f, "Extra") }; } } else { if (ExtraSnapsPlugin.Instance.EnableLineSnapPoints.Value && ShapeClassifier.FormsLine(snapPoints)) { return ExtraSnapsCalculator.GetExtraPointsForLine(snapPoints, 1); } if (ExtraSnapsPlugin.Instance.EnableTriangleSnapPoints.Value && ShapeClassifier.FormsTriangle(snapPoints)) { return ExtraSnapsCalculator.GetExtraSnapPointsForTriangle(snapPoints); } if (ExtraSnapsPlugin.Instance.EnableRect2DSnapPoints.Value && ShapeClassifier.FormsRectangle(snapPoints)) { return ExtraSnapsCalculator.GetSnapPointsForRectangle(snapPoints); } if (ExtraSnapsPlugin.Instance.EnableRoofTopSnapPoints.Value && prefab.IsRoof() && ShapeClassifier.IsWedge3D(snapPoints)) { return ExtraSnapsCalculator.GetExtraSnapPointsForRoofTop(snapPoints, ((Object)prefab).name); } } if (!snapPoints.ContainsOriginSnapPoint()) { return OriginSnapPointArray; } return Empty; } private static NamedSnapPoint[] CreateNamedSnapPoints(Vector3[] positions, string prefix = "Extra", int startNumber = 1) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) NamedSnapPoint[] array = new NamedSnapPoint[positions.Length]; for (int i = 0; i < array.Length; i++) { array[i] = new NamedSnapPoint(positions[i], $"{prefix} {startNumber + i}"); } return array; } } internal class ExtraSnapsCalculator { private const string DefaultSnapPointName = "_snappoint"; internal static NamedSnapPoint[] GetExtraPointsForLine(List<Transform> snapPoints, int nrPointsToAdd) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (snapPoints.Count != 2) { throw new ArgumentException("GetExtraPointsForLine called with more than 2 snappoints.", "snapPoints"); } Vector3 localPosition = ((Component)snapPoints[0]).transform.localPosition; Vector3 val = (((Component)snapPoints[1]).transform.localPosition - localPosition) / (float)(nrPointsToAdd + 1); NamedSnapPoint[] array = new NamedSnapPoint[nrPointsToAdd]; for (int i = 0; i < nrPointsToAdd; i++) { array[i] = new NamedSnapPoint(localPosition + val * (float)(i + 1), string.Format("{0} Line {1}/{2}", "$hud_snappoint_center", i + 1, nrPointsToAdd + 1)); } return array; } internal static NamedSnapPoint[] GetExtraSnapPointsForTriangle(List<Transform> snapPoints) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0038: 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) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) if (snapPoints.Count != 3) { throw new ArgumentException("GetExtraSnapPointsForTriangle called on a list that does not have exactly 3 snap points.", "snapPoints"); } Vector3 center = snapPoints.GetCenter(); Vector3 localPosition = (snapPoints[0].localPosition + snapPoints[1].localPosition) / 2f; Vector3 localPosition2 = (snapPoints[0].localPosition + snapPoints[2].localPosition) / 2f; Vector3 localPosition3 = (snapPoints[1].localPosition + snapPoints[2].localPosition) / 2f; return new NamedSnapPoint[4] { new NamedSnapPoint(localPosition, "$hud_snappoint_mid " + ((Object)snapPoints[0]).name + " - " + ((Object)snapPoints[1]).name, 1), new NamedSnapPoint(localPosition3, "$hud_snappoint_mid " + ((Object)snapPoints[1]).name + " - " + ((Object)snapPoints[2]).name, 3), new NamedSnapPoint(localPosition2, "$hud_snappoint_mid " + ((Object)snapPoints[0]).name + " - " + ((Object)snapPoints[2]).name, 5), new NamedSnapPoint(center, "$hud_snappoint_center", 6) }; } internal static NamedSnapPoint[] GetSnapPointsForRectangle(List<Transform> snapPoints) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) if (snapPoints.Count != 4) { throw new InvalidOperationException(string.Format("{0} called with {1} points instead of 4", "GetSnapPointsForRectangle", snapPoints.Count)); } List<NamedSnapPoint> list = new List<NamedSnapPoint>(5); Vector3 center = snapPoints.GetCenter(); for (int i = 0; i < snapPoints.Count - 1; i++) { Transform val = snapPoints[i]; for (int j = i + 1; j < snapPoints.Count; j++) { Transform val2 = snapPoints[j]; Vector3 val3 = (((Component)val).transform.localPosition + ((Component)val2).transform.localPosition) / 2f; if (!(val3 != center)) { continue; } string name = "Extra"; if (((Object)val).name.StartsWith("$hud_snappoint_top") && ((Object)val2).name.StartsWith("$hud_snappoint_top")) { name = "$hud_snappoint_top $hud_snappoint_center"; } else if (((Object)val).name.StartsWith("$hud_snappoint_bottom") && ((Object)val2).name.StartsWith("$hud_snappoint_bottom")) { name = "$hud_snappoint_bottom $hud_snappoint_center"; } else if ((((Object)val).name.StartsWith("$hud_snappoint_top") && ((Object)val2).name.StartsWith("$hud_snappoint_bottom")) || (((Object)val).name.StartsWith("$hud_snappoint_bottom") && ((Object)val2).name.StartsWith("$hud_snappoint_top"))) { if (int.TryParse(((Object)val).name.Substring(((Object)val).name.IndexOf(' ')), out var result) && int.TryParse(((Object)val2).name.Substring(((Object)val2).name.IndexOf(' ')), out var result2) && result == result2) { name = string.Format("{0} {1} {2}", "$hud_snappoint_edge", result, "$hud_snappoint_center"); } } else if (((Object)val).name != "_snappoint" && ((Object)val2).name != "_snappoint") { name = "$hud_snappoint_mid " + ((Object)val).name + " - " + ((Object)val2).name; } list.Add(new NamedSnapPoint(val3, name)); } } list.Add(new NamedSnapPoint(center, "$hud_snappoint_center")); return list.ToArray(); } internal static NamedSnapPoint[] GetExtraSnapPointsForRoofTop(List<Transform> snapPoints, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //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_01b6: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0269: 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_029b: 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) Vector3 val = ShapeClassifier.SolveMinimumsOf(snapPoints); Vector3 val2 = ShapeClassifier.SolveMaximumsOf(snapPoints); Vector3 val3 = (val + val2) / 2f; List<Vector3> list = new List<Vector3>(); int num = -1; Vector3 val4; foreach (Transform snapPoint in snapPoints) { for (int i = 0; i < 3; i++) { val4 = snapPoint.localPosition; float num2 = ((Vector3)(ref val4))[i]; if (!num2.Equals(((Vector3)(ref val))[i]) && !num2.Equals(((Vector3)(ref val2))[i])) { if (!num2.Equals(((Vector3)(ref val3))[i])) { Log.LogError(name + " is not a RoofTop piece"); } if (num == -1) { num = i; } else if (num != i) { Log.LogWarning("Invalid front axis for RoofTop piece: " + name + ", will not add extra snap points."); return Array.Empty<NamedSnapPoint>(); } list.Add(snapPoint.localPosition); } } } if (list.Count != 2) { Log.LogError(name + " is not a RoofTop piece"); } val4 = list[1]; Vector3 normalized = ((Vector3)(ref val4)).normalized; val4 = list[0]; val4 = normalized - ((Vector3)(ref val4)).normalized; Vector3 normalized2 = ((Vector3)(ref val4)).normalized; int num3 = -1; for (int j = 0; j < 3; j++) { if (!((Vector3)(ref normalized2))[j].Equals(0f)) { if (num3 == -1) { num3 = j; } else if (num3 != j) { Log.LogWarning("Invalid ridge axis for RoofTop piece: " + name + ", will not add extra snap points."); return Array.Empty<NamedSnapPoint>(); } } } int num4 = 3 - num3 - num; Vector3 localPosition = (list[0] + list[1]) / 2f; Vector3 val5 = default(Vector3); ((Vector3)(ref val5))[num] = ((V