Ejemplo n.º 1
0
        public virtual void Patch()
        {
            Atlas.Sprite sprite;

            if (NameUsingForFiles != null)
            {
                sprite = ImageUtils.LoadSpriteFromFile($"./QMods/{NameUsingForFiles}/Assets/{NameUsingForFiles}.png");
            }
            else
            {
                sprite = GetResourceIcon(PrefabTemplate);
            }
            Console.WriteLine("NameID: " + NameID + ", FriendlyName: " + FriendlyName + ", Description: " + Description);
            TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, sprite, false);
            SpriteHandler.RegisterSprite(TechType, sprite);
            CraftDataHandler.SetTechData(TechType, GetRecipe());
            CraftTreeHandler.AddCraftingNode(FabricatorType, TechType, FabricatorTab);
            CraftDataHandler.AddBuildable(TechType);
            CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, TechType);
            CraftDataHandler.SetEquipmentType(TechType, TypeForEquipment);
            CraftDataHandler.SetQuickSlotType(TechType, TypeForQuickslot);
            CraftDataHandler.SetItemSize(TechType, ItemSize);

            KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] {
                TechType
            }, $"{FriendlyName} blueprint discovered!");

            PrefabHandler.RegisterPrefab(this);
        }
Ejemplo n.º 2
0
        public void RegisterFloraFabricator(List <IDecorationItem> decorationItems)
        {
            if (this.IsRegistered == false)
            {
                // Create new Craft Tree Type
                CreateCustomTree(out CraftTree.Type craftType, decorationItems);
                this.TreeTypeID = craftType;

                // Add the new TechType to the buildables
                CraftDataHandler.AddBuildable(this.TechType);

                // Add the new TechType to the group of Interior Module buildables
                CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType, TechType.Fabricator);

                // Register handover text
                LanguageHandler.SetLanguageLine(HandOverText, LanguageHelper.GetFriendlyWord(HandOverText));

                // Unlock at start
                KnownTechHandler.UnlockOnStart(this.TechType);

                // Set the buildable prefab
                PrefabHandler.RegisterPrefab(this);

                // Register sprite
                SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset <Sprite>("fabricator_icon_green"));

                // Load texture
                this.ColoredTexture = AssetsHelper.Assets.LoadAsset <Texture2D>("submarine_fabricator_green");

                // Associate the recipie to the new TechType
                CraftDataHandler.SetTechData(this.TechType, this.Recipe);

                this.IsRegistered = true;
            }
        }
        public void Patch(bool auxConsolesEnabled)
        {
            this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, false);

            if (!auxConsolesEnabled) // Even if the options have this be disabled,
            {
                return;              // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched
            }
            LanguageHandler.SetLanguageLine(HandOverText, "Access Auxiliary Cyclops Upgrade Console");
            CraftDataHandler.AddBuildable(this.TechType);
            CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType);

            PrefabHandler.RegisterPrefab(this);

            var recipe = new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[3]
                {
                    new Ingredient(TechType.AdvancedWiringKit, 1),
                    new Ingredient(TechType.Titanium, 2),
                    new Ingredient(TechType.Lead, 1),
                })
            };

            CraftDataHandler.SetTechData(this.TechType, recipe);
            SpriteHandler.RegisterSprite(this.TechType, @"./QMods/MoreCyclopsUpgrades/Assets/AuxCyUpgradeConsole.png");
            KnownTechHandler.SetAnalysisTechEntry(TechType.CyclopsHullModule1, new TechType[1] {
                this.TechType
            }, $"{FriendlyName} blueprint discovered!");
        }
