using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BlueprintTweaks.BlueprintBrowserUIChanges;
using BlueprintTweaks.BlueprintDataSaveEdit;
using BlueprintTweaks.BrowserRememberFolder;
using BlueprintTweaks.DragToMoveBlueprints;
using BlueprintTweaks.FactoryUndo;
using BlueprintTweaks.FactoryUndo.Nebula;
using BlueprintTweaks.GlobalPatch;
using BlueprintTweaks.KeepBPName;
using BlueprintTweaks.Nebula;
using BlueprintTweaks.Patches;
using CommonAPI;
using CommonAPI.Systems;
using CommonAPI.Systems.ModLocalization;
using HarmonyLib;
using NebulaAPI;
using NebulaAPI.GameState;
using NebulaAPI.Interfaces;
using NebulaAPI.Networking;
using NebulaAPI.Packets;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("BlueprintTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5d9927f8b94b47d54266ca4c5da71038871c90fc")]
[assembly: AssemblyProduct("BlueprintTweaks")]
[assembly: AssemblyTitle("BlueprintTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BlueprintTweaks
{
[HarmonyPatch]
public static class BuildTool_BlueprintPastePatch
{
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), "CheckBuildConditions")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).End().MatchBack(false, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldflda, (object)AccessTools.Field(typeof(BuildTool_BlueprintPaste), "cursorTarget"), (string)null)
});
CodeMatcher val2 = val.Clone().MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
{
new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(BuildPreview), "condition"), (string)null)
});
object operand = val2.Operand;
val.Advance(1);
while (!CodeInstructionExtensions.IsStloc(val.Instruction, (LocalBuilder)null))
{
val.RemoveInstruction();
}
val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldloc_S, operand)
}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Func<BuildTool_BlueprintPaste, BuildPreview, Vector3>>((Func<BuildTool_BlueprintPaste, BuildPreview, Vector3>)((BuildTool_BlueprintPaste tool, BuildPreview preview) => ((Vector3)(ref preview.lpos)).normalized * Mathf.Min(((BuildTool)tool).planet.realRadius * 0.025f, 20f))) });
return val.InstructionEnumeration();
}
}
[HarmonyPatch]
public static class PlayerControllerPatch
{
[HarmonyPatch(typeof(PlayerController), "OpenBlueprintCopyMode")]
[HarmonyPatch(typeof(PlayerController), "OpenBlueprintPasteMode")]
[HarmonyPatch(typeof(BuildTool_BlueprintCopy), "DetermineActive")]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), "CheckBuildConditionsPrestage")]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), "DetermineActive")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> RemoveGasGiantBlocks(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlanetData), "gasItems"), (string)null)
}).Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Pop, (object)null)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldc_I4_0, (object)null)
})
.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlanetData), "gasItems"), (string)null)
})
.Advance(2)
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Pop, (object)null)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldc_I4_0, (object)null)
});
return val.InstructionEnumeration();
}
[HarmonyPatch(typeof(BuildTool_BlueprintCopy), "UpdateRaycast")]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), "UpdateRaycast")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> ChangeCastDistance(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)800f, (string)null)
}).SetInstruction(Transpilers.EmitDelegate<Func<float>>((Func<float>)(() => GameCamera.instance.blueprintPoser.planetRadius * 2.4f)));
return val.InstructionEnumeration();
}
[HarmonyPatch(typeof(PlayerController), "OpenBlueprintPasteMode")]
[HarmonyPrefix]
public static bool CheckBpForGasGiants(PlayerController __instance, BlueprintData blueprint)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Invalid comparison between Unknown and I4
if (GameMain.history.blueprintLimit == 0)
{
return false;
}
if (blueprint == null)
{
blueprint = __instance.actionBuild.blueprintClipboard;
}
if (BlueprintData.IsNullOrEmpty(blueprint))
{
return false;
}
if (BlueprintTweaksPlugin.genesisBookIsInstalled)
{
PlanetData localPlanet = __instance.gameData.localPlanet;
if (localPlanet == null || (int)localPlanet.type != 5)
{
return true;
}
}
else if (__instance.gameData.localPlanet?.gasItems == null || __instance.gameData.localPlanet.gasItems.Length == 0)
{
return true;
}
BlueprintBuilding[] buildings = blueprint.buildings;
foreach (BlueprintBuilding val in buildings)
{
ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select((int)val.itemId);
if (!val2.BuildInGas)
{
UIRealtimeTip.Popup(Localization.Translate("CantPasteThisInGasGiantWarn"), true, 0);
return false;
}
}
return true;
}
[HarmonyPatch(typeof(PlayerController), "OpenBlueprintCopyMode")]
[HarmonyPatch(typeof(PlayerController), "OpenBlueprintPasteMode")]
[HarmonyPostfix]
public static void OnBPOpenOnGasGiants(PlayerController __instance)
{
GameCamera.instance.blueprintPoser.planetRadius = __instance.gameData.localPlanet.realRadius;
}
}
[BepInPlugin("org.kremnev8.plugin.BlueprintTweaks", "Blueprint Tweaks", "1.6.10")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[CommonAPISubmoduleDependency(new string[] { "ProtoRegistry", "CustomKeyBindSystem", "PickerExtensionsSystem", "LocalizationModule" })]
public class BlueprintTweaksPlugin : BaseUnityPlugin, IMultiplayerMod
{
public const string MODNAME = "BlueprintTweaks";
public const string MODGUID = "org.kremnev8.plugin.BlueprintTweaks";
public const string MOD_DISP_NAME = "Blueprint Tweaks";
public const string VERSION = "1.6.10";
public const string GENESIS_BOOK_MODGUID = "org.LoShin.GenesisBook";
public const string FREE_FOUNDATIONS_GUID = "de.Hotte.DSP.FreeFoundations";
public const string FREE_FOUNDATIONS_GUID_2 = "com.aekoch.mods.dsp.UnlimitedFoundations";
public const string DRAG_REMOVE = "DragRemove";
public const string BLUEPRINT_FOUNDATIONS = "BlueprintFoundations";
public const string PASTE_LOCKED = "PasteLocked";
public const string FACTORY_UNDO = "FactoryUndo";
public static ManualLogSource logger;
public static ResourceData resource;
internal static ConfigFile configFile;
private static Harmony harmony;
public static DragRemoveBuildTool tool;
public static bool gotPluginInfo;
public static bool freeFoundationsIsInstalled;
public static bool genesisBookIsInstalled;
public static ConfigEntry<bool> cameraToggleEnabled;
public static ConfigEntry<bool> addPasteButtonEnabled;
public static ConfigEntry<bool> recipeChangeEnabled;
public static ConfigEntry<bool> changeTierEnabled;
public static ConfigEntry<bool> logisticCargoChangeEnabled;
public static ConfigEntry<bool> beltHintsChangeEnable;
public static ConfigEntry<bool> keepBlueprintDesc;
public static ConfigEntry<bool> keepBrowserPath;
public static ConfigEntry<bool> forcePasteEnabled;
public static ConfigEntry<bool> axisLockEnabled;
public static ConfigEntry<bool> gridControlFeature;
public static ConfigEntry<bool> blueprintMirroring;
public static ConfigEntry<bool> dragRemove;
public static ConfigEntry<bool> pasteLocked;
public static ConfigEntry<bool> moveWithDragNDrop;
public static ConfigEntry<bool> factoryUndo;
public static ConfigEntry<bool> resetFunctionsOnMenuExit;
public static ConfigEntry<bool> canBlueprintOnGasGiants;
public static ConfigEntry<bool> excludeStations;
public static ConfigEntry<bool> undoExcludeStations;
public static ConfigEntry<int> undoMaxHistory;
public static ConfigEntry<bool> showUndoClearedMessage;
private static bool appliedBlueprintDataPatch = false;
internal static List<PressKeyBind> modKeybinds = new List<PressKeyBind>();
public string Version => "1.6.10";
private void Awake()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
logger = ((BaseUnityPlugin)this).Logger;
configFile = ((BaseUnityPlugin)this).Config;
LoadConfigs();
((BaseUnityPlugin)this).Config.Save();
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
resource = new ResourceData("BlueprintTweaks", "blueprinttweaks", directoryName);
resource.LoadAssetBundle("blueprinttweaks");
ProtoRegistry.AddResource(resource);
string text = Path.Combine(directoryName, "Locale");
LocalizationModule.LoadTranslationsFromFolder(text);
harmony = new Harmony("org.kremnev8.plugin.BlueprintTweaks");
if (factoryUndo.Value)
{
UndoManager.Init();
}
UIBlueprintInspectorPatch.Init();
BlueprintUtilsPatch2.Init();
RegisterKeyBinds();
NebulaModAPI.RegisterPackets(Assembly.GetExecutingAssembly());
if (factoryUndo.Value)
{
HarmonyRegisterExtension.PatchAll(harmony, "FactoryUndo");
}
if (keepBrowserPath.Value)
{
harmony.PatchAll(typeof(BlueprintTweaks.BrowserRememberFolder.UIBlueprintBrowser_Patch));
}
if (moveWithDragNDrop.Value)
{
harmony.PatchAll(typeof(BuildTool_Copy_Patch));
harmony.PatchAll(typeof(BlueprintTweaks.DragToMoveBlueprints.UIBlueprintBrowser_Patch));
}
if (keepBlueprintDesc.Value)
{
harmony.PatchAll(typeof(BlueprintTweaks.KeepBPName.UIBlueprintInspectorPatch));
}
if (pasteLocked.Value)
{
HarmonyRegisterExtension.PatchAll(harmony, "PasteLocked");
}
if (addPasteButtonEnabled.Value)
{
harmony.PatchAll(typeof(UIBlueprintBrowserPatch));
}
if (blueprintMirroring.Value)
{
harmony.PatchAll(typeof(BlueprintUtilsPatch2));
}
if (dragRemove.Value)
{
HarmonyRegisterExtension.PatchAll(harmony, "DragRemove");
}
if (changeTierEnabled.Value)
{
harmony.PatchAll(typeof(UIBlueprintComponentItemPatch));
}
if (canBlueprintOnGasGiants.Value)
{
harmony.PatchAll(typeof(PlayerControllerPatch));
harmony.PatchAll(typeof(BuildTool_BlueprintPastePatch));
}
if (axisLockEnabled.Value || gridControlFeature.Value)
{
harmony.PatchAll(typeof(GridSnappingPatches));
harmony.PatchAll(typeof(BuildTool_BlueprintPaste_Patch));
ApplyBlueprintDataPatch();
}
if (cameraToggleEnabled.Value)
{
harmony.PatchAll(typeof(CameraFixPatch));
}
if (recipeChangeEnabled.Value || gridControlFeature.Value)
{
harmony.PatchAll(typeof(UIBlueprintInspectorPatch));
}
_ = forcePasteEnabled.Value;
harmony.PatchAll(typeof(BuildTool_BlueprintPaste_Patch_3));
logger.LogInfo((object)"Blueprint tweaks mod is initialized!");
}
private void LoadConfigs()
{
cameraToggleEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "cameraToggle", true, "Allows toggling camera between 3rd person and god view\nAll values are applied on restart");
addPasteButtonEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "addBluprintPasteButton", true, "If enabled new button will be added to Blueprint Browser. Pressing it will paste curretly selected blueprint\nAll values are applied on restart");
recipeChangeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "recipeChange", true, "Add recipe change panel to blueprint inspectors\nAll values are applied on restart");
logisticCargoChangeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "changeLogisticCargo", true, "Allows changing cargo requested/provided by logistic stations");
changeTierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "changeTier", true, "Allows using change tier functionality\nAll values are applied on restart");
beltHintsChangeEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "beltHintChange", true, "Add belt hint change panel to blueprint inspectors\nAll values are applied on restart");
keepBlueprintDesc = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "keepBlueprintDescription", true, "When pasting blueprint string into existing blueprint you can hold shift to keep description and icons");
keepBrowserPath = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "keepBroserPath", true, "Preserve last open Blueprint Browser directory. Also when creating new blueprints, they will be saved in the last open directory");
forcePasteEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "forcePaste", true, "Allow to force paste using Shift+Click");
axisLockEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "axisLock", true, "Allows using Latitude/Longtitude axis locks\nAll values are applied on restart");
gridControlFeature = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "gridControl", true, "Allows changing grid size and its offset\nAll values are applied on restart");
blueprintMirroring = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "blueprintMirroring", true, "Allows mirroring Blueprints\nAll values are applied on restart");
dragRemove = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "dragRemove", true, "Allows using drag remove function\nAll values are applied on restart");
pasteLocked = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "PasteLockedRecipes", true, "Allow pasting assemblers with recipes which have not been unlocked yet. Assemblers with recipes that are not unlocked will not work.");
moveWithDragNDrop = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "moveBPWithDragNDrop", true, "Allow moving blueprints using drag and drop");
factoryUndo = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "factoryUndo", true, "Enable Factory Undo feature. Allows to undo/redo most building actions. Will force dragRemove to true");
resetFunctionsOnMenuExit = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "resetOnExit", true, "If enabled when you exit build mode, some functions (Axis/Grid lock, Mirror) will reset their state");
canBlueprintOnGasGiants = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "bpOnGasGiants", true, "Allow using Blueprints on Gas Giants\nAll values are applied on restart");
excludeStations = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "excludeStations", true, "When using drag remove tool, logistic stations (and miners Mk.II) will not get removed. This is a safeguard against errors which occur most of the time when you try to mass dismantle logistic stations.");
undoMaxHistory = ((BaseUnityPlugin)this).Config.Bind<int>("Misc", "undoMaxHistory", 50, "Defines undo history size. When history reaches it's capacity, old entries will get removed. When using Nebula host controls the used value");
undoExcludeStations = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "undoExcludeStations", true, "When enabled factory undo will not undo/redo actions with logistic stations.");
showUndoClearedMessage = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "showUndoClearedMessage", true, "Should a message informing you that undo history has been cleared be shown whenever you leave a planet?");
ConfigFileExtension.MigrateConfig<bool>(((BaseUnityPlugin)this).Config, "General", "Interface", new string[4] { "cameraToggle", "recipeChange", "changeLogisticCargo", "changeTier" });
ConfigFileExtension.MigrateConfig<bool>(((BaseUnityPlugin)this).Config, "General", "Features", new string[5] { "forcePaste", "axisLock", "gridControl", "gridControl", "blueprintFoundations" });
ConfigFileExtension.MigrateConfig<bool>(((BaseUnityPlugin)this).Config, "General", "Misc", new string[1] { "bpOnGasGiants" });
if (factoryUndo.Value)
{
dragRemove.Value = true;
}
}
private static void RegisterKeyBinds()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
if (cameraToggleEnabled.Value)
{
modKeybinds.Add(CustomKeyBindSystem.RegisterKeyBindWithReturn<PressKeyBind>(new BuiltinKey
{
key = new CombineKey(106, (byte)0, (ECombineKeyAction)0, false),
conflictGroup = 3071,
name = "ToggleBPGodModeDesc",
canOverride = true
}));
}
if (forcePasteEnabled.Value)
{
modKeybinds.Add((PressKeyBind)(object)CustomKeyBindSystem.RegisterKeyBindWithReturn<HoldKeyBind>(new BuiltinKey
{
key = new CombineKey(0, (byte)1, (ECombineKeyAction)0, false),
conflictGroup = 2052,
name = "ForceBPPlace",
canOverride = true
}));
}
if (axisLockEnabled.Value)
{
modKeybinds.Add(CustomKeyBindSystem.RegisterKeyBindWithReturn<PressKeyBind>(new BuiltinKey
{
key = new CombineKey(103, (byte)2, (ECombineKeyAction)0, false),
conflictGroup = 2052,
name = "LockLongAxis",
canOverride = true
}));
modKeybinds.Add(CustomKeyBindSystem.RegisterKeyBindWithReturn<PressKeyBind>(new BuiltinKey
{
key = new CombineKey(116, (byte)2, (ECombineKeyAction)0, false),
conflictGroup = 2052,
name = "LockLatAxis",
canOverride = true
}));
}
if (gridControlFeature.Value)
{
modKeybinds.Add(CustomKeyBindSystem.RegisterKeyBindWithReturn<PressKeyBind>(new BuiltinKey
{
key = new CombineKey(98, (byte)2, (ECombineKeyAction)0, false),
conflictGroup = 2052,
name = "SetLocalOffset",
canOverride = true
}));
}
if (blueprintMirroring.Value)
{
modKeybinds.Add(CustomKeyBindSystem.RegisterKeyBindWithReturn<PressKeyBind>(new BuiltinKey
{
key = new CombineKey(103, (byte)1, (ECombineKeyAction)0, false),
conflictGroup = 2052,
name = "MirrorLongAxis",
canOverride = true
}));
modKeybinds.Add(CustomKeyBindSystem.RegisterKeyBindWithReturn<PressKeyBind>(new BuiltinKey
{
key = new CombineKey(116, (byte)1, (ECombineKeyAction)0, false),
conflictGroup = 2052,
name = "MirrorLatAxis",
canOverride = true
}));
}
if (factoryUndo.Value)
{
BuiltinKey val = default(BuiltinKey);
val.key = new CombineKey(122, (byte)2, (ECombineKeyAction)0, false);
val.conflictGroup = 2052;
val.name = "FactoryUndo";
val.canOverride = true;
CustomKeyBindSystem.RegisterKeyBind<PressKeyBind>(val);
val = default(BuiltinKey);
val.key = new CombineKey(122, (byte)1, (ECombineKeyAction)0, false);
val.conflictGroup = 2052;
val.name = "FactoryRedo";
val.canOverride = true;
CustomKeyBindSystem.RegisterKeyBind<PressKeyBind>(val);
}
}
private void Update()
{
if (!gotPluginInfo)
{
if (Chainloader.PluginInfos.ContainsKey("de.Hotte.DSP.FreeFoundations"))
{
freeFoundationsIsInstalled = true;
}
if (Chainloader.PluginInfos.ContainsKey("com.aekoch.mods.dsp.UnlimitedFoundations"))
{
freeFoundationsIsInstalled = true;
}
if (Chainloader.PluginInfos.ContainsKey("org.LoShin.GenesisBook"))
{
genesisBookIsInstalled = true;
}
gotPluginInfo = true;
}
if (!GameMain.isRunning || GameMain.localPlanet == null)
{
return;
}
if (factoryUndo.Value)
{
if (CustomKeyBindSystem.GetKeyBind("FactoryUndo").keyValue)
{
UndoManager.TryUndo();
}
if (CustomKeyBindSystem.GetKeyBind("FactoryRedo").keyValue)
{
UndoManager.TryRedo();
}
}
if (cameraToggleEnabled.Value && CustomKeyBindSystem.GetKeyBind("ToggleBPGodModeDesc").keyValue)
{
CameraFixPatch.mode = !CameraFixPatch.mode;
}
if (axisLockEnabled.Value && CustomKeyBindSystem.GetKeyBind("LockLongAxis").keyValue)
{
GridSnappingPatches.LockLongitude();
}
if (axisLockEnabled.Value && CustomKeyBindSystem.GetKeyBind("LockLatAxis").keyValue)
{
GridSnappingPatches.LockLatitude();
}
if (gridControlFeature.Value && CustomKeyBindSystem.GetKeyBind("SetLocalOffset").keyValue)
{
GridSnappingPatches.SetOffset();
}
_ = forcePasteEnabled.Value;
if (blueprintMirroring.Value && CustomKeyBindSystem.GetKeyBind("MirrorLongAxis").keyValue)
{
BlueprintUtilsPatch2.mirrorLong = !BlueprintUtilsPatch2.mirrorLong;
BlueprintUtilsPatch2.UpdateBlueprintDisplay();
}
if (blueprintMirroring.Value && CustomKeyBindSystem.GetKeyBind("MirrorLatAxis").keyValue)
{
BlueprintUtilsPatch2.mirrorLat = !BlueprintUtilsPatch2.mirrorLat;
BlueprintUtilsPatch2.UpdateBlueprintDisplay();
}
}
private void PrintKeyDebugInfo()
{
HashSet<KeyCode> source = new HashSet<KeyCode>((KeyCode[])Enum.GetValues(typeof(KeyCode)));
string text = GeneralExtensions.Join<string>(from code in source
select Input.GetKeyDown(code) ? ((object)(KeyCode)(ref code)).ToString() : "" into s
where !string.IsNullOrEmpty(s)
select s, (Func<string, string>)null, " ");
string text2 = GeneralExtensions.Join<string>(from code in source
select Input.GetKey(code) ? ((object)(KeyCode)(ref code)).ToString() : "" into s
where !string.IsNullOrEmpty(s)
select s, (Func<string, string>)null, " ");
logger.LogInfo((object)("Key Debug Info: down: " + text + ", pressed: " + text2));
}
public static void RegisterCustomBlueprintDataSerializer<T>(string key) where T : ICustomBlueprintDataSerializer, new()
{
ApplyBlueprintDataPatch();
if (BlueprintData_Patch_2.customSerializers.ContainsKey(key))
{
logger.LogError((object)("Failed to register custom blueprint data serializer with key '" + key + "' and type " + typeof(T).FullName + ", because the key has been already taken!"));
}
else
{
T val = new T();
BlueprintData_Patch_2.customSerializers.Add(key, val);
logger.LogInfo((object)("Registered custom blueprint data serializer with key '" + key + "'"));
}
}
private static void ApplyBlueprintDataPatch()
{
if (!appliedBlueprintDataPatch)
{
harmony.PatchAll(typeof(BlueprintData_Patch_2));
appliedBlueprintDataPatch = true;
}
}
public bool CheckVersion(string hostVersion, string clientVersion)
{
return hostVersion.Equals(clientVersion);
}
}
public class CustomWindowData
{
public UIBlueprintPanel[] panels;
public RectTransform mainPane;
}
public abstract class UIBlueprintPanel : MonoBehaviour
{
[HideInInspector]
public UIBlueprintInspector inspector;
[HideInInspector]
public RectTransform panelTrs;
public abstract int verticalSize { get; }
public virtual void Create(UIBlueprintInspector inspector)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
this.inspector = inspector;
panelTrs = (RectTransform)((Component)this).transform;
}
public void RefreshUI()
{
if (inspector.blueprint != null && inspector.blueprint.isValid)
{
OnUpdate();
}
}
public virtual void OnOpen()
{
}
public virtual void OnUpdate()
{
}
}
public class UIBlueprintRecipeItem : MonoBehaviour
{
[HideInInspector]
public UIRecipesPanel panel;
public RectTransform rectTrans;
public UIButton button;
public Image iconImage;
private int recipeId;
private ERecipeType recipeFilter;
private const int kMargin = 0;
private const int kWidth = 46;
private const int kHeight = 46;
private const int kColCount = 8;
public int position
{
get
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
return Mathf.RoundToInt(rectTrans.anchoredPosition.x / 46f) + Mathf.RoundToInt((0f - rectTrans.anchoredPosition.y) / 46f) * 8;
}
set
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
rectTrans.anchoredPosition = new Vector2((float)(value % 8 * 46), (float)(-(value / 8 * 46)));
}
}
public void Create(UIRecipesPanel panel)
{
this.panel = panel;
button.onClick += OnClick;
}
public void Free()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
button.onClick -= OnClick;
recipeId = 0;
button.tips.itemId = 0;
button.data = 0;
iconImage.sprite = null;
((Graphic)iconImage).color = Color.clear;
}
public void Open()
{
((Component)this).gameObject.SetActive(true);
}
public void Close()
{
button.tips.itemId = 0;
button.data = 0;
recipeId = 0;
((Component)this).gameObject.SetActive(false);
}
public int SetDisplay(int newIndex, int recipeID)
{
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
position = newIndex;
if (recipeId != recipeID)
{
recipeId = recipeID;
button.data = recipeId;
RecipeProto val = ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(recipeID);
button.tips.itemId = 0;
button.tips.tipTitle = "";
button.tips.tipText = "";
if (val != null)
{
button.tips.itemId = val.Results[0];
recipeFilter = val.Type;
iconImage.sprite = val.iconSprite;
((Graphic)iconImage).color = Color.white;
}
else if (recipeID < 0)
{
recipeFilter = (ERecipeType)(-recipeID);
string arg = Localization.Translate($"{recipeFilter}RecipeKind");
button.tips.tipTitle = string.Format(Localization.Translate("SelectEmptyRecipeTitle"), arg);
button.tips.tipText = string.Format(Localization.Translate("SelectEmptyRecipeText"), arg);
iconImage.sprite = UIRecipesPanel.noRecipeIcon;
((Graphic)iconImage).color = Color.white;
}
else
{
iconImage.sprite = null;
((Graphic)iconImage).color = Color.clear;
}
}
return (newIndex / 8 + 1) * 46;
}
private void OnClick(int obj)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 1, -1, -1L);
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(-300f, 238f);
UIRecipePicker.Close();
UIRecipePicker.Popup(val, (Action<RecipeProto>)delegate(RecipeProto proto)
{
if (proto != null)
{
panel.ChangeRecipe(recipeId, proto);
}
}, recipeFilter);
}
}
public class UIBPComponentPanel : UIBlueprintPanel
{
public override int verticalSize
{
get
{
if (inspector.componentCount == 0)
{
return 22;
}
return 22 + ((inspector.componentCount - 1) / 8 + 1) * 46;
}
}
public override void Create(UIBlueprintInspector inspector)
{
base.Create(inspector);
panelTrs = inspector.group2;
}
}
public class UIBPReformsPanel : UIBlueprintPanel
{
public override int verticalSize
{
get
{
if (inspector.blueprint.reformData.reformCount == 0)
{
return 0;
}
return 68;
}
}
public override void Create(UIBlueprintInspector inspector)
{
base.Create(inspector);
panelTrs = inspector.group4;
}
}
public class UIBPStringCopyPanel : UIBlueprintPanel
{
public override int verticalSize => 110;
public override void Create(UIBlueprintInspector inspector)
{
base.Create(inspector);
panelTrs = inspector.group3;
}
}
public class UIHintItem : MonoBehaviour
{
[HideInInspector]
public UIHintsPanel panel;
public RectTransform rectTrans;
public UIButton button;
public Image iconImage;
public Text countText;
private HintData currentHint;
private const int kMargin = 0;
private const int kWidth = 46;
private const int kHeight = 46;
private const int kColCount = 8;
public int position
{
get
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
return Mathf.RoundToInt(rectTrans.anchoredPosition.x / 46f) + Mathf.RoundToInt((0f - rectTrans.anchoredPosition.y) / 46f) * 8;
}
set
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
rectTrans.anchoredPosition = new Vector2((float)(value % 8 * 46), (float)(-(value / 8 * 46)));
}
}
public void Create(UIHintsPanel panel)
{
this.panel = panel;
button.onClick += OnClick;
}
public void Free()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
button.onClick -= OnClick;
currentHint = default(HintData);
button.tips.itemId = 0;
button.data = 0;
iconImage.sprite = null;
((Graphic)iconImage).color = Color.clear;
countText.text = "";
}
public void Open()
{
((Component)this).gameObject.SetActive(true);
}
public void Close()
{
button.tips.itemId = 0;
button.data = 0;
currentHint = default(HintData);
((Component)this).gameObject.SetActive(false);
}
public int SetDisplay(int newIndex, HintData newHint)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
position = newIndex;
if (!object.Equals(currentHint, newHint))
{
currentHint = newHint;
button.data = currentHint.signalId;
Sprite val = LDB.signals.IconSprite(currentHint.signalId);
if ((Object)(object)val != (Object)null)
{
button.tips.itemId = currentHint.signalId;
iconImage.sprite = val;
((Graphic)iconImage).color = Color.white;
}
else
{
iconImage.sprite = null;
((Graphic)iconImage).color = Color.clear;
}
countText.text = ((newHint.value != 0) ? newHint.value.ToString() : "");
}
return (newIndex / 8 + 1) * 46;
}
private void OnClick(int obj)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
VFAudio.Create("ui-click-0", (Transform)null, Vector3.zero, true, 1, -1, -1L);
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(-300f, 238f);
UISignalPicker.Close();
UINumberPickerExtension.Popup(val, (Action<int, int>)delegate(int signalId, int value)
{
if (value < 0)
{
value = 0;
}
panel.ChangeHint(currentHint.signalId, new HintData(signalId, value));
}, currentHint.value, currentHint.signalId, (Func<int, bool>)null);
}
}
public struct HintData
{
public int signalId;
public int value;
public HintData(int signalId, int value)
{
this.signalId = signalId;
this.value = value;
}
}
public class UIHintsPanel : UIBlueprintPanel
{
public List<UIHintItem> hintsItems = new List<UIHintItem>();
public List<HintData> tmpHintList = new List<HintData>();
public int hintsCount;
public UIHintItem prefab;
public override int verticalSize
{
get
{
if (hintsCount == 0)
{
return 22;
}
return 22 + ((hintsCount - 1) / 8 + 1) * 46;
}
}
public override void OnUpdate()
{
tmpHintList.Clear();
BlueprintBuilding[] buildings = inspector.blueprint.buildings;
foreach (BlueprintBuilding val in buildings)
{
int itemId = val.itemId;
ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId);
if (val2 == null || !val2.prefabDesc.isBelt || val.parameters == null || val.parameters.Length < 1)
{
continue;
}
int signalId = val.parameters[0];
if (signalId != 0)
{
int count = 0;
if (val.parameters.Length >= 2)
{
count = val.parameters[1];
}
if (!tmpHintList.Any((HintData data) => data.signalId == signalId && data.value == count))
{
tmpHintList.Add(new HintData(signalId, count));
}
}
}
int num = 0;
foreach (HintData tmpHint in tmpHintList)
{
SetItem(num, tmpHint);
num++;
}
ClearComponentItems(num);
}
public void SetItem(int index, HintData itemId)
{
if (index >= 0 && index <= 256)
{
while (index >= hintsItems.Count)
{
UIHintItem uIHintItem = Object.Instantiate<UIHintItem>(prefab, ((Component)prefab).transform.parent);
uIHintItem.Create(this);
hintsItems.Add(uIHintItem);
}
hintsItems[index].SetDisplay(index, itemId);
hintsItems[index].Open();
}
}
public void ClearComponentItems(int activeCount = 0)
{
for (int i = activeCount; i < hintsItems.Count; i++)
{
hintsItems[i].Close();
}
hintsCount = activeCount;
}
public void ChangeHint(int oldSignalId, HintData newSignal)
{
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Invalid comparison between Unknown and I4
BlueprintBuilding[] buildings = inspector.blueprint.buildings;
foreach (BlueprintBuilding val in buildings)
{
int itemId = val.itemId;
ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId);
if (val2.prefabDesc.isBelt && val.parameters != null && val.parameters.Length >= 1 && val.parameters[0] == oldSignalId)
{
val.parameters[0] = newSignal.signalId;
if (val.parameters.Length >= 2)
{
val.parameters[1] = newSignal.value;
}
else if (newSignal.value != 0)
{
val.parameters = new int[2] { newSignal.signalId, newSignal.value };
}
}
}
if ((int)inspector.usage == 2)
{
inspector.pasteBuildTool.ResetStates();
}
inspector.Refresh(true, true, true, false);
}
}
public class UIKeybindHintsPanel : UIBlueprintPanel
{
public ConfigEntry<bool> isCollapsed;
public int currentSize = 22;
public Text collapseText;
public Text hintText;
public override int verticalSize => currentSize;
private void Awake()
{
isCollapsed = BlueprintTweaksPlugin.configFile.Bind<bool>("Runtime", "KeyBindHints_IsCollapsed", true, "This is a runtime option. You don't need to change it here, it can be altered ingame!");
}
public override void OnOpen()
{
OnUpdate();
}
public override void OnUpdate()
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
currentSize = 22;
string text = Localization.Translate("KeyHintsCollapseText");
string text2 = (isCollapsed.Value ? "▶" : "▼");
collapseText.text = text2 + " " + text;
if (isCollapsed.Value)
{
hintText.text = "";
return;
}
StringBuilder stringBuilder = new StringBuilder();
foreach (PressKeyBind modKeybind in BlueprintTweaksPlugin.modKeybinds)
{
CombineKey val = modKeybind.defaultBind.key;
if (!((CombineKey)(ref VFInput.override_keys[modKeybind.defaultBind.id])).IsNull())
{
val = VFInput.override_keys[modKeybind.defaultBind.id];
}
string text3 = "KEY" + modKeybind.defaultBind.name;
stringBuilder.Append(string.Format(Localization.Translate("KeyHintsPress"), ((object)(CombineKey)(ref val)).ToString(), Localization.Translate(text3)));
stringBuilder.Append('\n');
currentSize += 22;
}
hintText.text = stringBuilder.ToString();
}
public void OnCollapseClicked()
{
isCollapsed.Value = !isCollapsed.Value;
inspector.Refresh(true, true, true, false);
}
}
public class UIRecipesPanel : UIBlueprintPanel
{
public List<UIBlueprintRecipeItem> recipeItems = new List<UIBlueprintRecipeItem>();
public List<int> tmpRecipeList = new List<int>();
public int recipeCount;
public UIBlueprintRecipeItem prefab;
public static Sprite noRecipeIcon;
public override int verticalSize
{
get
{
if (recipeCount == 0)
{
return 22;
}
return 22 + ((recipeCount - 1) / 8 + 1) * 46;
}
}
private void Awake()
{
noRecipeIcon = Resources.Load<Sprite>("ui/textures/sprites/icons/select-recipe");
}
public override void OnUpdate()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unsupported input type for neg.
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected I4, but got Unknown
tmpRecipeList.Clear();
BlueprintBuilding[] buildings = inspector.blueprint.buildings;
foreach (BlueprintBuilding val in buildings)
{
int num = val.recipeId;
if (num == 0)
{
ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select((int)val.itemId);
if (val2.prefabDesc != null)
{
num = 0 - val2.prefabDesc.assemblerRecipeType;
if (val2.prefabDesc.isLab && val.parameters.Length != 0 && val.parameters[0] != 2)
{
num = -15;
}
}
}
if (num != 0 && !tmpRecipeList.Contains(num))
{
tmpRecipeList.Add(num);
}
}
int num2 = 0;
foreach (int tmpRecipe in tmpRecipeList)
{
SetItem(num2, tmpRecipe);
num2++;
}
ClearComponentItems(num2);
}
public void SetItem(int index, int recipeId)
{
if (index >= 0 && index <= 256)
{
while (index >= recipeItems.Count)
{
UIBlueprintRecipeItem uIBlueprintRecipeItem = Object.Instantiate<UIBlueprintRecipeItem>(prefab, ((Component)prefab).transform.parent);
uIBlueprintRecipeItem.Create(this);
recipeItems.Add(uIBlueprintRecipeItem);
}
recipeItems[index].SetDisplay(index, recipeId);
recipeItems[index].Open();
}
}
public void ClearComponentItems(int activeCount = 0)
{
for (int i = activeCount; i < recipeItems.Count; i++)
{
recipeItems[i].Close();
}
recipeCount = activeCount;
}
public void ChangeRecipe(int oldRecipe, RecipeProto newRecipe)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Invalid comparison between Unknown and I4
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Invalid comparison between Unknown and I4
BlueprintBuilding[] buildings = inspector.blueprint.buildings;
if (oldRecipe < 0)
{
ERecipeType val = (ERecipeType)(-oldRecipe);
BlueprintBuilding[] array = buildings;
foreach (BlueprintBuilding val2 in array)
{
if (val2.recipeId != 0)
{
continue;
}
ItemProto val3 = ((ProtoSet<ItemProto>)(object)LDB.items).Select((int)val2.itemId);
if (val3.prefabDesc != null)
{
if (val3.prefabDesc.assemblerRecipeType == val)
{
val2.recipeId = ((Proto)newRecipe).ID;
}
else if (val3.prefabDesc.isLab && (int)val == 15 && val2.parameters.Length != 0 && val2.parameters[0] != 2)
{
val2.recipeId = ((Proto)newRecipe).ID;
val2.parameters[0] = 1;
}
}
}
}
else
{
BlueprintBuilding[] array2 = buildings;
foreach (BlueprintBuilding val4 in array2)
{
if (val4.recipeId == oldRecipe)
{
val4.recipeId = ((Proto)newRecipe).ID;
}
}
}
if ((int)inspector.usage == 2)
{
inspector.pasteBuildTool.ResetStates();
}
inspector.Refresh(true, true, true, false);
}
}
[HarmonyPatch]
public static class UIBlueprintComponentItemPatch
{
[HarmonyPatch(typeof(UIBlueprintComponentItem), "_OnRegEvent")]
[HarmonyPostfix]
public static void AddEvent(UIBlueprintComponentItem __instance)
{
__instance.button.onClick += GetAction(__instance.inspector);
}
[HarmonyPatch(typeof(UIBlueprintComponentItem), "_OnUnregEvent")]
[HarmonyPostfix]
public static void RemoveEvent(UIBlueprintComponentItem __instance)
{
__instance.button.onClick -= GetAction(__instance.inspector);
}
public static Action<int> GetAction(UIBlueprintInspector inspector)
{
return OnClick;
void OnClick(int itemId)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
UIItemPickerExtension.Popup(new Vector2(-300f, 238f), (Action<ItemProto>)delegate(ItemProto proto)
{
if (proto != null)
{
SetBuildings(inspector, itemId, proto);
}
}, (Func<ItemProto, bool>)((ItemProto proto) => proto.Upgrades?.Contains(itemId) ?? false));
}
}
public static void SetBuildings(UIBlueprintInspector inspector, int oldItemId, ItemProto newItem)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Invalid comparison between Unknown and I4
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Invalid comparison between Unknown and I4
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Invalid comparison between Unknown and I4
BlueprintBuilding[] buildings = inspector.blueprint.buildings;
foreach (BlueprintBuilding val in buildings)
{
if (val.itemId == oldItemId)
{
val.itemId = (short)((Proto)newItem).ID;
val.modelIndex = (short)newItem.ModelIndex;
}
}
if ((int)inspector.usage == 0 || (int)inspector.usage == 2)
{
if ((int)inspector.usage == 2)
{
inspector.pasteBuildTool.ResetStates();
}
}
else if ((int)inspector.usage == 1)
{
_ = ((BuildTool)inspector.copyBuildTool).active;
}
inspector.Refresh(true, true, true, false);
}
}
[HarmonyPatch]
public static class UIBlueprintInspectorPatch
{
public static Dictionary<UIBlueprintInspector, CustomWindowData> panelData = new Dictionary<UIBlueprintInspector, CustomWindowData>();
public static List<string> panelPrefabs = new List<string>();
public static void Init()
{
if (BlueprintTweaksPlugin.gridControlFeature.Value)
{
panelPrefabs.Add("assets/blueprinttweaks/ui/panels/grid-size-panel.prefab");
}
panelPrefabs.Add("assets/blueprinttweaks/ui/panels/component-panel.prefab#ReformOverride");
panelPrefabs.Add("assets/blueprinttweaks/ui/panels/component-panel.prefab");
if (BlueprintTweaksPlugin.recipeChangeEnabled.Value)
{
panelPrefabs.Add("assets/blueprinttweaks/ui/panels/recipe-panel.prefab");
}
if (BlueprintTweaksPlugin.logisticCargoChangeEnabled.Value)
{
panelPrefabs.Add("Assets/BlueprintTweaks/UI/panels/transport-panel.prefab");
}
if (BlueprintTweaksPlugin.beltHintsChangeEnable.Value)
{
panelPrefabs.Add("Assets/BlueprintTweaks/UI/panels/hints-group.prefab");
}
panelPrefabs.Add("assets/blueprinttweaks/ui/panels/string-copy-panel.prefab");
panelPrefabs.Add("Assets/BlueprintTweaks/UI/panels/keybind-hints-panel.prefab");
}
[HarmonyPatch(typeof(UIBlueprintBrowser), "_OnCreate")]
[HarmonyPostfix]
public static void OnCreateBrowser(UIBlueprintBrowser __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_000e: 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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = (RectTransform)((Component)__instance).transform;
val.sizeDelta = new Vector2(val.sizeDelta.x + 22f, val.sizeDelta.y);
RectTransform val2 = (RectTransform)((Transform)val).Find("inspector-group-bg");
val2.sizeDelta = new Vector2(val2.sizeDelta.x + 22f, val2.sizeDelta.y);
}
[HarmonyPatch(typeof(UIBlueprintInspector), "_OnCreate")]
[HarmonyPostfix]
public static void OnCreateInspector(UIBlueprintInspector __instance)
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Expected O, but got Unknown
if (panelData == null || panelData.ContainsKey(__instance))
{
return;
}
GameObject val = BlueprintTweaksPlugin.resource.bundle.LoadAsset<GameObject>("assets/blueprinttweaks/ui/bp-panel-scroll.prefab");
GameObject val2 = Object.Instantiate<GameObject>(val, (Transform)(object)__instance.rectTrans, false);
GameObject gameObject = ((Component)val2.transform.Find("Viewport/pane")).gameObject;
((Transform)__instance.group1).SetParent(gameObject.transform, false);
((Transform)__instance.group2).SetParent(gameObject.transform, false);
((Transform)__instance.group3).SetParent(gameObject.transform, false);
((Transform)__instance.group4).SetParent(gameObject.transform, false);
RectTransform rectTrans = __instance.rectTrans;
rectTrans.sizeDelta = new Vector2(rectTrans.sizeDelta.x + 16f, rectTrans.sizeDelta.y);
UIBlueprintPanel[] array = new UIBlueprintPanel[panelPrefabs.Count];
for (int i = 0; i < panelPrefabs.Count; i++)
{
string text = panelPrefabs[i];
string text2 = "";
string[] array2 = text.Split(new char[1] { '#' });
if (array2.Length == 2)
{
text = array2[0];
text2 = array2[1];
}
GameObject val3 = BlueprintTweaksPlugin.resource.bundle.LoadAsset<GameObject>(text);
GameObject val4 = Object.Instantiate<GameObject>(val3, gameObject.transform, false);
UIBlueprintPanel uIBlueprintPanel = val4.GetComponent<UIBlueprintPanel>();
if (text2 == "ReformOverride")
{
Object.DestroyImmediate((Object)(object)uIBlueprintPanel);
uIBlueprintPanel = val4.AddComponent<UIBPReformsPanel>();
}
uIBlueprintPanel.Create(__instance);
array[i] = uIBlueprintPanel;
}
((Component)__instance.group1).transform.SetAsLastSibling();
CustomWindowData value = new CustomWindowData
{
panels = array,
mainPane = (RectTransform)gameObject.transform
};
panelData.Add(__instance, value);
}
[HarmonyPatch(typeof(UIBlueprintInspector), "_OnOpen")]
[HarmonyPostfix]
public static void OnOpen(UIBlueprintInspector __instance)
{
if (panelData != null && panelData.ContainsKey(__instance))
{
UIBlueprintPanel[] panels = panelData[__instance].panels;
UIBlueprintPanel[] array = panels;
foreach (UIBlueprintPanel uIBlueprintPanel in array)
{
uIBlueprintPanel.OnOpen();
}
}
}
[HarmonyPatch(typeof(UIBlueprintInspector), "Refresh")]
[HarmonyPostfix]
public static void OnRefresh(UIBlueprintInspector __instance, bool refreshComponent)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
if (panelData == null || !panelData.ContainsKey(__instance))
{
return;
}
UIBlueprintPanel[] panels = panelData[__instance].panels;
RectTransform mainPane = panelData[__instance].mainPane;
int num = Mathf.RoundToInt((__instance.descTextInput.preferredHeight - 0.1f) / 2f) * 2;
if (num < 38)
{
num = 38;
}
int num2 = num + 136;
int num3 = (((int)__instance.usage == 0) ? 18 : 24);
int num4 = num2 + num3;
UIBlueprintPanel[] array = panels;
foreach (UIBlueprintPanel uIBlueprintPanel in array)
{
try
{
uIBlueprintPanel.RefreshUI();
int verticalSize = uIBlueprintPanel.verticalSize;
uIBlueprintPanel.panelTrs.anchoredPosition = new Vector2(uIBlueprintPanel.panelTrs.anchoredPosition.x, (float)(-num4));
num4 += verticalSize + num3;
((Component)uIBlueprintPanel).gameObject.SetActive(true);
}
catch (Exception arg)
{
((Component)uIBlueprintPanel).gameObject.SetActive(false);
BlueprintTweaksPlugin.logger.LogWarning((object)$"Failed to update {((object)uIBlueprintPanel).GetType().Name}:\n{arg}");
}
}
mainPane.sizeDelta = new Vector2(mainPane.sizeDelta.x, (float)num4);
}
}
[HarmonyPatch]
public static class CameraFixPatch
{
public static bool mode;
[HarmonyPatch(typeof(GameCamera), "Logic")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> FixCamera(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlayerController), "actionBuild"), (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(PlayerAction_Build), "get_blueprintMode", (Type[])null, (Type[])null), (string)null)
}).MatchForward(true, (CodeMatch[])(object)new CodeMatch[3]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_4, (object)null, (string)null)
}).SetInstruction(Transpilers.EmitDelegate<Func<int>>((Func<int>)(() => (!mode) ? 1 : 4)));
return val.InstructionEnumeration();
}
[HarmonyPatch(typeof(PlayerMove_Drift), "GameTick")]
[HarmonyPatch(typeof(PlayerMove_Fly), "GameTick")]
[HarmonyPatch(typeof(PlayerMove_Walk), "GameTick")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> FixMovement(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[4]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlayerController), "actionBuild"), (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(PlayerAction_Build), "get_blueprintMode", (Type[])null, (Type[])null), (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Cgt_Un, (object)null, (string)null)
}).Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool isBp) => isBp && mode)) });
return val.InstructionEnumeration();
}
}
public class DragRemoveBuildTool : BuildTool
{
public bool castTerrain;
public bool castGround;
public Vector3 castGroundPos = Vector3.zero;
public Vector3 castGroundPosSnapped = Vector3.zero;
public int castObjectId;
public Vector3 castObjectPos;
public bool cursorValid;
public Vector3 cursorTarget;
public Vector3 startGroundPosSnapped = Vector3.zero;
public Vector3 lastGroundPosSnapped = Vector3.zero;
public BPGratBox selectGratBox = BPGratBox.zero;
public BPGratBox lastSelectGratBox = BPGratBox.zero;
public BPGratBox selectArcBox = BPGratBox.zero;
public HashSet<int> selectObjIds;
public HashSet<int> edgeObjIds;
public BuildPreview[] bpPool;
public AnimData[] animPool;
public ComputeBuffer animBuffer;
public int bpCursor = 1;
private int bpPoolCapacity;
private int[] bpRecycle;
private int bpRecycleCursor;
private List<int> _tmp_int_list;
public bool isSelecting;
private UIMessageBox dismantleQueryBox;
private bool waitingForPlayerInput;
public int segment => base.planet.aux.activeGrid?.segment ?? 200;
public override void _OnInit()
{
selectObjIds = new HashSet<int>();
edgeObjIds = new HashSet<int>();
SetDisplayPreviewCapacity(256);
waitingForPlayerInput = false;
}
public override void _OnFree()
{
selectObjIds = null;
edgeObjIds = null;
FreeBuildPreviews();
waitingForPlayerInput = false;
}
public override void _OnOpen()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_0067: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
ClearSelection();
ResetBuildPreviews();
castTerrain = false;
castGround = false;
castGroundPos = Vector3.zero;
startGroundPosSnapped = (lastGroundPosSnapped = (castGroundPosSnapped = Vector3.zero));
lastSelectGratBox = (selectGratBox = (selectArcBox = BPGratBox.zero));
castObjectId = 0;
castObjectPos = Vector3.zero;
cursorValid = false;
cursorTarget = Vector3.zero;
isSelecting = false;
waitingForPlayerInput = false;
}
public override void _OnClose()
{
//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)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
DismantleQueryRemove();
ClearSelection();
ResetBuildPreviews();
startGroundPosSnapped = (lastGroundPosSnapped = (castGroundPosSnapped = Vector3.zero));
lastSelectGratBox = (selectGratBox = (selectArcBox = BPGratBox.zero));
castObjectId = 0;
castObjectPos = Vector3.zero;
cursorValid = false;
cursorTarget = Vector3.zero;
waitingForPlayerInput = false;
}
public override void _OnTick(long time)
{
UpdateRaycast();
Operating();
if (((BuildTool)this).active)
{
((BuildTool)this).UpdatePreviewModels(((BuildTool)this).actionBuild.model);
}
}
public override bool DetermineActive()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
if ((int)((BuildTool)this).actionBuild.blueprintMode != 0)
{
return false;
}
if (((BuildTool)this).controller.cmd.mode == -1)
{
return ((BuildTool)this).actionBuild.dismantleTool.cursorType == 2;
}
return false;
}
public void UpdateRaycast()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Invalid comparison between Unknown and I4
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Invalid comparison between Unknown and I4
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Invalid comparison between Unknown and I4
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: 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_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: 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_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
castTerrain = false;
castGround = false;
castGroundPos = Vector3.zero;
castGroundPosSnapped = Vector3.zero;
castObjectId = 0;
castObjectPos = Vector3.zero;
cursorValid = false;
cursorTarget = Vector3.zero;
if (!VFInput.onGUI && VFInput.inScreen)
{
RaycastHit val = default(RaycastHit);
castGround = Physics.Raycast(base.mouseRay, ref val, 800f, 8720, (QueryTriggerInteraction)2);
if (castGround)
{
Layer val2 = (Layer)((Component)((RaycastHit)(ref val)).collider).gameObject.layer;
castTerrain = (int)val2 == 9 || (int)val2 == 4;
castGroundPos = (((BuildTool)this).controller.cmd.test = (((BuildTool)this).controller.cmd.target = ((RaycastHit)(ref val)).point));
castGroundPosSnapped = ((BuildTool)this).actionBuild.planetAux.Snap(castGroundPos, castTerrain);
castGroundPosSnapped = ((Vector3)(ref castGroundPosSnapped)).normalized * (base.planet.realRadius + 0.2f);
((BuildTool)this).controller.cmd.test = castGroundPosSnapped;
Vector3 normalized = ((Vector3)(ref castGroundPosSnapped)).normalized;
if (Physics.Raycast(new Ray(castGroundPosSnapped + normalized * 10f, -normalized), ref val, 20f, 8720, (QueryTriggerInteraction)2))
{
((BuildTool)this).controller.cmd.test = ((RaycastHit)(ref val)).point;
}
cursorTarget = castGroundPosSnapped;
cursorValid = true;
}
int castAllCount = ((BuildTool)this).controller.cmd.raycast.castAllCount;
RaycastData[] castAll = ((BuildTool)this).controller.cmd.raycast.castAll;
int num = 0;
for (int i = 0; i < castAllCount; i++)
{
if ((int)castAll[i].objType == 0 || (int)castAll[i].objType == 3)
{
num = (((int)castAll[i].objType == 0) ? castAll[i].objId : (-castAll[i].objId));
break;
}
}
if (num != 0)
{
castObjectId = num;
castObjectPos = ((BuildTool)this).GetObjectPose(num).position;
cursorTarget = castObjectPos;
((BuildTool)this).controller.cmd.test = castObjectPos;
castGroundPosSnapped = (castGroundPos = castObjectPos);
castGroundPosSnapped = ((Vector3)(ref castGroundPosSnapped)).normalized * (base.planet.realRadius + 0.2f);
((BuildTool)this).controller.cmd.test = castGroundPosSnapped;
Vector3 normalized2 = ((Vector3)(ref castGroundPosSnapped)).normalized;
if (Physics.Raycast(new Ray(castGroundPosSnapped + normalized2 * 10f, -normalized2), ref val, 20f, 8720, (QueryTriggerInteraction)2))
{
((BuildTool)this).controller.cmd.test = ((RaycastHit)(ref val)).point;
}
cursorTarget = castGroundPosSnapped;
cursorValid = true;
}
}
((BuildTool)this).controller.cmd.state = (cursorValid ? 1 : 0);
((BuildTool)this).controller.cmd.target = (cursorValid ? cursorTarget : Vector3.zero);
}
public void Operating()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
if (waitingForPlayerInput)
{
return;
}
if (!isSelecting && VFInput.blueprintCopyOperate0.onDown && cursorValid)
{
isSelecting = true;
startGroundPosSnapped = castGroundPosSnapped;
lastGroundPosSnapped = startGroundPosSnapped;
InitSelectGratBox();
VFInput.UseMouseLeft();
}
Vector3 val = castGroundPosSnapped - startGroundPosSnapped;
bool flag = ((Vector3)(ref val)).sqrMagnitude > 0.01f;
bool flag2 = VFInput.blueprintCopyOperate0.onDown || VFInput.blueprintCopyOperate1.onDown;
if (isSelecting && ((flag2 && cursorValid) || (VFInput.blueprintCopyOperate0.onUp && castObjectId != 0 && !flag)))
{
CheckDismantle();
if (waitingForPlayerInput)
{
return;
}
ResetBuildPreviews();
isSelecting = false;
VFInput.UseMouseLeft();
VFInput.UseEnterConfirm();
}
else if (isSelecting && VFInput.rtsCancel.onUp)
{
isSelecting = false;
startGroundPosSnapped = castGroundPosSnapped;
lastGroundPosSnapped = startGroundPosSnapped;
ClearSelection();
ResetBuildPreviews();
}
if (isSelecting)
{
DetermineSelectGratBox();
if (lastSelectGratBox != selectGratBox)
{
DetermineAddSelection();
lastSelectGratBox = selectGratBox;
}
}
else
{
startGroundPosSnapped = castGroundPosSnapped;
ReDeterminePreviews();
}
if (flag)
{
ReDeterminePreviews();
}
}
public void CheckDismantle()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_00ba: Expected O, but got Unknown
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Expected O, but got Unknown
//IL_0141: Expected O, but got Unknown
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Expected O, but got Unknown
//IL_01be: Expected O, but got Unknown
foreach (int selectObjId in selectObjIds)
{
PrefabDesc prefabDesc = ((BuildTool)this).GetPrefabDesc(selectObjId);
if (!BuildTool_Dismantle.showDemolishContainerQuery || selectObjId <= 0)
{
continue;
}
EntityData val = base.factory.entityPool[selectObjId];
if (prefabDesc.isStorage)
{
int storageId = val.storageId;
if (!base.factory.factoryStorage.TryTakeBackItems_Storage(((BuildTool)this).player.package, storageId))
{
dismantleQueryBox = UIMessageBox.Show(Localization.Translate("拆除储物仓标题"), Localization.Translate("拆除储物仓文字"), Localization.Translate("否"), Localization.Translate("是"), 0, new Response(DismantleQueryCancel), new Response(DismantleQueryConfirm));
waitingForPlayerInput = true;
return;
}
}
if (prefabDesc.isTank)
{
int tankId = val.tankId;
if (!base.factory.factoryStorage.TryTakeBackItems_Tank(((BuildTool)this).player.package, tankId))
{
dismantleQueryBox = UIMessageBox.Show(Localization.Translate("拆除储液罐标题"), Localization.Translate("拆除储液罐文字"), Localization.Translate("否"), Localization.Translate("是"), 0, new Response(DismantleQueryCancel), new Response(DismantleQueryConfirm));
waitingForPlayerInput = true;
return;
}
}
if (prefabDesc.isStation)
{
int stationId = val.stationId;
if (base.factory.transport.stationPool[stationId] != null)
{
dismantleQueryBox = UIMessageBox.Show(Localization.Translate("拆除物流站标题"), Localization.Translate("拆除物流站文字"), Localization.Translate("否"), Localization.Translate("是"), 0, new Response(DismantleQueryCancel), new Response(DismantleQueryConfirm));
waitingForPlayerInput = true;
return;
}
}
}
DismantleAction();
}
public void DismantleAction()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
RemoveHelper.SwitchDelete(base.factory, selectObjIds.ToList(), edgeObjIds.ToList());
VFAudio.Create("demolish-large", (Transform)null, GameMain.mainPlayer.position, true, 5, -1, -1L);
ClearSelection();
isSelecting = false;
waitingForPlayerInput = false;
}
public void DismantleQueryCancel()
{
ClearSelection();
dismantleQueryBox = null;
waitingForPlayerInput = false;
}
public void DismantleQueryConfirm()
{
DismantleAction();
dismantleQueryBox = null;
}
public void DismantleQueryRemove()
{
if ((Object)(object)dismantleQueryBox != (Object)null)
{
dismantleQueryBox.OnButton1Click();
dismantleQueryBox = null;
}
waitingForPlayerInput = false;
}
private void InitSelectGratBox()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
BlueprintUtils.GetMinimumGratBox(((Vector3)(ref startGroundPosSnapped)).normalized, ref selectGratBox);
selectArcBox = selectGratBox;
if (selectArcBox.y >= 1.5707864f)
{
selectArcBox.y = (selectArcBox.w = (float)Math.PI / 2f);
selectArcBox.z = selectArcBox.x + (float)Math.PI * 200f;
}
else if (selectArcBox.y <= -1.5707864f)
{
selectArcBox.y = (selectArcBox.w = -(float)Math.PI / 2f);
selectArcBox.z = selectArcBox.x + (float)Math.PI * 200f;
}
lastSelectGratBox = selectGratBox;
}
public void DetermineSelectGratBox()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
if (!cursorValid)
{
return;
}
float longitudeRad = BlueprintUtils.GetLongitudeRad(((Vector3)(ref castGroundPosSnapped)).normalized);
float longitudeRad2 = BlueprintUtils.GetLongitudeRad(((Vector3)(ref lastGroundPosSnapped)).normalized);
float latitudeRad = BlueprintUtils.GetLatitudeRad(((Vector3)(ref castGroundPosSnapped)).normalized);
bool flag = latitudeRad >= 1.5707864f || latitudeRad <= -1.5707864f;
float num = (flag ? 0f : (longitudeRad - longitudeRad2));
num = Mathf.Repeat(num + (float)Math.PI, (float)Math.PI * 2f) - (float)Math.PI;
((BPGratBox)(ref selectArcBox)).endLongitudeRad = ((BPGratBox)(ref selectArcBox)).endLongitudeRad + num;
((BPGratBox)(ref selectArcBox)).endLatitudeRad = latitudeRad;
selectGratBox = selectArcBox;
selectGratBox.x = ((selectArcBox.x < selectArcBox.z) ? selectArcBox.x : selectArcBox.z);
selectGratBox.z = ((selectArcBox.x > selectArcBox.z) ? selectArcBox.x : selectArcBox.z);
if (selectArcBox.x < selectArcBox.z)
{
if (selectGratBox.z > selectGratBox.x + (float)Math.PI * 2f - 1E-05f - 4E-06f)
{
selectGratBox.z = selectGratBox.x + (float)Math.PI * 2f - 1E-05f - 4E-06f;
}
selectGratBox.z = Mathf.Repeat(selectGratBox.z + (float)Math.PI, (float)Math.PI * 2f) - (float)Math.PI;
}
else
{
if (selectGratBox.x < selectGratBox.z - (float)Math.PI * 2f + 1E-05f + 4E-06f)
{
selectGratBox.x = selectGratBox.z - (float)Math.PI * 2f + 1E-05f + 4E-06f;
}
selectGratBox.x = Mathf.Repeat(selectGratBox.x + (float)Math.PI, (float)Math.PI * 2f) - (float)Math.PI;
}
selectGratBox.y = ((selectArcBox.y < selectArcBox.w) ? selectArcBox.y : selectArcBox.w);
selectGratBox.w = ((selectArcBox.y > selectArcBox.w) ? selectArcBox.y : selectArcBox.w);
float num2 = BlueprintUtils.GetLongitudeRadPerGrid((Mathf.Abs(castGroundPosSnapped.y) < Mathf.Abs(startGroundPosSnapped.y)) ? ((Vector3)(ref castGroundPosSnapped)).normalized : ((Vector3)(ref startGroundPosSnapped)).normalized, 200) * 0.33f;
((BPGratBox)(ref selectGratBox)).Extend(num2, 0.002f);
if (!flag)
{
lastGroundPosSnapped = castGroundPosSnapped;
}
}
public void DetermineAddSelection()
{
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
int segmentCount = 200;
PlanetData localPlanet = GameMain.localPlanet;
object obj;
if (localPlanet == null)
{
obj = null;
}
else
{
PlanetAuxData aux = localPlanet.aux;
obj = ((aux != null) ? aux.activeGrid : null);
}
if (obj != null)
{
segmentCount = GameMain.localPlanet.aux.activeGrid.segment;
}
selectObjIds.Clear();
edgeObjIds.Clear();
if (Mathf.Abs(selectArcBox.x - selectArcBox.z) < 0.01f && Mathf.Abs(selectArcBox.y - selectArcBox.w) < 0.01f && castObjectId != 0)
{
if (ShouldAddObject(castObjectId))
{
selectObjIds.Add(castObjectId);
}
}
else
{
EntityData[] entityPool = base.factory.entityPool;
int entityCursor = base.factory.entityCursor;
for (int i = 1; i < entityCursor; i++)
{
int num = i;
if (entityPool[i].id == i && ((BPGratBox)(ref selectGratBox)).InGratBox(entityPool[i].pos) && ShouldAddObject(num))
{
selectObjIds.Add(num);
if (selectGratBox.IsOnEdgeOfGratBox(entityPool[i].pos, segmentCount))
{
edgeObjIds.Add(num);
}
}
}
PrebuildData[] prebuildPool = base.factory.prebuildPool;
int prebuildCursor = base.factory.prebuildCursor;
for (int j = 1; j < prebuildCursor; j++)
{
int num2 = -j;
if (prebuildPool[j].id == j && ((BPGratBox)(ref selectGratBox)).InGratBox(prebuildPool[j].pos) && ShouldAddObject(num2))
{
selectObjIds.Add(num2);
if (selectGratBox.IsOnEdgeOfGratBox(prebuildPool[j].pos, segmentCount))
{
edgeObjIds.Add(num2);
}
}
}
}
DetermineChainSelection();
DeterminePreviews();
}
public bool ShouldAddObject(int objId)
{
PrefabDesc prefabDesc = ((BuildTool)this).GetPrefabDesc(objId);
if (prefabDesc.isStation)
{
return !BlueprintTweaksPlugin.excludeStations.Value;
}
if (prefabDesc.isInserter)
{
return ((BuildTool)this).actionBuild.dismantleTool.filterInserter;
}
if (prefabDesc.isBelt)
{
return ((BuildTool)this).actionBuild.dismantleTool.filterBelt;
}
return ((BuildTool)this).actionBuild.dismantleTool.filterFacility;
}
public void DetermineChainSelection()
{
if (!VFInput._chainReaction)
{
return;
}
if (_tmp_int_list == null)
{
_tmp_int_list = new List<int>();
}
_tmp_int_list.Clear();
bool flag = default(bool);
int num2 = default(int);
int num3 = default(int);
foreach (int selectObjId in selectObjIds)
{
int num = ((BuildTool)this).GetPrefabDesc(selectObjId).slotPoses.Length;
if (num <= 0)
{
continue;
}
for (int i = 0; i < num; i++)
{
base.factory.ReadObjectConn(selectObjId, i, ref flag, ref num2, ref num3);
if (num2 != 0)
{
_tmp_int_list.Add(num2);
}
}
}
foreach (int item in _tmp_int_list)
{
if (ShouldAddObject(item))
{
selectObjIds.Add(item);
}
}
_tmp_int_list.Clear();
}
public void ClearSelection()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
selectObjIds.Clear();
edgeObjIds.Clear();
lastSelectGratBox = (selectGratBox = (selectArcBox = BPGratBox.zero));
}
public void ReDeterminePreviews()
{
ResetBuildPreviews();
foreach (int selectObjId in selectObjIds)
{
BuildPreview buildPreview = GetBuildPreview(selectObjId);
AddBPGPUIModel(buildPreview);
}
if (castObjectId != 0)
{
BuildPreview buildPreview2 = GetBuildPreview(castObjectId);
AddBPGPUIModel(buildPreview2);
}
SyncAnimBuffer();
base.planet.factoryModel.bpgpuiManager.animBuffer = animBuffer;
base.planet.factoryModel.bpgpuiManager.SyncAllGPUBuffer();
}
public void DeterminePreviews()
{
HashSet<int> hashSet = new HashSet<int>(selectObjIds);
for (int i = 1; i < bpCursor; i++)
{
BuildPreview val = bpPool[i];
if (val == null || val.bpgpuiModelId <= 0)
{
continue;
}
if (!selectObjIds.Contains(val.objId))
{
if (val.bpgpuiModelInstIndex >= 0)
{
base.planet.factoryModel.bpgpuiManager.RemoveBuildPreviewModel(val.desc.modelIndex, val.bpgpuiModelInstIndex, false);
}
RemoveBuildPreview(i);
}
else
{
hashSet.Remove(val.objId);
}
}
foreach (int item in hashSet)
{
BuildPreview buildPreview = GetBuildPreview(item);
AddBPGPUIModel(buildPreview);
}
if (castObjectId != 0)
{
BuildPreview buildPreview2 = GetBuildPreview(castObjectId);
AddBPGPUIModel(buildPreview2);
}
SyncAnimBuffer();
base.planet.factoryModel.bpgpuiManager.animBuffer = animBuffer;
base.planet.factoryModel.bpgpuiManager.SyncAllGPUBuffer();
}
public override void UpdatePreviewModels(BuildModel model)
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
for (int i = 1; i < bpCursor; i++)
{
BuildPreview val = bpPool[i];
if (val == null || val.bpgpuiModelId <= 0 || !val.isConnNode)
{
continue;
}
if (val.objId > 0)
{
base.factory.cargoTraffic.SetBeltSelected(base.factory.entityPool[val.objId].beltId);
}
else
{
uint beltSpeed = (uint)val.desc.beltSpeed;
if (val.outputObjId == 0 || val.inputObjId == 0 || val.coverbp != null)
{
model.connRenderer.AddBlueprintBeltMajorPoint(val.lpos, val.lrot, beltSpeed);
}
else
{
model.connRenderer.AddBlueprintBeltPoint(val.lpos, val.lrot, beltSpeed);
}
}
model.connRenderer.AddXSign(val.lpos, val.lrot);
}
}
public void AddBPGPUIModel(BuildPreview preview)
{
//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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
if (preview == null || preview.bpgpuiModelId <= 0 || !preview.needModel)
{
return;
}
ModelProto val = ((ProtoSet<ModelProto>)(object)LDB.models).Select(preview.desc.modelIndex);
Color32 copyErrorColor = Configs.builtin.copyErrorColor;
if (val.RendererType == 2)
{
bool flag = default(bool);
bool flag2 = default(bool);
((BuildTool)this).GetInserterT1T2(preview.objId, ref flag, ref flag2);
if (preview.objId > 0)
{
animPool[preview.bpgpuiModelId] = base.factory.entityAnimPool[preview.objId];
}
animPool[preview.bpgpuiModelId].state = (uint)((copyErrorColor.r << 24) + (copyErrorColor.g << 16) + (copyErrorColor.b << 8) + copyErrorColor.a);
base.planet.factoryModel.bpgpuiManager.AddBuildPreviewModel(preview.desc.modelIndex, ref preview.bpgpuiModelInstIndex, preview.bpgpuiModelId, preview.lpos, preview.lrot, preview.lpos2, preview.lrot2, flag ? 1 : 0, flag2 ? 1 : 0, false);
return;
}
if (val.RendererType == 3)
{
bool flag3 = default(bool);
int num = default(int);
int num2 = default(int);
base.factory.ReadObjectConn(preview.objId, 14, ref flag3, ref num, ref num2);
if (preview.objId > 0)
{
animPool[preview.bpgpuiModelId] = base.factory.entityAnimPool[preview.objId];
}
animPool[preview.bpgpuiModelId].state = (uint)((copyErrorColor.r << 24) + (copyErrorColor.g << 16) + (copyErrorColor.b << 8) + copyErrorColor.a);
base.planet.factoryModel.bpgpuiManager.AddBuildPreviewModel(preview.desc.modelIndex, ref preview.bpgpuiModelInstIndex, preview.bpgpuiModelId, preview.lpos, preview.lrot, (num != 0) ? 1u : 0u, false);
return;
}
if (preview.objId > 0)
{
animPool[preview.bpgpuiModelId] = base.factory.entityAnimPool[preview.objId];
}
animPool[preview.bpgpuiModelId].state = (uint)((copyErrorColor.r << 24) + (copyErrorColor.g << 16) + (copyErrorColor.b << 8) + copyErrorColor.a);
if (preview.objId > 0 && preview.desc.isEjector)
{
animPool[preview.bpgpuiModelId].power = base.factory.factorySystem.ejectorPool[base.factory.entityPool[preview.objId].ejectorId].localDir.z;
}
base.planet.factoryModel.bpgpuiManager.AddBuildPreviewModel(preview.desc.modelIndex, ref preview.bpgpuiModelInstIndex, preview.bpgpuiModelId, preview.lpos, preview.lrot, false);
}
public void GeneratePreviewByObjId(BuildPreview preview, int objId)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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_0134: 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_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to inval