Beispiel #1
0
 NuclearDeviceModManager()
 {
     VanillaNuclearDeviceMaxType = Enum.GetValues(typeof(ENuclearDeviceType)).Length;
     Logger.Info($"MaxTypeint = {VanillaNuclearDeviceMaxType - 1}");
     foreach (PulsarMod mod in ModManager.Instance.GetAllMods())
     {
         Assembly asm = mod.GetType().Assembly;
         Type     NuclearDeviceMod = typeof(NuclearDeviceMod);
         foreach (Type t in asm.GetTypes())
         {
             if (NuclearDeviceMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
             {
                 Logger.Info("Loading NuclearDevice from assembly");
                 NuclearDeviceMod NuclearDeviceModHandler = (NuclearDeviceMod)Activator.CreateInstance(t);
                 if (GetNuclearDeviceIDFromName(NuclearDeviceModHandler.Name) == -1)
                 {
                     NuclearDeviceTypes.Add(NuclearDeviceModHandler);
                     Logger.Info($"Added NuclearDevice: '{NuclearDeviceModHandler.Name}' with ID '{GetNuclearDeviceIDFromName(NuclearDeviceModHandler.Name)}'");
                 }
                 else
                 {
                     Logger.Info($"Could not add NuclearDevice from {mod.Name} with the duplicate name of '{NuclearDeviceModHandler.Name}'");
                 }
             }
         }
     }
 }
Beispiel #2
0
        public static PLNuclearDevice CreateNuclearDevice(int Subtype, int level)
        {
            PLNuclearDevice InNuclearDevice;

            if (Subtype >= Instance.VanillaNuclearDeviceMaxType)
            {
                InNuclearDevice = new PLNuclearDevice(ENuclearDeviceType.MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaNuclearDeviceMaxType;
                if (subtypeformodded <= Instance.NuclearDeviceTypes.Count && subtypeformodded > -1)
                {
                    NuclearDeviceMod NuclearDeviceType = Instance.NuclearDeviceTypes[Subtype - Instance.VanillaNuclearDeviceMaxType];
                    InNuclearDevice.SubType                       = Subtype;
                    InNuclearDevice.Name                          = NuclearDeviceType.Name;
                    InNuclearDevice.Desc                          = NuclearDeviceType.Description;
                    InNuclearDevice.m_IconTexture                 = NuclearDeviceType.IconTexture;
                    InNuclearDevice.m_MaxDamage                   = NuclearDeviceType.MaxDamage;
                    InNuclearDevice.m_Range                       = NuclearDeviceType.Range;
                    InNuclearDevice.m_FuelBurnRate                = NuclearDeviceType.FuelBurnRate;
                    InNuclearDevice.m_TurnRate                    = NuclearDeviceType.TurnRate;
                    InNuclearDevice.m_IntimidationBonus           = NuclearDeviceType.IntimidationBonus;
                    InNuclearDevice.m_TurnRate                    = NuclearDeviceType.TurnRate;
                    InNuclearDevice.m_Health                      = NuclearDeviceType.Health;
                    InNuclearDevice.m_MarketPrice                 = NuclearDeviceType.MarketPrice;
                    InNuclearDevice.CargoVisualPrefabID           = NuclearDeviceType.CargoVisualID;
                    InNuclearDevice.CanBeDroppedOnShipDeath       = NuclearDeviceType.CanBeDroppedOnShipDeath;
                    InNuclearDevice.Experimental                  = NuclearDeviceType.Experimental;
                    InNuclearDevice.Unstable                      = NuclearDeviceType.Unstable;
                    InNuclearDevice.Contraband                    = NuclearDeviceType.Contraband;
                    InNuclearDevice.Price_LevelMultiplierExponent = NuclearDeviceType.Price_LevelMultiplierExponent;
                }
            }
            else
            {
                InNuclearDevice = new PLNuclearDevice((ENuclearDeviceType)Subtype, level);
            }
            return(InNuclearDevice);
        }