Ejemplo n.º 4
0
        public BuildableHelper(string id, string displayname, string tooltip, TechGroup group, TechCategory category, TechType after = TechType.None, bool unlockonstart = true, Atlas.Sprite atlasSprite = null, Sprite unitySprite = null)
        {
            if (atlasSprite != null && unitySprite != null)
            {
                throw new ArgumentException("Neither atlasSprite nor unitySprite are null!");
            }

            if (atlasSprite != null)
            {
                techType = TechTypeHandler.AddTechType(id, displayname, tooltip, atlasSprite, unlockonstart);
            }
            else if (unitySprite != null)
            {
                techType = TechTypeHandler.AddTechType(id, displayname, tooltip, unitySprite, unlockonstart);
            }
            else
            {
                techType = TechTypeHandler.AddTechType(id, displayname, tooltip, unlockonstart);
            }

            CraftDataHandler.AddBuildable(techType);
            if (after == TechType.None)
            {
                CraftDataHandler.AddToGroup(group, category, techType);
            }
            else
            {
                CraftDataHandler.AddToGroup(group, category, techType, after);
            }
        }
        public ExteriorPlantPotPrefab(string plantPotId, string displayName, string tooltip, string basePotPath, TechType basePotTechType) : base(plantPotId, $"Submarine/Build/{plantPotId}")
        {
            this.basePlantPotPath = basePotPath;

            // Register the TechType
            TechType = TechTypeHandler.AddTechType(plantPotId, displayName, tooltip, false);

            // Register the Sprite(icon) of the new TechType with the icon of the base plant pot.
            SpriteHandler.RegisterSprite(TechType, SpriteManager.Get(basePotTechType));

            // Set the recipe of the TechType.
            CraftDataHandler.SetTechData(TechType, new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>()
                {
                    new Ingredient(TechType.Titanium, 2)
                }
            });

            // Add it as a buildable.
            CraftDataHandler.AddBuildable(TechType);

            // Add it to the group in the PDA.
            CraftDataHandler.AddToGroup(TechGroup.ExteriorModules, TechCategory.ExteriorOther, TechType);

            // Set it to unlock after the base TechType is unlocked.
            KnownTechHandler.SetAnalysisTechEntry(basePotTechType, new List <TechType>()
            {
                TechType
            });

            // Register this prefab.
            PrefabHandler.RegisterPrefab(this);
        }
Ejemplo n.º 6
0
        protected void addToGroup(TechGroup group, TechCategory category, TechType after = TechType.None)
        {
            CraftDataHandler.AddToGroup(group, category, TechType, after);

            if (group >= TechGroup.BasePieces && group <= TechGroup.Miscellaneous)             // little hack
            {
                CraftDataHandler.AddBuildable(TechType);
            }
        }
Ejemplo n.º 7
0
        private void PatchBuildable()
        {
            CraftDataHandler.AddBuildable(this.TechType);

            if (!string.IsNullOrEmpty(HandOverText))
            {
                LanguageHandler.SetLanguageLine($"{this.ClassID}HandOver", this.HandOverText);
            }
        }
        public void Patch()
        {
            ModdedItems.Initialize();

            // Create new Craft Tree Type
            CreateCustomTree(out CraftTree.Type craftType);
            this.TreeTypeID = craftType;

            // Create a new TechType for new fabricator
            this.TechType = TechTypeHandler.AddTechType(
                internalName: NameID,
                displayName: FriendlyName,
                tooltip: "Construct vehicle upgrade modules from the comfort of your favorite habitat or cyclops.",
                sprite: ImageUtils.LoadSpriteFromFile(@"./QMods/VModFabricator/Assets/VModFabIcon.png"),
                unlockAtStart: false);

            // Create a Recipie for the new TechType
            var customFabRecipe = new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[4]
                {
                    new Ingredient(TechType.Titanium, 2),
                    new Ingredient(TechType.ComputerChip, 1),
                    new Ingredient(TechType.Diamond, 1),
                    new Ingredient(TechType.Lead, 1),
                })
            };

            // Add the new TechType to the buildables
            CraftDataHandler.AddBuildable(this.TechType);

            // Add the new TechType to the group of Interior Module buildables
            CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType);

            LanguageHandler.SetLanguageLine(HandOverText, "Use Vehicle Module Fabricator");

            // Set the buildable prefab
            PrefabHandler.RegisterPrefab(this);

            // Associate the recipie to the new TechType
            CraftDataHandler.SetTechData(this.TechType, customFabRecipe);

            // Set which blueprints unlock the VMod Fabricator
            string unlockMessage = $"{FriendlyName} blueprint discovered!";
            var    unlockThis    = new TechType[1] {
                this.TechType
            };

            KnownTechHandler.SetAnalysisTechEntry(TechType.Workbench, unlockThis, unlockMessage);
            KnownTechHandler.SetAnalysisTechEntry(TechType.BaseUpgradeConsole, unlockThis, unlockMessage);
            KnownTechHandler.SetAnalysisTechEntry(TechType.Cyclops, unlockThis, unlockMessage);
        }
