public static bool CheckBpForGasGiants(PlayerController __instance, BlueprintData blueprint)
        {
            if (GameMain.history.blueprintLimit == 0)
            {
                return(false);
            }
            if (blueprint == null)
            {
                blueprint = __instance.actionBuild.blueprintClipboard;
            }
            if (BlueprintData.IsNullOrEmpty(blueprint))
            {
                return(false);
            }

            if (__instance.gameData.localPlanet?.gasItems == null || __instance.gameData.localPlanet.gasItems.Length == 0)
            {
                return(true);
            }

            foreach (BlueprintBuilding building in blueprint.buildings)
            {
                ItemProto item = LDB.items.Select(building.itemId);
                if (!item.BuildInGas)
                {
                    UIRealtimeTip.Popup("CantPasteThisInGasGiantWarn".Translate());
                    return(false);
                }
            }

            return(true);
        }
示例#2
0
        public static void OnPasteButtonClicked()
        {
            if (lastClickedFile == null)
            {
                return;
            }

            if (lastClickedFile.isDirectory)
            {
                if (!Directory.Exists(lastClickedFile.fullPath))
                {
                    return;
                }

                lastClickedFile.browser.SetCurrentDirectory(lastClickedFile.fullPath);
                return;
            }

            if (!VFInput.readyToBuild)
            {
                return;
            }
            BlueprintData blueprint = BlueprintData.CreateFromFile(lastClickedFile.fullPath);

            if (BlueprintData.IsNullOrEmpty(blueprint))
            {
                return;
            }

            GameMain.mainPlayer.controller.OpenBlueprintPasteMode(blueprint, lastClickedFile.fullPath);
            lastClickedFile.browser._Close();
        }