Beispiel #1
0
        public static PLVirus CreateVirus(int Subtype, int level)
        {
            PLVirus InVirus;

            if (Subtype >= Instance.VanillaVirusMaxType)
            {
                InVirus = new PLVirus(EVirusType.NONE, level);
                int subtypeformodded = Subtype - Instance.VanillaVirusMaxType;
                if (subtypeformodded <= Instance.VirusTypes.Count && subtypeformodded > -1)
                {
                    VirusMod VirusType = Instance.VirusTypes[Subtype - Instance.VanillaVirusMaxType];
                    InVirus.SubType                       = Subtype;
                    InVirus.Name                          = VirusType.Name;
                    InVirus.Desc                          = VirusType.Description;
                    InVirus.m_IconTexture                 = VirusType.IconTexture;
                    InVirus.m_MarketPrice                 = VirusType.MarketPrice;
                    InVirus.CargoVisualPrefabID           = VirusType.CargoVisualID;
                    InVirus.CanBeDroppedOnShipDeath       = VirusType.CanBeDroppedOnShipDeath;
                    InVirus.Experimental                  = VirusType.Experimental;
                    InVirus.Unstable                      = VirusType.Unstable;
                    InVirus.Contraband                    = VirusType.Contraband;
                    InVirus.InfectionTimeLimitMs          = VirusType.InfectionTimeLimitMs;
                    InVirus.Price_LevelMultiplierExponent = VirusType.Price_LevelMultiplierExponent;
                }
            }
            else
            {
                InVirus = new PLVirus((EVirusType)Subtype, level);
            }
            return(InVirus);
        }
Beispiel #2
0
 VirusModManager()
 {
     VanillaVirusMaxType = Enum.GetValues(typeof(EVirusType)).Length - 1;
     Logger.Info($"MaxTypeint = {VanillaVirusMaxType - 1}");
     foreach (PulsarMod mod in ModManager.Instance.GetAllMods())
     {
         Assembly asm      = mod.GetType().Assembly;
         Type     VirusMod = typeof(VirusMod);
         foreach (Type t in asm.GetTypes())
         {
             if (VirusMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
             {
                 Logger.Info("Loading Virus from assembly");
                 VirusMod VirusModHandler = (VirusMod)Activator.CreateInstance(t);
                 if (GetVirusIDFromName(VirusModHandler.Name) == -1)
                 {
                     VirusTypes.Add(VirusModHandler);
                     Logger.Info($"Added Virus: '{VirusModHandler.Name}' with ID '{GetVirusIDFromName(VirusModHandler.Name)}'");
                 }
                 else
                 {
                     Logger.Info($"Could not add Virus from {mod.Name} with the duplicate name of '{VirusModHandler.Name}'");
                 }
             }
         }
     }
 }