WarpDriveProgramModManager()
 {
     VanillaWarpDriveProgramMaxType = Enum.GetValues(typeof(EWarpDriveProgramType)).Length;
     Logger.Info($"MaxTypeint = {VanillaWarpDriveProgramMaxType - 1}");
     foreach (PulsarMod mod in ModManager.Instance.GetAllMods())
     {
         Assembly asm = mod.GetType().Assembly;
         Type     WarpDriveProgramMod = typeof(WarpDriveProgramMod);
         foreach (Type t in asm.GetTypes())
         {
             if (WarpDriveProgramMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
             {
                 Logger.Info("Loading WarpDriveProgram from assembly");
                 WarpDriveProgramMod WarpDriveProgramModHandler = (WarpDriveProgramMod)Activator.CreateInstance(t);
                 if (GetWarpDriveProgramIDFromName(WarpDriveProgramModHandler.Name) == -1)
                 {
                     WarpDriveProgramTypes.Add(WarpDriveProgramModHandler);
                     Logger.Info($"Added WarpDriveProgram: '{WarpDriveProgramModHandler.Name}' with ID '{GetWarpDriveProgramIDFromName(WarpDriveProgramModHandler.Name)}'");
                 }
                 else
                 {
                     Logger.Info($"Could not add WarpDriveProgram from {mod.Name} with the duplicate name of '{WarpDriveProgramModHandler.Name}'");
                 }
             }
         }
     }
 }
 FBRecipeModuleModManager()
 {
     VanillaFBRecipeModuleMaxType = Enum.GetValues(typeof(FBRecipe)).Length;
     Logger.Info($"MaxTypeint = {VanillaFBRecipeModuleMaxType - 1}");
     foreach (PulsarMod mod in ModManager.Instance.GetAllMods())
     {
         Assembly asm = mod.GetType().Assembly;
         Type     FBRecipeModuleMod = typeof(FBRecipeModuleMod);
         foreach (Type t in asm.GetTypes())
         {
             if (FBRecipeModuleMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
             {
                 Logger.Info("Loading FBRecipeModule from assembly");
                 FBRecipeModuleMod FBRecipeModuleModHandler = (FBRecipeModuleMod)Activator.CreateInstance(t);
                 if (FBRecipeModuleModHandler.ItemTypeToProduce.Length < 2)
                 {
                     Logger.Info($"FBRecipeModule '{FBRecipeModuleModHandler.Name}' from {mod.Name} does not have enough objects in the ItemTypeToProduce field, must have 2.");
                     continue;
                 }
                 if (GetFBRecipeModuleIDFromName(FBRecipeModuleModHandler.Name) == -1)
                 {
                     FBRecipeModuleTypes.Add(FBRecipeModuleModHandler);
                     Logger.Info($"Added FBRecipeModule: '{FBRecipeModuleModHandler.Name}' with ID '{GetFBRecipeModuleIDFromName(FBRecipeModuleModHandler.Name)}'");
                 }
                 else
                 {
                     Logger.Info($"Could not add FBRecipeModule from {mod.Name} with the duplicate name of '{FBRecipeModuleModHandler.Name}'");
                 }
             }
         }
     }
 }
Beispiel #3
0
 ShieldModManager()
 {
     VanillaShieldMaxType = Enum.GetValues(typeof(EShieldGeneratorType)).Length;
     Logger.Info($"MaxTypeint = {VanillaShieldMaxType - 1}");
     foreach (PulsarMod mod in ModManager.Instance.GetAllMods())
     {
         Assembly asm       = mod.GetType().Assembly;
         Type     ShieldMod = typeof(ShieldMod);
         foreach (Type t in asm.GetTypes())
         {
             if (ShieldMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
             {
                 Logger.Info("Loading Shield from assembly");
                 ShieldMod ShieldModHandler = (ShieldMod)Activator.CreateInstance(t);
                 if (GetShieldIDFromName(ShieldModHandler.Name) == -1)
                 {
                     ShieldTypes.Add(ShieldModHandler);
                     Logger.Info($"Added Shield: '{ShieldModHandler.Name}' with ID '{GetShieldIDFromName(ShieldModHandler.Name)}'");
                 }
                 else
                 {
                     Logger.Info($"Could not add Shield from {mod.Name} with the duplicate name of '{ShieldModHandler.Name}'");
                 }
             }
         }
     }
 }
        public static PLFBRecipeModule CreateFBRecipeModule(int Subtype, int level)
        {
            PLFBRecipeModule InFBRecipeModule;

            if (Subtype >= Instance.VanillaFBRecipeModuleMaxType)
            {
                InFBRecipeModule = new PLFBRecipeModule(FBRecipe.E_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaFBRecipeModuleMaxType;
                Logger.Info($"Subtype for modded is {subtypeformodded}");
                if (subtypeformodded <= Instance.FBRecipeModuleTypes.Count && subtypeformodded > -1)
                {
                    Logger.Info("Creating FBModule from list info");
                    FBRecipeModuleMod FBRecipeModuleType = Instance.FBRecipeModuleTypes[Subtype - Instance.VanillaFBRecipeModuleMaxType];
                    InFBRecipeModule.SubType                        = Subtype;
                    InFBRecipeModule.Name                           = FBRecipeModuleType.Name;
                    InFBRecipeModule.Desc                           = FBRecipeModuleType.Description;
                    InFBRecipeModule.m_IconTexture                  = FBRecipeModuleType.IconTexture;
                    InFBRecipeModule.m_MarketPrice                  = FBRecipeModuleType.MarketPrice;
                    InFBRecipeModule.CargoVisualPrefabID            = FBRecipeModuleType.CargoVisualID;
                    InFBRecipeModule.CanBeDroppedOnShipDeath        = FBRecipeModuleType.CanBeDroppedOnShipDeath;
                    InFBRecipeModule.Experimental                   = FBRecipeModuleType.Experimental;
                    InFBRecipeModule.Unstable                       = FBRecipeModuleType.Unstable;
                    InFBRecipeModule.Contraband                     = FBRecipeModuleType.Contraband;
                    InFBRecipeModule.Price_LevelMultiplierExponent  = FBRecipeModuleType.Price_LevelMultiplierExponent;
                    InFBRecipeModule.CookDurationMs                 = FBRecipeModuleType.CookDurationMs;
                    InFBRecipeModule.CookedTimingOffsetMidpoint     = FBRecipeModuleType.CookedTimingOffsetMidpoint;
                    InFBRecipeModule.PerfectlyCookedMaxTimingOffset = FBRecipeModuleType.PerfectlyCookedMaxTimingOffset;
                    InFBRecipeModule.CookedMaxTimingOffset          = FBRecipeModuleType.CookedMaxTimingOffset;
                    InFBRecipeModule.FoodSupplyCost                 = FBRecipeModuleType.FoodSupplyCost;
                    InFBRecipeModule.BiscuitTypeToProduce           = EFoodType.MAX;
                    InFBRecipeModule.IconResourcePath               = string.Empty;
                }
            }
            else
            {
                InFBRecipeModule = new PLFBRecipeModule((FBRecipe)Subtype, level);
            }
            return(InFBRecipeModule);
        }