示例#1
0
 ReactorModManager()
 {
     VanillaReactorMaxType = Enum.GetValues(typeof(EReactorType)).Length;
     Logger.Info($"MaxTypeint = {VanillaReactorMaxType - 1}");
     foreach (PulsarMod mod in ModManager.Instance.GetAllMods())
     {
         Assembly asm        = mod.GetType().Assembly;
         Type     ReactorMod = typeof(ReactorMod);
         foreach (Type t in asm.GetTypes())
         {
             if (ReactorMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
             {
                 Logger.Info("Loading reactor from assembly");
                 ReactorMod ReactorModHandler = (ReactorMod)Activator.CreateInstance(t);
                 if (GetReactorIDFromName(ReactorModHandler.Name) == -1)
                 {
                     ReactorTypes.Add(ReactorModHandler);
                     Logger.Info($"Added reactor: '{ReactorModHandler.Name}' with ID '{GetReactorIDFromName(ReactorModHandler.Name)}'");
                 }
                 else
                 {
                     Logger.Info($"Could not add reactor from {mod.Name} with the duplicate name of '{ReactorModHandler.Name}'");
                 }
             }
         }
     }
 }
示例#2
0
        public static PLReactor CreateReactor(int Subtype, int level)
        {
            PLReactor InReactor;

            if (Subtype >= Instance.VanillaReactorMaxType)
            {
                InReactor = new PLReactor(EReactorType.E_REAC_ID_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaReactorMaxType;
                if (subtypeformodded <= Instance.ReactorTypes.Count && subtypeformodded > -1)
                {
                    ReactorMod ReactorType = Instance.ReactorTypes[Subtype - Instance.VanillaReactorMaxType];
                    InReactor.SubType                       = Subtype;
                    InReactor.Name                          = ReactorType.Name;
                    InReactor.Desc                          = ReactorType.Description;
                    InReactor.m_IconTexture                 = ReactorType.IconTexture;
                    InReactor.EnergyOutputMax               = ReactorType.EnergyOutputMax;
                    InReactor.EnergySignatureAmt            = ReactorType.EnergySignatureAmount;
                    InReactor.TempMax                       = ReactorType.MaxTemp;
                    InReactor.EmergencyCooldownTime         = ReactorType.EmergencyCooldownTime;
                    InReactor.HeatOutput                    = ReactorType.HeatOutput;
                    InReactor.m_MarketPrice                 = ReactorType.MarketPrice;
                    InReactor.CargoVisualPrefabID           = ReactorType.CargoVisualID;
                    InReactor.CanBeDroppedOnShipDeath       = ReactorType.CanBeDroppedOnShipDeath;
                    InReactor.Experimental                  = ReactorType.Experimental;
                    InReactor.Unstable                      = ReactorType.Unstable;
                    InReactor.Contraband                    = ReactorType.Contraband;
                    InReactor.OriginalEnergyOutputMax       = InReactor.EnergyOutputMax;
                    InReactor.Price_LevelMultiplierExponent = ReactorType.Price_LevelMultiplierExponent;
                }
            }
            else
            {
                InReactor = new PLReactor((EReactorType)Subtype, level);
            }
            return(InReactor);
        }