public static PLManeuverThruster CreateManeuverThruster(int Subtype, int level)
        {
            PLManeuverThruster InManeuverThruster;

            if (Subtype >= Instance.VanillaManeuverThrusterMaxType)
            {
                InManeuverThruster = new PLManeuverThruster(EManeuverThrusterType.E_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaManeuverThrusterMaxType;
                if (subtypeformodded <= Instance.ManeuverThrusterTypes.Count && subtypeformodded > -1)
                {
                    ManeuverThrusterMod ManeuverThrusterType = Instance.ManeuverThrusterTypes[Subtype - Instance.VanillaManeuverThrusterMaxType];
                    InManeuverThruster.SubType                 = Subtype;
                    InManeuverThruster.Name                    = ManeuverThrusterType.Name;
                    InManeuverThruster.Desc                    = ManeuverThrusterType.Description;
                    InManeuverThruster.m_IconTexture           = ManeuverThrusterType.IconTexture;
                    InManeuverThruster.m_MaxOutput             = ManeuverThrusterType.MaxOutput;
                    InManeuverThruster.m_BaseMaxPower          = ManeuverThrusterType.MaxPowerUsage_Watts;
                    InManeuverThruster.m_MarketPrice           = ManeuverThrusterType.MarketPrice;
                    InManeuverThruster.CargoVisualPrefabID     = ManeuverThrusterType.CargoVisualID;
                    InManeuverThruster.CanBeDroppedOnShipDeath = ManeuverThrusterType.CanBeDroppedOnShipDeath;
                    InManeuverThruster.Experimental            = ManeuverThrusterType.Experimental;
                    InManeuverThruster.Unstable                = ManeuverThrusterType.Unstable;
                    InManeuverThruster.Contraband              = ManeuverThrusterType.Contraband;
                    InManeuverThruster.UpdateMaxPowerWatts();
                    InManeuverThruster.Price_LevelMultiplierExponent = ManeuverThrusterType.Price_LevelMultiplierExponent;
                }
            }
            else
            {
                InManeuverThruster = new PLManeuverThruster((EManeuverThrusterType)Subtype, level);
            }
            return(InManeuverThruster);
        }
        static void Postfix(PLManeuverThruster __instance, ref string __result)
        {
            int subtypeformodded = __instance.SubType - ManeuverThrusterModManager.Instance.VanillaManeuverThrusterMaxType;

            if (subtypeformodded > -1 && subtypeformodded < ManeuverThrusterModManager.Instance.ManeuverThrusterTypes.Count && __instance.ShipStats != null)
            {
                __result = ManeuverThrusterModManager.Instance.ManeuverThrusterTypes[subtypeformodded].GetStatLineRight(__instance);
            }
        }
Exemplo n.º 3
0
        public static PLManeuverThruster CreateManeuverThruster(int Subtype, int level)
        {
            PLManeuverThruster InManeuverThruster;

            if (Subtype >= Instance.VanillaManeuverThrusterMaxType)
            {
                InManeuverThruster = new PLManeuverThruster(EManeuverThrusterType.E_MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaManeuverThrusterMaxType;
                if (Global.DebugLogging)
                {
                    Logger.Info($"Subtype for modded is {subtypeformodded}");
                }
                if (subtypeformodded <= Instance.ManeuverThrusterTypes.Count && subtypeformodded > -1)
                {
                    if (Global.DebugLogging)
                    {
                        Logger.Info("Creating ManeuverThruster from list info");
                    }
                    ManeuverThrusterPlugin ManeuverThrusterType = Instance.ManeuverThrusterTypes[Subtype - Instance.VanillaManeuverThrusterMaxType];
                    InManeuverThruster.SubType = Subtype;
                    InManeuverThruster.Name    = ManeuverThrusterType.Name;
                    InManeuverThruster.Desc    = ManeuverThrusterType.Description;
                    InManeuverThruster.GetType().GetField("m_IconTexture", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InManeuverThruster, ManeuverThrusterType.IconTexture);
                    InManeuverThruster.GetType().GetField("m_MaxOutput", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InManeuverThruster, ManeuverThrusterType.MaxOutput);
                    InManeuverThruster.GetType().GetField("m_MaxPowerUsage_Watts", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InManeuverThruster, ManeuverThrusterType.MaxPowerUsage_Watts);
                    InManeuverThruster.GetType().GetField("m_MarketPrice", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InManeuverThruster, (ObscuredInt)ManeuverThrusterType.MarketPrice);
                    InManeuverThruster.CargoVisualPrefabID     = ManeuverThrusterType.CargoVisualID;
                    InManeuverThruster.CanBeDroppedOnShipDeath = ManeuverThrusterType.CanBeDroppedOnShipDeath;
                    InManeuverThruster.Experimental            = ManeuverThrusterType.Experimental;
                    InManeuverThruster.Unstable   = ManeuverThrusterType.Unstable;
                    InManeuverThruster.Contraband = ManeuverThrusterType.Contraband;
                    InManeuverThruster.GetType().GetMethod("UpdateMaxPowerWatts", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(InManeuverThruster, new object[0]);
                    InManeuverThruster.GetType().GetField("Price_LevelMultiplierExponent", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InManeuverThruster, (ObscuredFloat)ManeuverThrusterType.Price_LevelMultiplierExponent);
                }
            }
            else
            {
                InManeuverThruster = new PLManeuverThruster((EManeuverThrusterType)Subtype, level);
            }
            return(InManeuverThruster);
        }
Exemplo n.º 4
0
        public override string GetStatLineRight(PLShipComponent InComp)
        {
            PLManeuverThruster me = InComp as PLManeuverThruster;

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