// This is the recipe that uses an existing Rad Suit and Reinforced Dive Suit
        protected override RecipeData GetBlueprintRecipe()
        {
            RecipeData recipe = new RecipeData()
            {
                craftAmount = 0,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(TechType.HydrochloricAcid, 1),
                    new Ingredient(TechType.CreepvinePiece, 2),
                    new Ingredient(TechType.Aerogel, 1),
                    new Ingredient(TechType.RadiationGloves, 1),
                    new Ingredient(TechType.RadiationHelmet, 1),
                    new Ingredient(TechType.RadiationSuit, 1),
                    new Ingredient(TechType.ReinforcedDiveSuit, 1),
                    new Ingredient(TechType.ReinforcedGloves, 1),
                    new Ingredient(TechType.AramidFibers, 1),
                    new Ingredient(TechType.WiringKit, 1)
                })
            };

            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidSuit"));
            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidHelmet"));
            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidGloves"));

            return(recipe);
        }
        protected override RecipeData GetBlueprintRecipe()
        {
            TechType ttLizardScale = Main.GetNitrogenTechtype("lavalizardscale");

            if (ttLizardScale == TechType.None)
            {
                return new RecipeData()
                       {
                       }
            }
            ;


            RecipeData recipe = new RecipeData()
            {
                craftAmount = 0,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(Main.GetNitrogenTechtype("ReinforcedSuit2"), 1),
                    new Ingredient(TechType.HydrochloricAcid, 1),
                    new Ingredient(TechType.CreepvinePiece, 2),
                    new Ingredient(TechType.Aerogel, 1),
                    new Ingredient(TechType.Kyanite, 2),
                    new Ingredient(ttLizardScale, 2)
                })
            };

            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("NitrogenBrineSuit3"));

            return(recipe);
        }
        protected override RecipeData GetBlueprintRecipe()
        {
            TechType ttEelScale    = Main.GetNitrogenTechtype("rivereelscale");
            TechType ttLizardScale = Main.GetNitrogenTechtype("lavalizardscale");

            if (ttEelScale == TechType.None || ttLizardScale == TechType.None)
            {
                return new RecipeData()
                       {
                       }
            }
            ;

            RecipeData recipe = new RecipeData()
            {
                craftAmount = 0,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(TechTypeUtils.GetModTechType("AcidGloves"), 1),
                    new Ingredient(TechType.AluminumOxide, 2),
                    new Ingredient(ttEelScale, 2),
                    new Ingredient(TechType.Kyanite, 2),
                    new Ingredient(ttLizardScale, 2)
                })
            };

            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("NitrogenBrineSuit3"));

            return(recipe);
        }
        // This is the recipe that uses an existing Rebreather only
        protected override RecipeData GetBlueprintRecipe()
        {
            RecipeData recipe = new RecipeData()
            {
                craftAmount = 0,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(TechType.HydrochloricAcid, 1),
                    new Ingredient(TechType.CreepvinePiece, 2),
                    new Ingredient(TechType.Aerogel, 1),
                    new Ingredient(TechType.Lead, 2),
                    new Ingredient(TechType.AramidFibers, 2),
                    new Ingredient(TechType.Diamond, 2),
                    new Ingredient(TechType.Titanium, 1),
                    new Ingredient(TechType.Rebreather, 1)
                })
            };

            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidGloves"));
            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidHelmet"));
            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidSuit"));
            //recipe.LinkedItems.Add(Main.prefabGloves.TechType);
            //recipe.LinkedItems.Add(Main.prefabHelmet.TechType);
            //recipe.LinkedItems.Add(Main.prefabSuitMk1.TechType);

            return(recipe);
        }
        protected override RecipeData GetBlueprintRecipe()
        {
            RecipeData recipe = new RecipeData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(TechType.HydrochloricAcid, 1),
                    new Ingredient(TechType.CreepvinePiece, 2),
                    new Ingredient(TechType.Aerogel, 1),
                    new Ingredient(TechType.AramidFibers, 3),
                    new Ingredient(TechType.Diamond, 2),
                    new Ingredient(TechType.Titanium, 2),
                    new Ingredient(TechType.Lead, 2),
                    new Ingredient(TechType.WiringKit, 1)
                })
            };

            //recipe.LinkedItems.Add(AcidGlovesPrefab.TechTypeID);
            //recipe.LinkedItems.Add(AcidHelmetPrefab.TechTypeID);
            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidGloves"));
            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidHelmet"));

            return(recipe);
        }
 public static TechType GetModTechType(string key)
 {
     /*string lowerKey = key.ToLower();
      * TechType tt;
      * if(ModTechTypes.TryGetValue(lowerKey, out tt))
      *      return tt;
      *
      * return TechTypeUtils.GetTechType(key);*/
     return(TechTypeUtils.GetModTechType(key));
 }
        public static void PostPatch()
        {
            if (HasNitrogenMod())
            {
                TechType suitMk1 = TechTypeUtils.GetModTechType("AcidSuit");
                TechType suitMk2 = TechTypeUtils.GetModTechType("NitrogenBrineSuit2");
                TechType suitMk3 = TechTypeUtils.GetModTechType("NitrogenBrineSuit3");
#if !RELEASE
                Logger.Log(Logger.Level.Debug, $"Setting up Nitrogen suit TechTypes");
#endif
                if (suitMk2 != TechType.None)
                {
                    Main.DamageResistances.Add(suitMk2, new List <DamageInfo> {
                        new DamageInfo(DamageType.Acid, -0.6f)    /*,
                                                                   * new DamageInfo(DamageType.Radiation, -0.70f)*/
                    });

                    Patches.EquipmentPatches.AddSubstitution(suitMk2, TechType.RadiationSuit);
                    Patches.EquipmentPatches.AddSubstitution(suitMk2, TechType.ReinforcedDiveSuit);
                }
                else
                {
#if !RELEASE
                    Logger.Log(Logger.Level.Error, $"NitrogenBrinesuit2 techtype could not be found");
#endif
                }

                if (suitMk3 != TechType.None)
                {
                    Main.DamageResistances.Add(suitMk3, new List <DamageInfo> {
                        new DamageInfo(DamageType.Acid, -0.6f)    /*,
                                                                   * new DamageInfo(DamageType.Radiation, -0.70f)*/
                    });

                    Patches.EquipmentPatches.AddSubstitution(suitMk3, TechType.RadiationSuit);
                    Patches.EquipmentPatches.AddSubstitution(suitMk3, TechType.ReinforcedDiveSuit);
                }
                else
                {
#if !RELEASE
                    Logger.Log(Logger.Level.Error, $"NitrogenBrinesuit3 techtype could not be found");
#endif
                }
                if (NitroAddDiveSuit != null)
                {
#if !RELEASE
                    Logger.Log(Logger.Level.Debug, $"Found Nitrogen API, adding dive suits.");
#endif
                    NitroAddDiveSuit.Invoke(null, new object[] { suitMk1, 800f, 0.85f, 15f });
                    NitroAddDiveSuit.Invoke(null, new object[] { suitMk2, 1300f, 0.75f, 20f });
                    NitroAddDiveSuit.Invoke(null, new object[] { suitMk3, 8000f, 0.55f, 35f });
                }
            }
        }
        protected override RecipeData GetBlueprintRecipe()
        {
            if (!Main.HasNitrogenMod())
            {
                return new RecipeData()
                       {
                       }
            }
            ;

            TechType ttEelScale    = Main.GetNitrogenTechtype("rivereelscale");
            TechType ttLizardScale = Main.GetNitrogenTechtype("lavalizardscale");

            if (ttEelScale == TechType.None || ttLizardScale == TechType.None)
            {
                return new RecipeData()
                       {
                       }
            }
            ;

            RecipeData recipe = new RecipeData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(TechType.HydrochloricAcid, 1),
                    new Ingredient(TechType.CreepvinePiece, 2),
                    new Ingredient(TechType.Aerogel, 1),
                    new Ingredient(TechType.AramidFibers, 3),
                    new Ingredient(TechType.Diamond, 2),
                    new Ingredient(TechType.Titanium, 2),
                    new Ingredient(TechType.Lead, 2),
                    new Ingredient(TechType.WiringKit, 1),
                    new Ingredient(TechType.AluminumOxide, 2),
                    new Ingredient(ttEelScale, 2),
                    new Ingredient(TechType.Kyanite, 2),
                    new Ingredient(ttLizardScale, 2)
                })
            };

            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidGloves"));
            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("AcidHelmet"));

            return(recipe);
        }
        protected override RecipeData GetBlueprintRecipe()
        {
            RecipeData recipe = new RecipeData()
            {
                craftAmount = 0,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(Main.GetNitrogenTechtype("ReinforcedSuit3"), 1),
                    new Ingredient(TechType.HydrochloricAcid, 1),
                    new Ingredient(TechType.CreepvinePiece, 2),
                    new Ingredient(TechType.Aerogel, 1)
                })
            };

            recipe.LinkedItems.Add(TechTypeUtils.GetModTechType("NitrogenBrineSuit3"));

            return(recipe);
        }
        protected override RecipeData GetBlueprintRecipe()
        {
            RecipeData recipe = new RecipeData()
            {
                craftAmount = 0,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(Main.GetNitrogenTechtype("ReinforcedSuit2"), 1),
                    new Ingredient(TechType.HydrochloricAcid, 1),
                    new Ingredient(TechType.FiberMesh, 1),
                    new Ingredient(TechType.Aerogel, 1)
                }),
                LinkedItems = new List <TechType>()
                {
                    TechTypeUtils.GetModTechType("NitrogenBrineSuit2")
                }
            };

            return(recipe);
        }
        protected override RecipeData GetBlueprintRecipe()
        {
            if (!Main.HasNitrogenMod())
            {
                return new RecipeData()
                       {
                       }
            }
            ;

            TechType ttEelScale    = Main.GetNitrogenTechtype("rivereelscale");
            TechType ttLizardScale = Main.GetNitrogenTechtype("lavalizardscale");

            if (ttEelScale == TechType.None || ttLizardScale == TechType.None)
            {
                return new RecipeData()
                       {
                       }
            }
            ;

            RecipeData recipe = new RecipeData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[]
                {
                    new Ingredient(TechTypeUtils.GetModTechType("NitrogenBrineSuit2"), 1),
                    new Ingredient(TechType.Kyanite, 2),
                    new Ingredient(ttLizardScale, 2)
                }),
                //LinkedItems = new List<TechType>()
                //{
                //    TechTypeUtils.GetModTechType("AcidGloves"),
                //    TechTypeUtils.GetModTechType("AcidHelmet")
                //}
            };



            return(recipe);
        }
        public void Patch()
        {
            foreach (string s in UnlockAtStart)
            {
                TechType tt = TechTypeUtils.GetModTechType(s);
                if (tt != TechType.None)
                {
                    if (UnlockStartTypes.Contains(tt))
                    {
                        Log.LogError($"Duplicate entry {s} in UnlockAtStart list");
                        // Unlike with the other collections, this is actually an error. A blueprint can't be unlocked multiple times at the start of the game.
                    }
                    else
                    {
                        UnlockStartTypes.Add(tt);
                        KnownTechHandler.UnlockOnStart(tt);
                    }
                }
                else
                {
                    Log.LogError($"Could not parse string '{s}' in UnlockAtStart list as TechType");
                }
            }

            foreach (KeyValuePair <string, string> kvp in SingleUnlocks)
            {
                TechType key = TechTypeUtils.GetModTechType(kvp.Key);
                if (key == TechType.None)
                {
                    Log.LogError($"Could not parse key '{kvp.Key}' in SingleUnlocks collection as TechType");
                    continue;
                }

                TechType value = TechTypeUtils.GetModTechType(kvp.Value);
                if (value == TechType.None)
                {
                    Log.LogError($"Could not parse value '{kvp.Value}' in SingleUnlocks collection as TechType");
                    continue;
                }

                if (SingleUnlockTypes.Contains(key))
                {
                    // A duplicate key in this collection isn't necessarily an error; It may be that a single blueprint has been configured with multiple ways to unlock it.
                    // It's worth logging as a warning, however.
                    Log.LogWarning($"Duplicate key '{kvp.Key}' found in SingleUnlocks collection; Verify that this is intended behaviour.");
                }
                else
                {
                    SingleUnlockTypes.Add(key);
                }

                KnownTechHandler.SetAnalysisTechEntry(value, new HashSet <TechType>()
                {
                    key
                });
            }

            foreach (KeyValuePair <string, List <string> > compound in CompoundTechs)
            {
                TechType tt = TechTypeUtils.GetModTechType(compound.Key);
                if (tt == TechType.None)
                {
                    Log.LogError($"Could not parse string '{compound.Key}' for key as TechType in CompoundTechs");
                    continue;
                }
                if (CompoundTechTypes.Contains(tt))
                {
                    Log.LogWarning($"Multiple entries found in CompoundTechs for TechType {tt.AsString()}; Verify that this is intended behaviour.");
                }
                else
                {
                    CompoundTechTypes.Add(tt);
                }

                HashSet <TechType> compoundTechs = new HashSet <TechType>();
                foreach (string s in compound.Value)
                {
                    TechType t = TechTypeUtils.GetModTechType(s);
                    if (t == TechType.None)
                    {
                        Log.LogError($"Could not parse string '{s}' as TechType in CompoundTechs collection, key {tt.AsString()}");
                    }
                    else if (compoundTechs.Contains(t))
                    {
                        Log.LogError($"Duplicate entry '{s}' in CompoundTechs, key {tt.AsString()}");
                    }
                    else
                    {
                        compoundTechs.Add(t);
                    }
                }

                if (compoundTechs.Count < 2)
                {
                    Log.LogWarning($"Not enough valid TechTypes found in list for CompoundTechs entry {tt.AsString()}; Verify the spelling of all entries within its list.");
                }
                else
                {
                    Reflection.AddCompoundTech(tt, compoundTechs.ToList <TechType>());
                }
            }
        }