Ejemplo n.º 9
0
        public void Patch()
        {
            // Register this Prefab with SMLHelper
            PrefabHandler.RegisterPrefab(this);

            // Create a new TechType for new Buildable
            this.TechType = TechTypeHandler.AddTechType
                            (
                NameID,
                FriendlyName,
                "This machine gathers resources from underground veins and pulls them to the surface.",
                ImageUtils.LoadSpriteFromFile(@"./BaseDrillMod/BaseDrillIcon.png"),
                true
                            );

            // Add the new TechType to the buildables
            CraftDataHandler.AddBuildable(this.TechType);

            // Add the new TechType to the group of Interior Module buildables
            CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType);

            LanguageHandler.SetLanguageLine(HandOverText, "Resource Drill");

            // Create new instance of TechData and apply the recipie to it
            TechData techData = new TechData
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(TechType.TitaniumIngot, 2),
                    new Ingredient(TechType.Diamond, 2),
                    new Ingredient(TechType.Lithium, 4),
                    new Ingredient(TechType.AdvancedWiringKit, 1),
                    new Ingredient(TechType.Lubricant, 1)
                })
            };

            // Associate TechType and TechData
            CraftDataHandler.SetTechData(base.TechType, techData);

            // Set which blueprints unlock the Item
            string unlockMessage = $"{FriendlyName} blueprint discovered!";
            var    unlockThis    = new TechType[1] {
                this.TechType
            };

            KnownTechHandler.SetAnalysisTechEntry(TechType.BaseMapRoom, unlockThis, unlockMessage);
            BaseDrillModule instance = new BaseDrillModule();

            instance.GetGameObject();
        }
        // This patch is handled by the Nuclear Charger
        internal void Patch(bool nukFabricatorEnabled)
        {
            // Create new Craft Tree Type
            CreateCustomTree(out CraftTree.Type craftType);
            TreeTypeID = craftType;

            // Create a new TechType for new fabricator
            this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName,
                                                        "A specialized fabricator for safe handling of radioactive energy sources.", false);

            if (!nukFabricatorEnabled) // Even if the options have this be disabled,
            {
                return;                // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched
            }
            // Create a Recipie for the new TechType
            var customFabRecipe = new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[4]
                {
                    new Ingredient(TechType.Titanium, 2),
                    new Ingredient(TechType.ComputerChip, 1),
                    new Ingredient(TechType.Magnetite, 1),
                    new Ingredient(TechType.Lead, 2),
                })
            };

            // Add the new TechType to the buildables
            CraftDataHandler.AddBuildable(this.TechType);

            // Add the new TechType to the group of Interior Module buildables
            CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType);

            // Set the buildable prefab
            PrefabHandler.RegisterPrefab(this);

            LanguageHandler.SetLanguageLine(HandOverText, "Use Nuclear Fabricator");

            // Set the custom sprite for the Habitat Builder Tool menu
            SpriteHandler.RegisterSprite(this.TechType, @"./QMods/MoreCyclopsUpgrades/Assets/NuclearFabricatorI.png");

            // Associate the recipie to the new TechType
            CraftDataHandler.SetTechData(this.TechType, customFabRecipe);

            KnownTechHandler.SetAnalysisTechEntry(TechType.BaseNuclearReactor, new TechType[1] {
                this.TechType
            }, $"{FriendlyName} blueprint discovered!");
        }
