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);
        }
        // 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);
        }
 public AcidSuit(string classId = "AcidSuit", string friendlyName = "Brine Suit", string description = "Reinforced dive suit with an acid-resistant layer") : base(classId, friendlyName, description)
 {
     OnFinishedPatching += () =>
     {
         TechTypeUtils.AddModTechType(this.TechType);
     };
 }
        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 AcidGloves() : base("AcidGloves", "Brine Gloves", "Reinforced dive gloves with an acid-resistant layer")
 {
     OnFinishedPatching += () =>
     {
         TechTypeUtils.AddModTechType(this.TechType);
     };
 }
        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);
        }
        public void Load()
        {
            var assembly = Assembly.GetExecutingAssembly();

            new Harmony($"DaWrecka_{assembly.GetName().Name}").PatchAll(assembly);
            foreach (string s in new HashSet <string>()
            {
                "Gravsphere", "GravTrapMk2"
            })
            {
                TechType tt = TechTypeUtils.GetTechType(s);
                if (tt == TechType.None)
                {
                    Log.LogWarning($"Could not retrieve TechType for string {s}");
                }
                else
                {
                    var classid = CraftData.GetClassIdForTechType(TechType.Gravsphere);
                    if (WorldEntityDatabase.TryGetInfo(classid, out var worldEntityInfo))
                    {
                        worldEntityInfo.cellLevel = LargeWorldEntity.CellLevel.Global;

                        WorldEntityDatabase.main.infos[classid] = worldEntityInfo;
                    }
                }
            }
        }
 public NitrogenBrineSuit3() : base("NitrogenBrineSuit3", title, description)
 {
     OnFinishedPatching += () =>
     {
         TechTypeUtils.AddModTechType(this.TechType);
     };
 }
Beispiel #10
0
        //private List<RecipeOverride> defaultRecipeOverrides

        public bool TryOverrideRecipe(TechType fragment, out RecipeData outRecipe)
        {
            string sFragment = fragment.ToString();

            foreach (RecipeOverride r in RecipeOverrides)
            {
                if (sFragment == r.overridden)
                {
                    outRecipe = new RecipeData();
                    foreach (StringIngredient s in r.replacements)
                    {
                        if (TechTypeUtils.TryGetModTechType(s.techType, out TechType t))
                        {
                            outRecipe.Ingredients.Add(new Ingredient(t, s.amount));
                        }
                        else
                        {
#if !RELEASE
                            Logger.Log(Logger.Level.Error, $"Could not parse {s.techType} as TechType; check the spelling and/or case");
#endif
                            outRecipe = null;
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            outRecipe = null;
            return(false);
        }
 public AcidHelmet() : base("AcidHelmet", "Brine Helmet", "Rebreather treated with an acid-resistant layer")
 {
     OnStartedPatching += () =>
     {
         TechTypeUtils.AddModTechType(this.TechType);
         texture      = ImageUtils.LoadTextureFromFile(Path.Combine(Main.AssetsFolder, "AcidHelmetskin.png"));
         illumTexture = ImageUtils.LoadTextureFromFile(Path.Combine(Main.AssetsFolder, "AcidHelmetillum.png"));
     };
 }
 internal static GameObject GetModPrefab(string key)
 {
     /*string lowerKey = key.ToLower();
      * GameObject modPrefab;
      * if (ModPrefabs.TryGetValue(lowerKey, out modPrefab))
      *      return modPrefab;
      *
      * return null;*/
     return(TechTypeUtils.GetModPrefab(key));
 }
 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 });
                }
            }
        }
 public AcidHelmet() : base("AcidHelmet", "Brine Helmet", "Rebreather treated with an acid-resistant layer")
 {
     OnFinishedPatching += () =>
     {
         TechTypeUtils.AddModTechType(this.TechType);
         EquipmentPatch.AddSubstitution(this.TechType, TechType.Rebreather);
         Main.AddDamageResist(this.TechType, DamageType.Acid, 0.25f);
         EquipmentPatch.AddSubstitution(this.TechType, TechType.RadiationHelmet);
         texture      = ImageUtils.LoadTextureFromFile(Path.Combine(Main.AssetsFolder, "AcidHelmetskin.png"));
         illumTexture = ImageUtils.LoadTextureFromFile(Path.Combine(Main.AssetsFolder, "AcidHelmetillum.png"));
     };
 }
 internal static void AddModTechType(TechType tech, GameObject prefab = null)
 {
     /*string key = tech.AsString(true);
      * if (!ModTechTypes.ContainsKey(key))
      * {
      *      ModTechTypes.Add(key, tech);
      * }
      * if (prefab != null)
      * {
      *      ModPrefabs[key] = prefab;
      * }*/
     TechTypeUtils.AddModTechType(tech, prefab);
 }
        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);
        }
 public AcidSuit(string classId = "AcidSuit", string friendlyName = "Brine Suit", string description = "Reinforced dive suit with an acid-resistant layer") : base(classId, friendlyName, description)
 {
     OnFinishedPatching += () =>
     {
         TechTypeUtils.AddModTechType(this.TechType);
         EquipmentPatch.AddSubstitutions(this.TechType, new HashSet <TechType>()
         {
             TechType.RadiationSuit, TechType.ReinforcedDiveSuit
         });
         Main.AddDiveSuit(this.TechType, this.maxDepth, this.breathMultiplier, this.minTempBonus);
         Main.AddDamageResist(this.TechType, DamageType.Acid, 0.6f);
         Reflection.AddCompoundTech(this.TechType, new List <TechType>()
         {
             TechType.ReinforcedDiveSuit,
             TechType.RadiationSuit
         });
     };
 }
        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);
        }
        internal static void PostPatch()
        {
            foreach (KeyValuePair <string, float> kvp in Main.config.BatteryValues)
            {
                TechType tt = TechTypeUtils.GetTechType(kvp.Key);
                if (tt == TechType.None)
                {
                    Log.LogError($"No valid TechType found for string '{kvp.Key}'");
                }
                else
                {
                    Log.LogDebug($"Loading TechType {tt} with customised battery capacity of {kvp.Value}");
                    //if (typedBatteryValues == null)
                    //	typedBatteryValues = new Dictionary<TechType, float>();

                    typedBatteryValues[tt] = kvp.Value;
                }
            }
        }
        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);
        }
