Ejemplo n.º 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);
        }
        static void Postfix(PLInertiaThruster __instance)
        {
            int subtypeformodded = __instance.SubType - ManeuverThrusterModManager.Instance.VanillaManeuverThrusterMaxType;

            if (subtypeformodded > -1 && subtypeformodded < ManeuverThrusterModManager.Instance.ManeuverThrusterTypes.Count && __instance.ShipStats != null)
            {
                ManeuverThrusterModManager.Instance.ManeuverThrusterTypes[subtypeformodded].Tick(__instance);
            }
        }
Ejemplo n.º 3
0
        static void Postfix(PLInertiaThruster __instance, ref string __result)
        {
            int subtypeformodded = __instance.SubType - InertiaThrusterModManager.Instance.VanillaInertiaThrusterMaxType;

            if (subtypeformodded > -1 && subtypeformodded < InertiaThrusterModManager.Instance.InertiaThrusterTypes.Count && __instance.ShipStats != null)
            {
                __result = InertiaThrusterModManager.Instance.InertiaThrusterTypes[subtypeformodded].GetStatLineRight(__instance);
            }
        }
Ejemplo n.º 4
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 (Global.DebugLogging)
                {
                    Logger.Info($"Subtype for modded is {subtypeformodded}");
                }
                if (subtypeformodded <= Instance.InertiaThrusterTypes.Count && subtypeformodded > -1)
                {
                    if (Global.DebugLogging)
                    {
                        Logger.Info("Creating InertiaThruster from list info");
                    }
                    InertiaThrusterPlugin InertiaThrusterType = Instance.InertiaThrusterTypes[Subtype - Instance.VanillaInertiaThrusterMaxType];
                    InInertiaThruster.SubType = Subtype;
                    InInertiaThruster.Name    = InertiaThrusterType.Name;
                    InInertiaThruster.Desc    = InertiaThrusterType.Description;
                    InInertiaThruster.GetType().GetField("m_IconTexture", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InInertiaThruster, InertiaThrusterType.IconTexture);
                    InInertiaThruster.GetType().GetField("m_MaxOutput", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InInertiaThruster, InertiaThrusterType.MaxOutput);
                    InInertiaThruster.GetType().GetField("m_MaxPowerUsage_Watts", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InInertiaThruster, InertiaThrusterType.MaxPowerUsage_Watts);
                    InInertiaThruster.GetType().GetField("m_MarketPrice", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InInertiaThruster, (ObscuredInt)InertiaThrusterType.MarketPrice);
                    InInertiaThruster.CargoVisualPrefabID     = InertiaThrusterType.CargoVisualID;
                    InInertiaThruster.CanBeDroppedOnShipDeath = InertiaThrusterType.CanBeDroppedOnShipDeath;
                    InInertiaThruster.Experimental            = InertiaThrusterType.Experimental;
                    InInertiaThruster.Unstable   = InertiaThrusterType.Unstable;
                    InInertiaThruster.Contraband = InertiaThrusterType.Contraband;
                    InInertiaThruster.GetType().GetMethod("UpdateMaxPowerWatts", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(InInertiaThruster, new object[0]);
                    InInertiaThruster.GetType().GetField("Price_LevelMultiplierExponent", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InInertiaThruster, (ObscuredFloat)InertiaThrusterType.Price_LevelMultiplierExponent);
                }
            }
            else
            {
                InInertiaThruster = new PLInertiaThruster((EInertiaThrusterType)Subtype, level);
            }
            return(InInertiaThruster);
        }
        public override string GetStatLineRight(PLShipComponent InComp)
        {
            PLInertiaThruster me = InComp as PLInertiaThruster;

            return(((float)me.m_MaxOutput * me.LevelMultiplier(0.18f, 1f) * 100f).ToString("0") + "\n");
        }