Example #1
0
        public static PLInertiaThruster CreateInertiaThruster(int Subtype, int level)
        {
            PLInertiaThruster InInertiaThruster;

            if (Subtype >= Instance.VanillaInertiaThrusterMaxType)
            {
                InInertiaThruster = new PLInertiaThruster(EInertiaThrusterType.E_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaInertiaThrusterMaxType;
                if (subtypeformodded <= Instance.InertiaThrusterTypes.Count && subtypeformodded > -1)
                {
                    InertiaThrusterMod InertiaThrusterType = Instance.InertiaThrusterTypes[Subtype - Instance.VanillaInertiaThrusterMaxType];
                    InInertiaThruster.SubType                 = Subtype;
                    InInertiaThruster.Name                    = InertiaThrusterType.Name;
                    InInertiaThruster.Desc                    = InertiaThrusterType.Description;
                    InInertiaThruster.m_IconTexture           = InertiaThrusterType.IconTexture;
                    InInertiaThruster.m_MaxOutput             = InertiaThrusterType.MaxOutput;
                    InInertiaThruster.m_BaseMaxPower          = InertiaThrusterType.MaxPowerUsage_Watts;
                    InInertiaThruster.m_MarketPrice           = InertiaThrusterType.MarketPrice;
                    InInertiaThruster.CargoVisualPrefabID     = InertiaThrusterType.CargoVisualID;
                    InInertiaThruster.CanBeDroppedOnShipDeath = InertiaThrusterType.CanBeDroppedOnShipDeath;
                    InInertiaThruster.Experimental            = InertiaThrusterType.Experimental;
                    InInertiaThruster.Unstable                = InertiaThrusterType.Unstable;
                    InInertiaThruster.Contraband              = InertiaThrusterType.Contraband;
                    InInertiaThruster.UpdateMaxPowerWatts();
                    InInertiaThruster.Price_LevelMultiplierExponent = InertiaThrusterType.Price_LevelMultiplierExponent;
                }
            }
            else
            {
                InInertiaThruster = new PLInertiaThruster((EInertiaThrusterType)Subtype, level);
            }
            return(InInertiaThruster);
        }
Example #2
0
 InertiaThrusterModManager()
 {
     VanillaInertiaThrusterMaxType = Enum.GetValues(typeof(EInertiaThrusterType)).Length;
     Logger.Info($"MaxTypeint = {VanillaInertiaThrusterMaxType - 1}");
     foreach (PulsarMod mod in ModManager.Instance.GetAllMods())
     {
         Assembly asm = mod.GetType().Assembly;
         Type     InertiaThrusterMod = typeof(InertiaThrusterMod);
         foreach (Type t in asm.GetTypes())
         {
             if (InertiaThrusterMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
             {
                 Logger.Info("Loading InertiaThruster from assembly");
                 InertiaThrusterMod InertiaThrusterModHandler = (InertiaThrusterMod)Activator.CreateInstance(t);
                 if (GetInertiaThrusterIDFromName(InertiaThrusterModHandler.Name) == -1)
                 {
                     InertiaThrusterTypes.Add(InertiaThrusterModHandler);
                     Logger.Info($"Added InertiaThruster: '{InertiaThrusterModHandler.Name}' with ID '{GetInertiaThrusterIDFromName(InertiaThrusterModHandler.Name)}'");
                 }
                 else
                 {
                     Logger.Info($"Could not add InertiaThruster from {mod.Name} with the duplicate name of '{InertiaThrusterModHandler.Name}'");
                 }
             }
         }
     }
 }