Beispiel #23
0
 public void PostPatch()
 {
     /* Enable the Storage Module. It's only useful for the Exosuit, but it still works, and it can turn the Exosuit's storage locker from "useless" to "useful", so I don't know why UWE disabled it.
      *
      * This block of code became unnecessary with the Seaworthy update, late Feb 2021, which re-enabled the Storage Module. The above comment has been retained for historical purposes.
      *
      * var storageModuleData = new RecipeData()
      * {
      *      craftAmount = 1,
      *      Ingredients = new List<Ingredient>()
      *              {
      *                      new Ingredient(TechType.Lithium, 1),
      *                      new Ingredient(TechType.Titanium, 1)
      *              }
      * };
      *
      * LanguageHandler.SetTechTypeName(TechType.VehicleStorageModule, "Vehicle Storage Module");
      * LanguageHandler.SetTechTypeTooltip(TechType.VehicleStorageModule, "A small storage locker. Expands Exosuit storage capacity.");
      * CraftDataHandler.SetTechData(TechType.VehicleStorageModule, storageModuleData);
      * CraftTreeHandler.AddCraftingNode(CraftTree.Type.SeamothUpgrades, TechType.VehicleStorageModule, new string[] { "ExosuitModules" });
      * CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.VehicleStorageModule, new string[] { "Upgrades", "ExosuitUpgrades" });
      * KnownTechHandler.SetAnalysisTechEntry(TechType.Exosuit, new TechType[] { TechType.VehicleStorageModule });*/
     foreach (string s in stringBlacklist)
     {
         TechType tt = TechTypeUtils.GetTechType(s);
         if (tt != TechType.None)
         {
             if (!StorageBlacklist.Contains(tt))
             {
                 StorageBlacklist.Add(tt);
             }
         }
         else
         {
             Logger.Log(Logger.Level.Debug, $"Could not find TechType for string '{s}' in blacklist. Is associated mod installed?");
         }
     }
 }
