public void CraftingTab_Serialize_Deserialize()
        {
            var originalTab = new CustomCraftingTab("Workbench/OriginalTab")
            {
                TabID        = "CustomTab",
                DisplayName  = "Custom Tab",
                SpriteItemID = TechType.ComputerChip
            };

            string serialized = originalTab.ToString();

            Console.WriteLine(originalTab.PrettyPrint());

            var copiedTab = new CustomCraftingTab();

            copiedTab.FromString(serialized);

            Assert.AreEqual(originalTab.TabID, copiedTab.TabID);
            Assert.AreEqual(originalTab.DisplayName, copiedTab.DisplayName);
            Assert.AreEqual(originalTab.FabricatorType, copiedTab.FabricatorType);
            Assert.AreEqual(originalTab.ParentTabPath, copiedTab.ParentTabPath);
            Assert.AreEqual(originalTab.SpriteItemID, copiedTab.SpriteItemID);
            Assert.IsTrue(originalTab.Equals(copiedTab));
            Assert.IsTrue(originalTab == copiedTab);
        }
        public void CraftingTab_CheckPath()
        {
            var originalTab = new CustomCraftingTab("Fabricator/AdvancedMaterials")
            {
                TabID        = "CustomTab",
                DisplayName  = "Custom Tab",
                SpriteItemID = TechType.ComputerChip
            };


            Assert.IsNotNull(originalTab.StepsToTab);
        }