Example #13
0
 public static TechType GetModTechType(string key)
 {
     return(TechTypeUtils.GetModTechType(key));
 }
Example #14
0
        public static void Load()
        {
#if !RELEASE
            Logger.Log(Logger.Level.Debug, "Checking for Nitrogen mod");
#endif
            bool   bHasN2  = QModServices.Main.ModPresent("NitrogenMod");
            string sStatus = "Nitrogen mod " + (bHasN2 ? "" : "not ") + "present";
#if !RELEASE
            Logger.Log(Logger.Level.Debug, sStatus);
#endif

            List <Craftable> Prefabs = new List <Craftable>()
            {
                //prefabGloves,
                //prefabHelmet,
                //prefabSuitMk1,
                new AcidSuit(),
                new AcidGloves(),
                new AcidHelmet(),
                //new Blueprint_OnlyRadSuit(),
                //new Blueprint_OnlyRebreather(),
                //new Blueprint_OnlyReinforcedSuit(),
                new Blueprint_Suits(),
                //new Blueprint_RebreatherRad(),
                //new Blueprint_RebreatherReinforced(),
                //new Blueprint_RadReinforced()
            };

            // There doesn't appear to be any handler function for verifying whether a certain tab node already exists. This is relevant since I'm deliberately using a node with the same
            // name as another mod, More Modified Items, so that the non-Nitrogen suit upgrades appear in the same menu as the Reinforced Stillsuit.
            SMLHelper.V2.Handlers.CraftTreeHandler.AddTabNode(CraftTree.Type.Workbench, "BodyMenu", "Suit Upgrades", SpriteManager.Get(TechType.Stillsuit));

            if (bHasN2)
            {
#if !RELEASE
                Logger.Log(Logger.Level.Debug, $"Main.Load(): Found NitrogenMod, adding Nitrogen prefabs");
#endif
                foreach (string sTechType in new List <string> {
                    "reinforcedsuit2", "reinforcedsuit3", "rivereelscale", "lavalizardscale"
                })
                {
                    if (SMLHelper.V2.Handlers.TechTypeHandler.TryGetModdedTechType(sTechType, out TechType tt))
                    {
                        NitrogenTechtypes.Add(sTechType, tt);
                        bHasN2 = true;
                    }
                    else
                    {
#if !RELEASE
                        Logger.Log(Logger.Level.Debug, $"Load(): Could not find TechType for Nitrogen class ID {sTechType}");
#endif
                    }
                }
                //prefabSuitMk2 = new NitrogenBrineSuit2();
                //prefabSuitMk3 = new NitrogenBrineSuit3();
                Prefabs.Add(new NitrogenBrineSuit2());
                Prefabs.Add(new NitrogenBrineSuit3());
                Prefabs.Add(new Blueprint_BrineMk1toMk2());
                Prefabs.Add(new Blueprint_BrineMk2toMk3());
                Prefabs.Add(new Blueprint_BrineMk1toMk3());
                Prefabs.Add(new Blueprint_ReinforcedMk2toBrineMk2());
                Prefabs.Add(new Blueprint_ReinforcedMk3toBrineMk3());
            }

            foreach (Craftable c in Prefabs)
            {
#if !RELEASE
                Logger.Log(Logger.Level.Debug, $"running Patch() for prefab {c.ToString()}");
#endif
                c.Patch();
            }

#if !RELEASE
            Logger.Log(Logger.Level.Debug, $"Adding basic EquipmentGetCount substitutions");
#endif
            Patches.EquipmentPatches.AddSubstitution(TechTypeUtils.GetModTechType("AcidHelmet"), TechType.Rebreather);
            Patches.EquipmentPatches.AddSubstitution(TechTypeUtils.GetModTechType("AcidHelmet"), TechType.RadiationHelmet);
            Patches.EquipmentPatches.AddSubstitution(TechTypeUtils.GetModTechType("AcidSuit"), TechType.RadiationSuit);
            Patches.EquipmentPatches.AddSubstitution(TechTypeUtils.GetModTechType("AcidGloves"), TechType.RadiationGloves);
            Patches.EquipmentPatches.AddSubstitution(TechTypeUtils.GetModTechType("AcidGloves"), TechType.ReinforcedGloves);
            Patches.EquipmentPatches.AddSubstitution(TechTypeUtils.GetModTechType("AcidSuit"), TechType.ReinforcedDiveSuit);

#if !RELEASE
            Logger.Log(Logger.Level.Debug, $"Setting up DamageResistances list");
#endif
            Main.DamageResistances = new Dictionary <TechType, List <DamageInfo> > {
                // Gloves
                {
                    TechTypeUtils.GetModTechType("AcidGloves"), new List <DamageInfo> {
                        new DamageInfo(DamageType.Acid, -0.15f)/*,
                                                                * new DamageInfo(DamageType.Radiation, -0.10f)*/
                    }
                },


                // Helmet
                {
                    TechTypeUtils.GetModTechType("AcidHelmet"), new List <DamageInfo> {
                        new DamageInfo(DamageType.Acid, -0.25f)/*,
                                                                * new DamageInfo(DamageType.Radiation, -0.20f)*/
                    }
                },


                // Suit
                {
                    TechTypeUtils.GetModTechType("AcidSuit"), new List <DamageInfo> {
                        new DamageInfo(DamageType.Acid, -0.6f)/*,
                                                               * new DamageInfo(DamageType.Radiation, -0.70f)*/
                    }
                }
            };
            Harmony.CreateAndPatchAll(myAssembly, $"DaWrecka_{myAssembly.GetName().Name}");
        }