Esempio n. 1
0
        public static PLWarpDrive CreateWarpDrive(int Subtype, int level)
        {
            PLWarpDrive InWarpDrive;

            if (Subtype >= Instance.VanillaWarpDriveMaxType)
            {
                InWarpDrive = new PLWarpDrive(EWarpDriveType.E_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaWarpDriveMaxType;
                if (subtypeformodded <= Instance.WarpDriveTypes.Count && subtypeformodded > -1)
                {
                    WarpDriveMod WarpDriveType = Instance.WarpDriveTypes[Subtype - Instance.VanillaWarpDriveMaxType];
                    InWarpDrive.SubType                       = Subtype;
                    InWarpDrive.Name                          = WarpDriveType.Name;
                    InWarpDrive.Desc                          = WarpDriveType.Description;
                    InWarpDrive.m_IconTexture                 = WarpDriveType.IconTexture;
                    InWarpDrive.ChargeSpeed                   = WarpDriveType.ChargeSpeed;
                    InWarpDrive.WarpRange                     = WarpDriveType.WarpRange;
                    InWarpDrive.EnergySignatureAmt            = WarpDriveType.EnergySignature;
                    InWarpDrive.NumberOfChargingNodes         = WarpDriveType.NumberOfChargesPerFuel;
                    InWarpDrive.m_MaxPowerUsage_Watts         = WarpDriveType.MaxPowerUsage_Watts;
                    InWarpDrive.m_MarketPrice                 = WarpDriveType.MarketPrice;
                    InWarpDrive.CargoVisualPrefabID           = WarpDriveType.CargoVisualID;
                    InWarpDrive.CanBeDroppedOnShipDeath       = WarpDriveType.CanBeDroppedOnShipDeath;
                    InWarpDrive.Experimental                  = WarpDriveType.Experimental;
                    InWarpDrive.Unstable                      = WarpDriveType.Unstable;
                    InWarpDrive.Contraband                    = WarpDriveType.Contraband;
                    InWarpDrive.Price_LevelMultiplierExponent = WarpDriveType.Price_LevelMultiplierExponent;
                }
            }
            else
            {
                InWarpDrive = new PLWarpDrive((EWarpDriveType)Subtype, level);
            }
            return(InWarpDrive);
        }
Esempio n. 2
0
 WarpDriveModManager()
 {
     VanillaWarpDriveMaxType = Enum.GetValues(typeof(EWarpDriveType)).Length;
     Logger.Info($"MaxTypeint = {VanillaWarpDriveMaxType - 1}");
     foreach (PulsarMod mod in ModManager.Instance.GetAllMods())
     {
         Assembly asm          = mod.GetType().Assembly;
         Type     WarpDriveMod = typeof(WarpDriveMod);
         foreach (Type t in asm.GetTypes())
         {
             if (WarpDriveMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
             {
                 Logger.Info("Loading WarpDrive from assembly");
                 WarpDriveMod WarpDriveModHandler = (WarpDriveMod)Activator.CreateInstance(t);
                 if (GetWarpDriveIDFromName(WarpDriveModHandler.Name) == -1)
                 {
                     WarpDriveTypes.Add(WarpDriveModHandler);
                     Logger.Info($"Added WarpDrive: '{WarpDriveModHandler.Name}' with ID '{GetWarpDriveIDFromName(WarpDriveModHandler.Name)}'");
                 }
                 else
                 {
                     Logger.Info($"Could not add WarpDrive from {mod.Name} with the duplicate name of '{WarpDriveModHandler.Name}'");
                 }
             }
         }
     }
 }