public static void PlayerAction_Build_SetCopyInfo_Postfix(ref PlayerAction_Build __instance, int objectId) { if (bpMode) { EndBpMode(true); } BlueprintManager.Reset(); if (objectId < 0) { return; } var itemProto = LDB.items.Select(__instance.factory.entityPool[objectId].protoId); if (itemProto.prefabDesc.insertPoses.Length > 0) { var toAdd = new List <int>() { objectId }; BlueprintManager.CopyEntities(toAdd); if (BlueprintManager.hasData) { BlueprintManager.data.copiedBuildings[0].recipeId = __instance.copyRecipeId; __instance.yaw = 0f; } } }
public static void EndBpMode(bool ignoreBlueprint = false) { if (!bpMode) { return; } bpMode = false; BlueprintManager.CopyEntities(bpSelection.Keys.ToList()); foreach (var selectionGizmo in bpSelection.Values) { selectionGizmo.Close(); } bpSelection.Clear(); if (circleGizmo != null) { circleGizmo.Close(); circleGizmo = null; } if (BlueprintManager.hasData && !ignoreBlueprint) { BlueprintManager.EnterBuildModeAfterBp(); } GC.Collect(); }