Ejemplo n.º 11
0
        public static void Inject()
        {
            try
            {
                bundle = AssetBundle.LoadFromFile("./QMods/Manta/mantabundle");

                GameObject manta = new GameObject("mantaconsole");
                Object.DontDestroyOnLoad(manta);

                MantaConsole mant = manta.AddComponent <MantaConsole>();

                foreach (MeshRenderer rend in mant.obj.GetComponentsInChildren <MeshRenderer>())
                {
                    rend.material.shader = Shader.Find("MarmosetUBER");
                }

                //make the model
                mantaTech = TechTypeHandler.AddTechType("MantaModel", "Miniature Manta Submarine", "A model of the concept Manta Submarine");
                MantaPrefab prefab = new MantaPrefab("MantaModel", "Submarine/Build/MantaModel", mantaTech);
                PrefabHandler.RegisterPrefab(prefab);

                TechData helper = new TechData()
                {
                    Ingredients = new List <Ingredient>()
                    {
                        new Ingredient(TechType.Titanium, 2)
                    }
                };
                CraftDataHandler.SetTechData(mantaTech, helper);

                CraftDataHandler.AddBuildable(mantaTech);
                CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, mantaTech);
            }
            catch (Exception e)
            {
                Console.WriteLine("[MantaMod] Mod Loading Failed: " + e.Message + e.StackTrace);
                StackTrace st   = new StackTrace(e, true);
                int        line = st.GetFrame(st.FrameCount - 1).GetFileLineNumber();
                Console.WriteLine("[MantaMod] Error occurred in line: " + line);
            }
        }
Ejemplo n.º 12
0
        public void Patch(CraftTree.Type craftTreeType)
        {
            TreeTypeID = craftTreeType;

            CraftDataHandler.SetTechData(TechType, new TechData()
            {
                Ingredients = new List <Ingredient>
                {
                    new Ingredient(TechType.Titanium, 2),
                    new Ingredient(TechType.ComputerChip, 1),
                    new Ingredient(TechType.Diamond, 1),
                    new Ingredient(TechType.Lead, 1),
                }
            });

            CraftDataHandler.AddBuildable(TechType);
            CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, TechType, TechType.Fabricator);

            LanguageHandler.SetLanguageLine("UseCompressor", "Use Vehicle Module Fabricator");

            PrefabHandler.RegisterPrefab(this);
        }
Ejemplo n.º 13
0
        public static void Patch()
        {
            bundle = AssetBundle.LoadFromFile(Path.Combine(Environment.CurrentDirectory, "QMods/Precursor Fabricator/fabricatorassets"));

            string assetFolder = Path.Combine(Environment.CurrentDirectory, "QMods/Precursor Fabricator/Assets");

            TechType fabricator = TechTypeHandler.AddTechType("AlienFab", "Precursor Fabricator", "A device capable of fabricating materials of alien origin");

            PrefabHandler.RegisterPrefab(new FabricatorPrefab("AlienFab", "WorldEntities/AlienFabricator", fabricator));

            SpriteHandler.RegisterSprite(fabricator, Path.Combine(assetFolder, "PrecursorFabricator.png"));

            TechType ingot = TechTypeHandler.AddTechType("PrecursorIngot", "Precursor Alloy Ingot", "A super-dense, electronically active bar of alien metal");

            PrefabHandler.RegisterPrefab(new IngotPrefab("PrecursorIngot", "WorldEntities/PrecursorIngot", ingot));

            SpriteHandler.RegisterSprite(ingot, Path.Combine(assetFolder, "PrecursorIngot.png"));

            CraftDataHandler.AddBuildable(fabricator);
            CraftDataHandler.AddToGroup(TechGroup.InteriorPieces, TechCategory.InteriorPiece, fabricator);
            CraftDataHandler.SetCraftingTime(fabricator, 2f);
            TechData data = new TechData(new Ingredient(TechType.PlasteelIngot, 2), new Ingredient(TechType.PrecursorIonCrystal, 2), new Ingredient(TechType.Kyanite, 1));

            CraftDataHandler.SetTechData(fabricator, data);

            TechData ingotData = new TechData(new Ingredient(TechType.PlasteelIngot, 6), new Ingredient(TechType.PrecursorIonCrystal, 1));

            ingotData.craftAmount = 1;
            CraftDataHandler.SetTechData(ingot, ingotData);

            root = CraftTreeHandler.CreateCustomCraftTreeAndType("PrecursorFabricator", out fabType);
            root.AddCraftingNode(ingot);

            if (TechTypeHandler.TryGetModdedTechType("IonFragment", out TechType depletedCube))
            {
                root.AddCraftingNode(depletedCube);
            }
        }