Beispiel #24
0
        public static void PostEquipmentChanged(ref Player __instance, string slot, InventoryItem item)
        {
            List <string> mySlots = new List <string>()
            {
                "Body", "Gloves"
            };

            bool bLog = Main.playerSlots.Contains(slot);
            //Logger.Log(Logger.Level.Debug, "1");
            bool bUseCustomTex = (Main.suitTexture != null && Main.glovesTexture != null);

            if (bLog)
            {
                Logger.Log(Logger.Level.Debug, $"Player_EquipmentChanged_Patch.Postfix: slot = {slot}. Custom textures enabled: {bUseCustomTex}");
            }
            //if (bLog) Logger.Log(Logger.Level.Debug, "2");
            Equipment equipment = Inventory.main.equipment;

            if (equipment == null)
            {
                if (bLog)
                {
                    Logger.Log(Logger.Level.Error, $"Failed to get Equipment instance");
                }
                return;
            }
            if (__instance == null)
            {
                if (bLog)
                {
                    Logger.Log(Logger.Level.Error, $"Failed to get Player instance");
                }
                return;
            }

            //if (bLog) Logger.Log(Logger.Level.Debug, "3");
            if (__instance.equipmentModels == null)
            {
                if (bLog)
                {
                    Logger.Log(Logger.Level.Error, $"Failed to get equipmentModels member of Player instance");
                }
                return;
            }

            GameObject playerModel      = Player.main.gameObject;
            Shader     shader           = Shader.Find("MarmosetUBER");
            Renderer   reinforcedGloves = playerModel.transform.Find("body/player_view/male_geo/reinforcedSuit/reinforced_suit_01_glove_geo").gameObject.GetComponent <Renderer>();

            if (defaultGloveMaterial == null)
            {
                if (reinforcedGloves != null)
                {
                    // Save a copy of the original material, for use later
                    if (bLog)
                    {
                        Logger.Log(Logger.Level.Debug, "Found Reinforced Gloves shader and copying default material");
                    }
                    defaultGloveMaterial = new Material(reinforcedGloves.material);
                }
                else
                if (bLog)
                {
                    Logger.Log(Logger.Level.Error, "ReinforcedGloves renderer not found while attempting to copy default material");
                }
            }
            Renderer reinforcedSuit = playerModel.transform.Find("body/player_view/male_geo/reinforcedSuit/reinforced_suit_01_body_geo").gameObject.GetComponent <Renderer>();

            if (reinforcedSuit != null)
            {
                if (defaultSuitMaterial == null)
                {
                    // Save a copy of the original material, for use later
                    if (bLog)
                    {
                        Logger.Log(Logger.Level.Debug, "Found Reinforced Suit shader and copying default material");
                    }
                    defaultSuitMaterial = new Material(reinforcedSuit.material);
                }
                if (defaultArmsMaterial == null)
                {
                    // Save a copy of the original material, for use later
                    if (bLog)
                    {
                        Logger.Log(Logger.Level.Debug, "Found Reinforced Suit shader and copying default arm material");
                    }
                    defaultArmsMaterial = new Material(reinforcedSuit.materials[1]);
                }
            }
            else
            if (bLog)
            {
                Logger.Log(Logger.Level.Error, "ReinforcedSuit renderer not found while attempting to copy default materials");
            }

            foreach (Player.EquipmentType equipmentType in __instance.equipmentModels)
            {
                bool bChangeTex = false;
                bUseCustomTex = (Main.suitTexture != null && Main.glovesTexture != null);
                string   activeSlot     = equipmentType.slot;
                TechType techTypeInSlot = equipment.GetTechTypeInSlot(equipmentType.slot);

                if (activeSlot == "Body")
                {
                    bHasSurvivalSuit = SurvivalSuits.Contains(techTypeInSlot);
                    Log.LogDebug($"PlayerPatches.EquipmentChanged(): TechType in slot Body = '{techTypeInSlot}', bHasSurvivalSuit = {bHasSurvivalSuit}");
                    bChangeTex       = (techTypeInSlot != lastBodyTechType);
                    techTypeInSlot   = CheckSubstitute(techTypeInSlot);
                    lastBodyTechType = techTypeInSlot;
                    if (techTypeInSlot == ttSuit ||
                        (TechTypeUtils.TryGetModTechType("NitrogenBrineSuit2", out TechType tt2) && techTypeInSlot == tt2) ||
                        (TechTypeUtils.TryGetModTechType("NitrogenBrineSuit3", out TechType tt3) && techTypeInSlot == tt3))
                    {
                        techTypeInSlot = TechType.ReinforcedDiveSuit;
                    }
                    else
                    {
                        bUseCustomTex = false;
                    }
                }
                else if (activeSlot == "Gloves")
                {
                    bChangeTex         = (techTypeInSlot != lastGlovesTechType);
                    lastGlovesTechType = techTypeInSlot;
                    if (techTypeInSlot == ttGloves)
                    {
                        techTypeInSlot = TechType.ReinforcedGloves;
                    }
                    else
                    {
                        bUseCustomTex = false;
                    }
                }
                //else
                //    continue;

                bool flag = false;
                if (bLog)
                {
                    Logger.Log(Logger.Level.Debug, $"checking equipmentModels for TechType {techTypeInSlot.AsString(false)}");
                }
                foreach (Player.EquipmentModel equipmentModel in equipmentType.equipment)
                {
                    //Player.EquipmentModel equipmentModel = equipmentType.equipment[j];
                    bool equipmentVisibility = (equipmentModel.techType == techTypeInSlot);
                    if (bChangeTex)
                    {
                        if (bLog)
                        {
                            Logger.Log(Logger.Level.Debug, "Equipment changed, changing textures");
                        }
                        if (bUseCustomTex)
                        {
                            if (shader == null)
                            {
                                if (bLog)
                                {
                                    Logger.Log(Logger.Level.Debug, $"Shader is null, custom texture disabled");
                                }
                                bUseCustomTex = false;
                            }
                            else if (activeSlot == "Gloves" && reinforcedGloves == null)
                            {
                                if (bLog)
                                {
                                    Logger.Log(Logger.Level.Debug, $"reinforcedGloves is null, custom texture disabled");
                                }
                                bUseCustomTex = false;
                            }
                            else if (activeSlot == "Body" && reinforcedSuit == null)
                            {
                                if (bLog)
                                {
                                    Logger.Log(Logger.Level.Debug, $"reinforcedSuit is null, custom texture disabled");
                                }
                                bUseCustomTex = false;
                            }
                        }
                    }

                    flag = (flag || equipmentVisibility);
                    if (equipmentModel.model != null)
                    {
                        if (bChangeTex)
                        {
                            if (bUseCustomTex)
                            {
                                // Apply the Brine Suit texture
                                if (activeSlot == "Gloves")
                                {
                                    // if the gloves shader isn't null, add the shader
                                    if (reinforcedGloves != null && // This shouldn't be necessary but I'm taking no chances
                                        reinforcedGloves.material != null)
                                    {
                                        if (brineGloveMaterial == null)
                                        {
                                            brineGloveMaterial = GetGloveMaterial(shader, defaultGloveMaterial);
                                        }

                                        if (brineGloveMaterial != null)
                                        {
                                            reinforcedGloves.material = brineGloveMaterial;
                                        }
                                        else
                                        {
                                            if (bLog)
                                            {
                                                Logger.Log(Logger.Level.Error, "Creation of new Brine glove material failed");
                                            }
                                        }
                                    }
                                }
                                else if (activeSlot == "Body")
                                {
                                    if (reinforcedSuit != null &&
                                        reinforcedSuit.material != null &&
                                        reinforcedSuit.material.shader != null)
                                    {
                                        if (brineArmsMaterial == null)
                                        {
                                            if (bLog)
                                            {
                                                Logger.Log(Logger.Level.Debug, "Creating new brineArmsMaterial");
                                            }
                                            if (defaultArmsMaterial != null)
                                            {
                                                brineArmsMaterial = GetGloveMaterial(null, defaultArmsMaterial);

                                                /*brineArmsMaterial = new Material(defaultArmsMaterial);
                                                 * // add the suit's arms main Texture when equipped
                                                 * //if (bLog) Logger.Log(Logger.Level.Debug, $"add the suit's arms main Texture when equipped");
                                                 * brineArmsMaterial.mainTexture = Main.glovesTexture;
                                                 * // add the suit's arms spec Texture when equipped
                                                 * //if (bLog) Logger.Log(Logger.Level.Debug, $"add the suit's arms spec Texture when equipped");
                                                 * brineArmsMaterial.SetTexture(ShaderPropertyID._SpecTex, Main.glovesTexture);
                                                 * // add the suit's arms illum texture when equipped
                                                 * //if (bLog) Logger.Log(Logger.Level.Debug, $"add the suit's arms illum texture when equipped");
                                                 * brineArmsMaterial.SetTexture(ShaderPropertyID._Illum, Main.glovesIllumTexture);*/
                                            }
                                            else
                                            if (bLog)
                                            {
                                                Logger.Log(Logger.Level.Error, "defaultArmsMaterial not set while trying to create new brineArmsMaterial");
                                            }
                                        }

                                        if (brineArmsMaterial != null)
                                        {
                                            if (bLog)
                                            {
                                                Logger.Log(Logger.Level.Debug, "Applying brineArmsMaterial");
                                            }
                                            reinforcedSuit.materials[1] = brineArmsMaterial;
                                        }
                                        else
                                        if (bLog)
                                        {
                                            Logger.Log(Logger.Level.Error, "Error generating brineArmsMaterial");
                                        }


                                        if (brineSuitMaterial == null)
                                        {
                                            if (bLog)
                                            {
                                                Logger.Log(Logger.Level.Debug, "Creating new brineSuitMaterial");
                                            }
                                            if (defaultSuitMaterial != null)
                                            {
                                                brineSuitMaterial = new Material(defaultSuitMaterial);

                                                brineSuitMaterial.shader      = shader;
                                                brineSuitMaterial.mainTexture = Main.suitTexture;
                                                // add the suit spec texture when equipped
                                                //if (bLog) Logger.Log(Logger.Level.Debug, $"add the suit spec texture when equipped");
                                                brineSuitMaterial.SetTexture(ShaderPropertyID._SpecTex, Main.suitTexture);
                                                // add  the suit illum Texture when equipped
                                                //if (bLog) Logger.Log(Logger.Level.Debug, $"add  the suit illum Texture when equipped");
                                                brineSuitMaterial.SetTexture(ShaderPropertyID._Illum, Main.suitIllumTexture);

                                                /*
                                                 * // add the suit's arms main Texture when equipped
                                                 * //if (bLog) Logger.Log(Logger.Level.Debug, $"add the suit's arms main Texture when equipped");
                                                 * reinforcedSuit.materials[1].mainTexture = Main.glovesTexture;
                                                 * // add the suit's arms spec Texture when equipped
                                                 * //if (bLog) Logger.Log(Logger.Level.Debug, $"add the suit's arms spec Texture when equipped");
                                                 * reinforcedSuit.materials[1].SetTexture(ShaderPropertyID._SpecTex, Main.glovesTexture);
                                                 * // add the suit's arms illum texture when equipped
                                                 * //if (bLog) Logger.Log(Logger.Level.Debug, $"add the suit's arms illum texture when equipped");
                                                 * reinforcedSuit.materials[1].SetTexture(ShaderPropertyID._Illum, Main.glovesIllumTexture);
                                                 */
                                            }
                                            else
                                            if (bLog)
                                            {
                                                Logger.Log(Logger.Level.Error, "defaultSuitMaterial not set while trying to create new brineSuitMaterial");
                                            }
                                        }

                                        if (brineSuitMaterial != null)
                                        {
                                            if (bLog)
                                            {
                                                Logger.Log(Logger.Level.Debug, "Applying brineSuitMaterial");
                                            }
                                            reinforcedSuit.material     = brineSuitMaterial;
                                            reinforcedSuit.materials[0] = brineSuitMaterial;
                                        }
                                        else
                                        if (bLog)
                                        {
                                            Logger.Log(Logger.Level.Error, "Creation of new Brine Suit material failed");
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (activeSlot == "Body")
                                {
                                    if (reinforcedSuit != null)
                                    {
                                        if (defaultSuitMaterial != null)
                                        {
                                            reinforcedSuit.material     = defaultSuitMaterial;
                                            reinforcedSuit.materials[0] = defaultSuitMaterial;
                                        }
                                        else
                                        if (bLog)
                                        {
                                            Logger.Log(Logger.Level.Error, "Could not restore default suit material; Default suit material not found");
                                        }

                                        if (defaultArmsMaterial != null)
                                        {
                                            reinforcedSuit.materials[1] = defaultArmsMaterial;
                                        }
                                        else
                                        if (bLog)
                                        {
                                            Logger.Log(Logger.Level.Error, "Could not restore default arms material; Default arms material not found");
                                        }
                                    }
                                }
                                else if (activeSlot == "Gloves")
                                {
                                    if (reinforcedGloves != null)
                                    {
                                        if (defaultGloveMaterial != null)
                                        {
                                            reinforcedGloves.material = defaultGloveMaterial;
                                        }
                                        else
                                        if (bLog)
                                        {
                                            Logger.Log(Logger.Level.Error, "Could not restore default glove material; Default glove material not found");
                                        }
                                    }
                                }
                            }
                        }

                        equipmentModel.model.SetActive(equipmentVisibility);
                    }
                }
                if (equipmentType.defaultModel != null)
                {
                    equipmentType.defaultModel.SetActive(!flag);
                }
            }

            // Actually we don't need this, since we're not doing anything that would change the outcome of UpdateReinforcedSuit.
            // Might be useful in the future though, so it's getting commented-out instead of deleted.

            /*MethodInfo dynMethod = __instance.GetType().GetMethod("UpdateReinforcedSuit", BindingFlags.NonPublic | BindingFlags.Instance);
             * dynMethod.Invoke(__instance, null);*/
        }
        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>());
                }
            }
        }
 public static TechType GetModTechType(string key)
 {
     return(TechTypeUtils.GetModTechType(key));
 }
 internal static void AddModTechType(TechType tech, GameObject prefab = null)
 {
     TechTypeUtils.AddModTechType(tech, prefab);
 }
        /*public static DWStorageConfigNonSML LoadConfig(string LoadPath)
         * {
         *      DWStorageConfigNonSML config = new DWStorageConfigNonSML();
         *
         *      if (FileUtils.FileExists(LoadPath))
         *      {
         *              using (var reader = new StreamReader(LoadPath))
         *              {
         *                      var serializer = new JsonSerializer();
         *                      config = serializer.Deserialize(reader, typeof(DWStorageConfigNonSML)) as DWStorageConfigNonSML;
         *              }
         *      }
         *      return config;
         * }*/


        public void Init()
        {
            bool bUpdated = false;

            if (StorageSizes == null || StorageSizes.Count < 1)
            {
                StorageSizes = new Dictionary <string, Vector2int>(defaultStorageSizes, System.StringComparer.OrdinalIgnoreCase);
                bUpdated     = true;
            }

            /*if (LifepodLockerSize.x < 1 || LifepodLockerSize.y < 1)
             * {
             *      LifepodLockerSize = defaultLifepodLockerSize;
             *      bUpdated = true;
             * }
             *
             * if (ExosuitConfig.IsNull())
             * {
             *      ExosuitConfig = defaultExosuitConfig;
             *      bUpdated = true;
             * }
             *
             * if (BioreactorSize.x < 1 || BioreactorSize.y < 1)
             * {
             *      BioreactorSize = defaultBioReactorSize;
             *      bUpdated = true;
             * }
             *
             * if (InventorySize.x < 1 || InventorySize.y < 1)
             * {
             *      InventorySize = defaultInventorySize;
             *      bUpdated = true;
             * }*/

            // defaultLifepodLockerInventory is empty by default, so we actually want to act if it's not.
            if (defaultLifepodLockerInventory.Count > 0)
            {
                defaultLifepodLockerInventoryTypes.Clear();                 // Doesn't hurt to be sure.
                foreach (string s in defaultLifepodLockerInventory)
                {
                    TechType tt = TechTypeUtils.GetTechType(s);
                    if (tt != TechType.None)
                    {
                        defaultLifepodLockerInventoryTypes.Add(tt);
                    }
                    else
                    {
                        Log.LogWarning($"Could not parse string '{s}' as TechType in defaultLifepodLockerInventory");
                    }
                }
            }

            // Likewise for defaultBlueprintsToUnlock
            if (defaultBlueprintsToUnlock.Count > 0)
            {
                unlockedBlueprints.Clear();
                foreach (string s in defaultBlueprintsToUnlock)
                {
                    TechType tt = TechTypeUtils.GetTechType(s);
                    if (tt != TechType.None)
                    {
                        if (unlockedBlueprints.TryGetValue(tt, out int c))
                        {
                            c++;
                            Log.LogWarning($"Entry {s} in defaultBlueprintsToUnlock appears more than once; entry has been found {c} times so far");
                            unlockedBlueprints[tt] = c;
                        }
                        else
                        {
                            SMLHelper.V2.Handlers.KnownTechHandler.UnlockOnStart(tt);
                            unlockedBlueprints[tt] = 1;
                        }
                    }
                    else
                    {
                        Log.LogWarning($"Could not parse string {s} as TechType in defaultBlueprintsToUnlock");
                    }
                }
            }

            if (bUpdated)
            {
                Save();
            }
#if !RELEASE
            Log.LogDebug(bUpdated ? "Some values reset to defaults" : "All values present and correct");
#endif
        }
 internal static GameObject GetModPrefab(string key)
 {
     return(TechTypeUtils.GetModPrefab(key));
 }
        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}");
        }