public static void AllowToTryAgain(BuildTool_BlueprintPaste __instance) { if (!__instance.buildCondition && VFInput.blueprintPasteOperate0.onDown) { __instance.OperatingPrestage(); } }
public static void ApplyColors(BuildTool_BlueprintPaste tool, Color[] colors) { PlatformSystem system = tool.factory.platformSystem; Array.Copy(colors, system.reformCustomColors, 16); system.RefreshColorsTexture(); }
private static void MatchInserterEntityOnly(BuildTool_BlueprintPaste tool, BuildPreview bp) { IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions) { CodeMatcher matcher = new CodeMatcher(instructions) .MatchForward(true, new CodeMatch(OpCodes.Ldloca_S), new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(ColliderData), nameof(ColliderData.objType))) ) .MatchForward(false, new CodeMatch(OpCodes.Ldloca_S), new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(ColliderData), nameof(ColliderData.objType))) ); matcher.Opcode = OpCodes.Nop; matcher.Operand = null; matcher.Advance(1) .SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop)) .SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop)) .SetOpcodeAndAdvance(OpCodes.Br); return(matcher.InstructionEnumeration()); } // make compiler happy _ = Transpiler(null); }
private static void CheckInserter(BuildTool_BlueprintPaste tool, BuildPreview preview) { if (preview.input != null && preview.input.desc.isBelt) { if (preview.input.IsCollide()) { preview.input = null; MatchInserterEntityOnly(tool, preview); } else if (preview.input.coverObjId != 0) { preview.inputObjId = preview.input.coverObjId; preview.input = null; } } if (preview.output != null && preview.output.desc.isBelt) { if (preview.output.IsCollide()) { preview.output = null; MatchInserterEntityOnly(tool, preview); } else if (preview.output.coverObjId != 0) { preview.inputObjId = preview.output.coverObjId; preview.output = null; } } }
public static void OnPaste(BuildTool_BlueprintPaste __instance) { if (UndoManager.IgnoreAllEvents.Value) { return; } if (NebulaModAPI.IsMultiplayerActive) { if (NebulaModAPI.MultiplayerSession.LocalPlayer.IsClient) { return; } } List <int> objectIds = new List <int>(__instance.bpCursor); for (int l = 0; l < __instance.bpCursor; l++) { BuildPreview preview = __instance.bpPool[l]; objectIds.Add(preview.objId); } Vector3[] dots = new Vector3[__instance.dotsCursor]; Array.Copy(__instance.dotsSnapped, dots, __instance.dotsCursor); PlayerUndo data = UndoManager.GetCurrentPlayerData(); UndoBlueprint undo = new UndoBlueprint(data, objectIds, __instance.blueprint, dots, __instance.yaw); data.AddUndoItem(undo); }
public static bool CreatePrebuilds_Prefix(BuildTool __instance) { if (!SimulatedWorld.Initialized) { return(true); } List <BuildPreview> previews = __instance.buildPreviews; if (__instance is BuildTool_BlueprintPaste) { BuildTool_BlueprintPaste bpInstance = __instance as BuildTool_BlueprintPaste; previews = bpInstance.bpPool.Take(bpInstance.bpCursor).ToList(); } // Host will just broadcast event to other players if (LocalPlayer.IsMasterClient) { int planetId = FactoryManager.EventFactory?.planetId ?? GameMain.localPlanet?.id ?? -1; LocalPlayer.SendPacketToStar(new CreatePrebuildsRequest(planetId, previews, FactoryManager.PacketAuthor == FactoryManager.AUTHOR_NONE ? LocalPlayer.PlayerId : FactoryManager.PacketAuthor, __instance.GetType().ToString()), GameMain.galaxy.PlanetById(planetId).star.id); } //If client builds, he need to first send request to the host and wait for reply if (!LocalPlayer.IsMasterClient && !FactoryManager.IsIncomingRequest) { LocalPlayer.SendPacket(new CreatePrebuildsRequest(GameMain.localPlanet?.id ?? -1, previews, FactoryManager.PacketAuthor == FactoryManager.AUTHOR_NONE ? LocalPlayer.PlayerId : FactoryManager.PacketAuthor, __instance.GetType().ToString())); return(false); } return(true); }
public static void DeterminePrestage(BuildTool_BlueprintPaste __instance, bool _forceRefreshBP = false) { int reformsLength = __instance.blueprint.reforms.Length; int totalNeeded = (__instance.blueprint.areas.Length > 1) ? reformsLength : (reformsLength * __instance.dotsCursor); if (__instance.bpPool == null || reformPreviews.Count != totalNeeded || __instance.drag_box_size_changed || _forceRefreshBP) { InitPreviews(__instance.blueprint, __instance.dotsCursor); } }
public override void ProcessPacket(ReformPasteEventPacket packet, INebulaConnection conn) { PlanetData planet = GameMain.galaxy.PlanetById(packet.PlanetId); if (planet.factory == null) { return; } PlayerAction_Build pab = GameMain.mainPlayer.controller != null ? GameMain.mainPlayer.controller.actionBuild : null; BuildTool_BlueprintPaste buildTool = pab.blueprintPasteTool; IFactoryManager factoryManager = NebulaModAPI.MultiplayerSession.Factories; if (buildTool == null) { return; } factoryManager.TargetPlanet = packet.PlanetId; factoryManager.PacketAuthor = packet.AuthorId; PlanetFactory tmpFactory = null; bool loadExternalPlanetData = GameMain.localPlanet?.id != planet.id; if (loadExternalPlanetData) { tmpFactory = buildTool.factory; factoryManager.AddPlanetTimer(packet.PlanetId); } factoryManager.EventFactory = planet.factory; buildTool.factory = planet.factory; pab.factory = planet.factory; using (factoryManager.IsIncomingRequest.On()) { packet.GetData(out List <ReformData> reforms, out Color[] colors); BlueprintPasteExtension.CalculatePositions(buildTool, reforms, colors); } if (loadExternalPlanetData) { buildTool.factory = tmpFactory; pab.factory = tmpFactory; } GameMain.mainPlayer.mecha.buildArea = Configs.freeMode.mechaBuildArea; factoryManager.EventFactory = null; factoryManager.TargetPlanet = NebulaModAPI.PLANET_NONE; factoryManager.PacketAuthor = NebulaModAPI.AUTHOR_NONE; }
public static void CheckAfter(BuildTool_BlueprintPaste __instance, ref bool __result, ref bool __state) { if (__result) { return; } if (!BlueprintCopyExtension.isEnabled || !__state) { return; } if (!__instance.cannotBuild || reformPreviews.Count <= 0) { return; } if (NebulaModAPI.IsMultiplayerActive && NebulaModAPI.MultiplayerSession.Factories.IsIncomingRequest.Value) { return; } BPGratBox box = ReformBPUtils.GetBoundingRange(__instance.planet, __instance.actionBuild.planetAux, new int[0], 0, reformPreviews, reformPreviews[0].longitude); bool allOk = true; for (int i = 0; i < __instance.bpCursor; i++) { BuildPreview preview = __instance.bpPool[i]; if (preview.condition == EBuildCondition.NeedGround) { Vector3 pos = (preview.lpos + preview.lpos2) * 0.5f; if (box.InGratBox(pos)) { preview.condition = EBuildCondition.Ok; } } if (preview.condition != EBuildCondition.Ok && preview.condition != EBuildCondition.NotEnoughItem) { allOk = false; } } if (allOk) { __result = true; } }
public static bool CreatePrebuilds_Prefix(BuildTool __instance) { if (!Multiplayer.IsActive) { return(true); } List <BuildPreview> previews = __instance.buildPreviews; if (__instance is BuildTool_BlueprintPaste) { BuildTool_BlueprintPaste bpInstance = __instance as BuildTool_BlueprintPaste; previews = bpInstance.bpPool.Take(bpInstance.bpCursor).ToList(); } if (__instance is BuildTool_PathAddon) { // traffic monitors & sprayers cannot be drag build atm, so its always only one. previews = new List <BuildPreview>(); previews.Add(((BuildTool_PathAddon)__instance).handbp); } // Host will just broadcast event to other players if (Multiplayer.Session.LocalPlayer.IsHost) { int planetId = Multiplayer.Session.Factories.EventFactory?.planetId ?? GameMain.localPlanet?.id ?? -1; int authorId = Multiplayer.Session.Factories.PacketAuthor == NebulaModAPI.AUTHOR_NONE ? Multiplayer.Session.LocalPlayer.Id : Multiplayer.Session.Factories.PacketAuthor; int prebuildId = Multiplayer.Session.Factories.GetNextPrebuildId(planetId); Multiplayer.Session.Network.SendPacketToStar(new CreatePrebuildsRequest(planetId, previews, authorId, __instance.GetType().ToString(), prebuildId), GameMain.galaxy.PlanetById(planetId).star.id); } //If client builds, he need to first send request to the host and wait for reply if (!Multiplayer.Session.LocalPlayer.IsHost && !Multiplayer.Session.Factories.IsIncomingRequest.Value) { if (Multiplayer.Session.BuildTools.InitialCheck(previews[0].lpos)) { int authorId = Multiplayer.Session.Factories.PacketAuthor == NebulaModAPI.AUTHOR_NONE ? Multiplayer.Session.LocalPlayer.Id : Multiplayer.Session.Factories.PacketAuthor; Multiplayer.Session.Network.SendPacket(new CreatePrebuildsRequest(GameMain.localPlanet?.id ?? -1, previews, authorId, __instance.GetType().ToString(), -1)); } return(false); } return(true); }
public static void PasteReformsPrefix(BuildTool_BlueprintPaste __instance, ref bool __state) { __state = false; if (!BlueprintCopyExtension.isEnabled) { return; } if (NebulaModAPI.IsMultiplayerActive && NebulaModAPI.MultiplayerSession.Factories.IsIncomingRequest.Value) { return; } Color[] colors = null; if (BlueprintCopyExtension.copyColors && __instance.blueprint.customColors != null && __instance.blueprint.customColors.Length > 0) { colors = __instance.blueprint.customColors; } __state = CalculatePositions(__instance, reformPreviews, colors); }
public static bool CheckItems(BuildTool_BlueprintPaste tool, int cost, int reformCount) { if (BlueprintTweaksPlugin.freeFoundationsIsInstalled) { return(true); } if (tool.player.package.GetItemCount(PlatformSystem.REFORM_ID) < reformCount) { return(false); } int result = tool.player.sandCount - cost; if (result <= 0) { return(false); } tool.player.package.TakeItem(PlatformSystem.REFORM_ID, reformCount, out int _); tool.player.SetSandCount(result); return(true); }
public static void CreatePrebuildsRequest(CreatePrebuildsRequest packet) { PlanetData planet = GameMain.galaxy.PlanetById(packet.PlanetId); if (planet.factory == null) { if (FactoryManager.EventFromServer) { // We only execute the code if the client has loaded the factory at least once. // Else it will get it once it goes to the planet for the first time. return; } Log.Warn($"planet.factory was null create new one"); planet.factory = GameMain.data.GetOrCreateFactory(planet); } PlayerAction_Build pab = GameMain.mainPlayer.controller != null ? GameMain.mainPlayer.controller.actionBuild : null; BuildTool[] buildTools = pab.tools; BuildTool buildTool = null; for (int i = 0; i < buildTools.Length; i++) { if (buildTools[i].GetType().ToString() == packet.BuildToolType) { buildTool = buildTools[i]; break; } } if (pab != null && buildTool != null) { FactoryManager.TargetPlanet = packet.PlanetId; FactoryManager.PacketAuthor = packet.AuthorId; PlanetFactory tmpFactory = null; NearColliderLogic tmpNearcdLogic = null; PlanetPhysics tmpPlanetPhysics = null; bool loadExternalPlanetData = GameMain.localPlanet?.id != planet.id; if (loadExternalPlanetData) { //Make backup of values that are overwritten tmpFactory = buildTool.factory; tmpNearcdLogic = buildTool.actionBuild.nearcdLogic; tmpPlanetPhysics = buildTool.actionBuild.planetPhysics; FactoryManager.AddPlanetTimer(packet.PlanetId); } bool incomingBlueprintEvent = packet.BuildToolType == typeof(BuildTool_BlueprintPaste).ToString(); //Create Prebuilds from incoming packet and prepare new position List <BuildPreview> tmpList = new List <BuildPreview>(); if (!incomingBlueprintEvent) { tmpList.AddRange(buildTool.buildPreviews); buildTool.buildPreviews.Clear(); buildTool.buildPreviews.AddRange(packet.GetBuildPreviews()); } FactoryManager.EventFactory = planet.factory; //Set temporary Local Planet / Factory data that are needed for original methods CheckBuildConditions() and CreatePrebuilds() buildTool.factory = planet.factory; pab.factory = planet.factory; pab.noneTool.factory = planet.factory; if (FactoryManager.EventFromClient) { // Only the server needs to set these pab.planetPhysics = planet.physics; pab.nearcdLogic = planet.physics.nearColliderLogic; } //Check if prebuilds can be build (collision check, height check, etc) bool canBuild = false; if (FactoryManager.EventFromClient) { GameMain.mainPlayer.mecha.buildArea = float.MaxValue; canBuild = CheckBuildingConnections(buildTool.buildPreviews, planet.factory.entityPool, planet.factory.prebuildPool); } if (canBuild || FactoryManager.EventFromServer) { if (FactoryManager.EventFromClient) { CheckAndFixConnections(buildTool, planet); } if (packet.BuildToolType == typeof(BuildTool_Click).ToString()) { ((BuildTool_Click)buildTool).CreatePrebuilds(); } else if (packet.BuildToolType == typeof(BuildTool_Path).ToString()) { ((BuildTool_Path)buildTool).CreatePrebuilds(); } else if (packet.BuildToolType == typeof(BuildTool_Inserter).ToString()) { ((BuildTool_Inserter)buildTool).CreatePrebuilds(); } else if (incomingBlueprintEvent) { BuildTool_BlueprintPaste bpTool = buildTool as BuildTool_BlueprintPaste; // Cache the current data before performing the requested CreatePrebuilds(); int previousCursor = bpTool.bpCursor; BuildPreview[] previousPool = bpTool.bpPool; // Perform the requested CreatePrebuilds(); List <BuildPreview> incomingPreviews = packet.GetBuildPreviews(); bpTool.bpCursor = incomingPreviews.Count; bpTool.bpPool = incomingPreviews.ToArray(); bpTool.CreatePrebuilds(); // Revert to previous data bpTool.bpCursor = previousCursor; bpTool.bpPool = previousPool; } } //Revert changes back to the original planet if (loadExternalPlanetData) { buildTool.factory = tmpFactory; pab.factory = tmpFactory; pab.noneTool.factory = tmpFactory; pab.planetPhysics = tmpPlanetPhysics; pab.nearcdLogic = tmpNearcdLogic; } GameMain.mainPlayer.mecha.buildArea = Configs.freeMode.mechaBuildArea; FactoryManager.EventFactory = null; if (!incomingBlueprintEvent) { buildTool.buildPreviews.Clear(); buildTool.buildPreviews.AddRange(tmpList); } FactoryManager.TargetPlanet = FactoryManager.PLANET_NONE; FactoryManager.PacketAuthor = -1; } }
public override bool Redo(PlanetFactory factory, PlayerAction_Build actionBuild) { if (blueprint == null) { return(false); } if (dotsSnapped == null || dotsSnapped.Length == 0) { return(false); } BuildTool_BlueprintPaste paste = actionBuild.blueprintPasteTool; paste._OnOpen(); paste.InitTool(); paste.yaw = yaw; Array.Clear(paste.dotsSnapped, 0, paste.dotsSnapped.Length); for (int i = 0; i < dotsSnapped.Length; i++) { paste.dotsSnapped[i] = dotsSnapped[i]; } paste.dotsCursor = dotsSnapped.Length; paste.blueprint = blueprint; paste.cursorValid = true; paste.GenerateBlueprintGratBoxes(); paste.DeterminePreviewsPrestage(true); bool success = false; using (UndoManager.IgnoreAllEvents.On()) { bool condition = paste.CheckBuildConditionsPrestage(); if (condition) { paste.ActiveColliders(actionBuild.model); paste.buildCondition = paste.CheckBuildConditions(); paste.DeactiveColliders(actionBuild.model); if (paste.buildCondition) { paste.CreatePrebuilds(); success = true; } } } objectIds.Clear(); for (int l = 0; l < paste.bpCursor; l++) { BuildPreview preview = paste.bpPool[l]; objectIds.Add(preview.objId); } if (objectIds.Count > 0) { if (!undoData.notifyBuildListeners.Contains(this)) { undoData.notifyBuildListeners.Add(this); } if (!undoData.notifyDismantleListeners.Contains(this)) { undoData.notifyDismantleListeners.Add(this); } } paste.ResetStates(); return(success); }
public static void OnUpdate(BuildTool_BlueprintPaste __instance) { if (!BlueprintCopyExtension.isEnabled) { return; } if (reformPreviews.Count <= 0) { return; } if (__instance.cannotBuild) { return; } tickCounter++; if (tickCounter >= 30) { tickCounter = 0; Vector3 center = Vector3.zero; tmpPoints.Clear(); PlatformSystem platformSystem = __instance.factory.platformSystem; foreach (ReformData preview in reformPreviews) { ReformBPUtils.GetSegmentCount(preview.latitude, preview.longitude, out float latCount, out float longCount, out int segmentCount); longCount = Mathf.Repeat(longCount, segmentCount); int reformIndex = platformSystem.GetReformIndexForSegment(latCount, longCount); if (reformIndex < 0) { continue; } int type = platformSystem.GetReformType(reformIndex); if (platformSystem.IsTerrainReformed(type)) { continue; } Vector3 pos = BlueprintUtils.GetDir(preview.longitude, preview.latitude); pos *= GameMain.localPlanet.realRadius + 0.2f; tmpPoints.Add(pos); center += pos; } lastCost = ReformBPUtils.ComputeFlattenTerrainReform(__instance.factory, tmpPoints, center); } string message = ""; int playerFoundationCount = __instance.player.package.GetItemCount(PlatformSystem.REFORM_ID); if (playerFoundationCount < tmpPoints.Count) { message = Format("NotEnoughFoundationsMessage".Translate(), tmpPoints.Count - playerFoundationCount) + "\n"; } else { message = Format("FoundCountMessage".Translate(), tmpPoints.Count) + "\n"; } if (__instance.cursorValid && !VFInput.onGUIOperate) { if (lastCost > 0) { __instance.actionBuild.model.cursorText = $"{message}{"沙土消耗".Translate()} {lastCost} {"个沙土".Translate()}"; } else if (lastCost == 0) { __instance.actionBuild.model.cursorText = $"{message}"; } else { int num2 = -lastCost; __instance.actionBuild.model.cursorText = $"{message}{"沙土获得".Translate()} {num2} {"个沙土".Translate()}"; } } }
private static void CheckBelts(BuildTool_BlueprintPaste tool, BuildPreview preview) { if (preview.IsCollide()) { if (preview.output == null) { return; } if (!preview.output.IsCollide()) { return; } int overlapCount = Physics.OverlapSphereNonAlloc(preview.lpos, 0.28f, BuildTool._tmp_cols, 425984, QueryTriggerInteraction.Collide); PlanetPhysics physics = tool.player.planetData.physics; for (int m = 0; m < overlapCount; m++) { bool found = physics.GetColliderData(BuildTool._tmp_cols[m], out ColliderData collider); int objectId = 0; if (found && collider.isForBuild) { if (collider.objType == EObjectType.Entity) { objectId = collider.objId; } } if (objectId == 0) { continue; } ItemProto itemProto = tool.GetItemProto(objectId); if (!itemProto.prefabDesc.isBelt) { continue; } tool.factory.ReadObjectConn(objectId, 0, out bool _, out int otherObjId, out int _); //0 next //1 prev tool.factory.ReadObjectConn(objectId, 1, out bool _, out otherObjId, out int _); if (preview.output.IsCollide()) { if (otherObjId == 0) { preview.coverObjId = objectId; preview.willRemoveCover = false; preview.output.bpgpuiModelId = 0; preview.output = null; preview.condition = EBuildCondition.Ok; BlueprintTweaksPlugin.logger.LogInfo("Setting belt condition to OK"); break; } } } } }
public static void ResetBuildPreviews(BuildTool_BlueprintPaste __instance) { reformPreviews.Clear(); }
public static bool CalculatePositions(BuildTool_BlueprintPaste tool, List <ReformData> reforms, Color[] colors) { ReformBPUtils.currentGrid = tool.factory.planet.aux.mainGrid; PlanetData planet = tool.factory.planet; PlatformSystem platformSystem = tool.factory.platformSystem; Vector3 center = Vector3.zero; tmpPoints.Clear(); foreach (ReformData preview in reforms) { ReformBPUtils.GetSegmentCount(preview.latitude, preview.longitude, out float latCount, out float longCount, out int segmentCount); longCount = Mathf.Repeat(longCount, segmentCount); int reformIndex = platformSystem.GetReformIndexForSegment(latCount, longCount); if (reformIndex < 0) { continue; } int type = platformSystem.GetReformType(reformIndex); if (platformSystem.IsTerrainReformed(type)) { continue; } Vector3 pos = BlueprintUtils.GetDir(preview.longitude, preview.latitude); pos *= planet.realRadius + 0.2f; tmpPoints.Add(pos); center += pos; } int cost = ReformBPUtils.ComputeFlattenTerrainReform(tool.factory, tmpPoints, center); if (NebulaModAPI.IsMultiplayerActive) { IMultiplayerSession session = NebulaModAPI.MultiplayerSession; if (!session.Factories.IsIncomingRequest.Value && !CheckItems(tool, cost, tmpPoints.Count)) { return(false); } if (session.LocalPlayer.IsHost) { int planetId = session.Factories.EventFactory?.planetId ?? GameMain.localPlanet?.id ?? -1; session.Network.SendPacketToStar(new ReformPasteEventPacket(planetId, reforms, colors, session.Factories.PacketAuthor == NebulaModAPI.AUTHOR_NONE ? session.LocalPlayer.Id : session.Factories.PacketAuthor), GameMain.galaxy.PlanetById(planetId).star.id); } //If client builds, he need to first send request to the host and wait for reply if (!session.LocalPlayer.IsHost && !session.Factories.IsIncomingRequest.Value) { session.Network.SendPacket(new ReformPasteEventPacket(GameMain.localPlanet?.id ?? -1, reforms, colors, session.Factories.PacketAuthor == NebulaModAPI.AUTHOR_NONE ? session.LocalPlayer.Id : session.Factories.PacketAuthor)); return(true); } } else { if (!CheckItems(tool, cost, tmpPoints.Count)) { return(false); } } if (colors != null && colors.Length > 0) { ApplyColors(tool, colors); } ReformBPUtils.FlattenTerrainReform(tool.factory, tmpPoints, center); VFAudio.Create("reform-terrain", null, center, true, 4); foreach (ReformData preview in reforms) { ReformBPUtils.GetSegmentCount(preview.latitude, preview.longitude, out float latCount, out float longCount, out int segmentCount); longCount = Mathf.Repeat(longCount, segmentCount); int reformIndex = platformSystem.GetReformIndexForSegment(latCount, longCount); if (reformIndex < 0) { continue; } int reformType = platformSystem.GetReformType(reformIndex); int reformColor = platformSystem.GetReformColor(reformIndex); if (reformType == preview.type && reformColor == preview.color) { continue; } platformSystem.SetReformType(reformIndex, preview.type); platformSystem.SetReformColor(reformIndex, preview.color); } return(true); }
public static void DontStopOnFail(BuildTool_BlueprintPaste __instance, ref bool __result) { tmpPosBpidx.Clear(); for (int i = 0; i < __instance.bpCursor; i++) { BuildPreview preview = __instance.bpPool[i]; if (!preview.desc.isPowerNode) { continue; } if (preview.condition != EBuildCondition.PowerTooClose && preview.condition != EBuildCondition.BlueprintBPOverlap) { continue; } Vector3 pos = (preview.lpos + preview.lpos2) * 0.5f; long key = ((long)Mathf.FloorToInt(pos.x * 100f) << 42) + ((long)Mathf.FloorToInt(pos.y * 100f) << 21) + Mathf.FloorToInt(pos.z * 100f); if (tmpPosBpidx.ContainsKey(key)) { BuildPreview preview2 = __instance.bpPool[tmpPosBpidx[key]]; if (!preview2.desc.isPowerNode) { continue; } if (preview2.condition != EBuildCondition.PowerTooClose && preview2.condition != EBuildCondition.BlueprintBPOverlap) { continue; } float num = Quaternion.Angle(preview.lrot, preview2.lrot); float num2 = Quaternion.Angle(preview.lrot2, preview2.lrot2); if (preview.desc == preview2.desc && num < 0.5f && num2 < 0.5f) { preview.coverbp = preview2; preview.condition = EBuildCondition.Ok; preview2.bpgpuiModelId = -1; preview2.condition = EBuildCondition.BlueprintBPOverlap; tmpPosBpidx[key] = i; } } else { tmpPosBpidx.Add(key, i); } } if (!isEnabled) { return; } for (int i = 0; i < __instance.bpCursor; i++) { BuildPreview preview = __instance.bpPool[i]; if (preview.desc.isBelt) { CheckBelts(__instance, preview); } else if (preview.desc.isInserter) { CheckInserter(__instance, preview); } } __result = true; __instance.actionBuild.model.cursorState = 0; }