Ejemplo n.º 14
0
        public static void Patch()
        {
            // Create new Craft Tree Type
            CreateCustomTree(out CraftTree.Type craftType);
            HModTreeType = craftType;

            // Create a new TechType for new fabricator
            HModFabTechType = TechTypeHandler.AddTechType(CustomFabAndTreeID,
                                                          FriendlyName,
                                                          "Construct Player upgrade modules So you can survive more deadly woonds, or even deliver them yourself.",
                                                          ImageUtils.LoadSpriteFromFile(@"./QMods/HealthModuleMod/Assets/MissingFabricator.png"),
                                                          true);

            // Create a Recipie for the new TechType
            var customFabRecipe = new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[3]//State you are using 3 ingredients
                {
                    new Ingredient(TechType.Titanium, 1),
                    new Ingredient(TechType.ComputerChip, 1),
                    new Ingredient(TechType.FiberMesh, 2),
                    //State what ingredients you are using.
                })
            };

            // Add the new TechType to the buildables
            CraftDataHandler.AddBuildable(HModFabTechType);

            // Add the new TechType to the group of Interior Module buildables
            CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, HModFabTechType);

            LanguageHandler.SetLanguageLine(HandOverText, "Use Vehicle Module Fabricator");

            // Set the buildable prefab
            PrefabHandler.RegisterPrefab(new HModFabricatorModulePrefab(CustomFabAndTreeID, HModFabTechType));

            // Associate the recipie to the new TechType
            CraftDataHandler.SetTechData(HModFabTechType, customFabRecipe);

            string unlockMessage = $"{FriendlyName} blueprint discovered!";

            SMLHelper.CustomSpriteHandler.customSprites.Add(new SMLHelper.CustomSprite(TechType.Terraformer, ImageUtils.LoadSpriteFromFile(@"./QMods/HealthModuleMod/Assets/TerraFormer.png")));

            var toUnlock = new TechType[1] {
                TechType.DiamondBlade
            };

            KnownTechHandler.SetAnalysisTechEntry(TechType.Diamond, toUnlock, unlockMessage);
            var toUnlock1 = new TechType[1] {
                HModFabTechType
            };

            KnownTechHandler.SetAnalysisTechEntry(TechType.FiberMesh, toUnlock1, unlockMessage);
            var toUnlock2 = new TechType[1] {
                TechType.Terraformer
            };

            KnownTechHandler.SetAnalysisTechEntry(TechType.Melon, toUnlock2, unlockMessage);
            var toUnlock3 = new TechType[1] {
                TechType.BaseUpgradeConsole
            };

            KnownTechHandler.SetAnalysisTechEntry(TechType.Terraformer, toUnlock3, unlockMessage);
            //KnownTechHandler.SetAnalysisTechEntry(TechType.Cyclops, toUnlock, unlockMessage);
        }