Exemple #3
0
        public void CraftingTab_AtRoot_Deserialize()
        {
            string serialized = @"CustomTab: 
                                (
                                    TabID: CustomTab;
                                    DisplayName: ""Custom Tab"";
                                    SpriteItemID: ComputerChip;
                                    ParentTabPath: Workbench;
                                ); ";

            var tab = new CustomCraftingTab();

            tab.FromString(serialized);

            Assert.AreEqual("CustomTab", tab.TabID);
            Assert.AreEqual("Custom Tab", tab.DisplayName);
            Assert.AreEqual(TechType.ComputerChip, tab.SpriteItemID);
            Assert.AreEqual(CraftTree.Type.Workbench, tab.CraftingPath.Scheme);
            Assert.IsNull(tab.CraftingPath.StepsToParentTab);
        }
        public void CraftingTab_Deserialize()
        {
            string serialized = @"CustomTab: 
                                (
                                    TabID: CustomTab;
                                    DisplayName: ""Custom Tab"";
                                    SpriteItemID: ComputerChip;
                                    ParentTabPath: Workbench/OriginalTab;
                                ); ";

            var tab = new CustomCraftingTab();

            tab.FromString(serialized);

            Assert.AreEqual("CustomTab", tab.TabID);
            Assert.AreEqual("Custom Tab", tab.DisplayName);
            Assert.AreEqual(TechType.ComputerChip, tab.SpriteItemID);
            Assert.AreEqual(CraftTree.Type.Workbench, tab.FabricatorType);
            Assert.AreEqual("Workbench/OriginalTab", tab.ParentTabPath);
            Assert.AreEqual(1, tab.StepsToTab.Length);
            Assert.AreEqual("OriginalTab", tab.StepsToTab[0]);
        }
        public void Generate_All_Files()
        {
            // TABS
            var salvageTab = new CustomCraftingTab
            {
                TabID         = SalvageTabID,
                DisplayName   = "Salvage and Recycling",
                ParentTabPath = PathToSalvageTab,
                SpriteItemID  = TechType.Trashcans
            };

            var tabList = new CustomCraftingTabList
            {
                salvageTab
            };

            WriteFile(tabList, "EquipmentSalvage_Tabs.txt");

            // Move the Metal Salvage into the new tab
            var moveMetalSalvage = new MovedRecipe
            {
                ItemID  = TechType.Titanium.ToString(),
                OldPath = PathHelper.Fabricator.Resources.BasicMaterials.BasicMaterialsTab.GetCraftingPath.ToString(),
                NewPath = tabList[0].FullPath,
                Hidden  = false,
                Copied  = true
            };

            var movedList = new MovedRecipeList
            {
                moveMetalSalvage
            };

            WriteFile(movedList, "EquipmentSalvage_Moves.txt");

            // RECIPES
            var leadSalvage = new AliasRecipe
            {
                ItemID             = "LeadSalvage",
                DisplayName        = "Salvage Lead",
                Tooltip            = "Recover the useful lead from a radiation suit no longer in use",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.BasicMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.Lead,
                Ingredients        =
                {
                    new EmIngredient(TechType.RadiationSuit),
                    new EmIngredient(TechType.RadiationHelmet),
                    new EmIngredient(TechType.RadiationGloves)
                },
                LinkedItemIDs =
                {
                    TechType.Lead.ToString(),
                    TechType.Lead.ToString()
                },
                UnlockedBy = { TechType.RadiationSuit.ToString() }
            };

            var copperSalvage = new AliasRecipe
            {
                ItemID             = "CopperSalvage",
                DisplayName        = "Salvage Copper",
                Tooltip            = "Recover the precious copper from unneeded power cells",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.BasicMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.Copper,
                Ingredients        =
                {
                    new EmIngredient(TechType.PowerCell)
                },
                LinkedItemIDs =
                {
                    TechType.Copper.ToString(),
                    TechType.Copper.ToString()
                },
                UnlockedBy = { TechType.PowerCell.ToString() }
            };

            var deepSalvage = new AliasRecipe
            {
                ItemID             = "DeepSalvage",
                DisplayName        = "Salvage Precious Metals",
                Tooltip            = "Recover the lithium and magnetite from unneeded deep power cells",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.AdvancedMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.Magnetite,
                Ingredients        =
                {
                    new EmIngredient("DeepPowerCell")
                },
                LinkedItemIDs =
                {
                    TechType.Lithium.ToString(),
                    TechType.Magnetite.ToString(),
                    TechType.Lithium.ToString(),
                    TechType.Magnetite.ToString()
                },
                UnlockedBy = { "DeepPowerCell" }
            };

            var ionSalvage = new AliasRecipe
            {
                ItemID             = "IonCubeSalvage",
                DisplayName        = "Salvage Ion Cubes",
                Tooltip            = "Recover the precious ion cubes from unneeded ion power cells",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.AdvancedMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.PrecursorIonCrystal,
                Ingredients        =
                {
                    new EmIngredient(TechType.PrecursorIonPowerCell)
                },
                LinkedItemIDs =
                {
                    TechType.PrecursorIonCrystal.ToString(),
                    TechType.PrecursorIonCrystal.ToString()
                },
                UnlockedBy = { TechType.PrecursorIonPowerCell.ToString() }
            };

            var diamondSalvage = new AliasRecipe
            {
                ItemID             = "DiamondSalvage",
                DisplayName        = "Salvage Diamonds",
                Tooltip            = "Recover diamonds from retired laser cutters. Don't forget to remove the batteries first.",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.AdvancedMaterials,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.Diamond,
                Ingredients        =
                {
                    new EmIngredient(TechType.LaserCutter)
                },
                LinkedItemIDs =
                {
                    TechType.Diamond.ToString(),
                    TechType.Diamond.ToString()
                },
                UnlockedBy = { TechType.Diamond.ToString() }
            };

            var wireSalvage = new AliasRecipe
            {
                ItemID             = "WireSalvage",
                DisplayName        = "Salvage Copper Wire",
                Tooltip            = "Recover copper wire from retired seaglide. Don't forget to remove the batteries first.",
                Path               = tabList[0].FullPath,
                ForceUnlockAtStart = !EnableUnlocking,
                PdaCategory        = TechCategory.Electronics,
                PdaGroup           = TechGroup.Resources,
                SpriteItemID       = TechType.CopperWire,
                Ingredients        =
                {
                    new EmIngredient(TechType.Seaglide)
                },
                LinkedItemIDs =
                {
                    TechType.CopperWire.ToString(),
                },
                UnlockedBy = { TechType.Seaglide.ToString() }
            };

            var aliasList = new AliasRecipeList
            {
                leadSalvage, copperSalvage, deepSalvage, ionSalvage, diamondSalvage, wireSalvage
            };

            WriteFile(aliasList, "EquipmentSalvage_Recipes.txt");
        }