Esempio n. 1
0
        public static PLThruster CreateThruster(int Subtype, int level)
        {
            PLThruster InThruster;

            if (Subtype >= Instance.VanillaThrusterMaxType)
            {
                InThruster = new PLThruster(EThrusterType.MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaThrusterMaxType;
                if (subtypeformodded <= Instance.ThrusterTypes.Count && subtypeformodded > -1)
                {
                    ThrusterMod ThrusterType = Instance.ThrusterTypes[Subtype - Instance.VanillaThrusterMaxType];
                    InThruster.SubType                 = Subtype;
                    InThruster.Name                    = ThrusterType.Name;
                    InThruster.Desc                    = ThrusterType.Description;
                    InThruster.m_IconTexture           = ThrusterType.IconTexture;
                    InThruster.m_MaxOutput             = ThrusterType.MaxOutput;
                    InThruster.m_BaseMaxPower          = ThrusterType.MaxPowerUsage_Watts;
                    InThruster.m_MarketPrice           = ThrusterType.MarketPrice;
                    InThruster.CargoVisualPrefabID     = ThrusterType.CargoVisualID;
                    InThruster.CanBeDroppedOnShipDeath = ThrusterType.CanBeDroppedOnShipDeath;
                    InThruster.Experimental            = ThrusterType.Experimental;
                    InThruster.Unstable                = ThrusterType.Unstable;
                    InThruster.Contraband              = ThrusterType.Contraband;
                    InThruster.UpdateMaxPowerWatts();
                    InThruster.Price_LevelMultiplierExponent = ThrusterType.Price_LevelMultiplierExponent;
                }
            }
            else
            {
                InThruster = new PLThruster((EThrusterType)Subtype, level);
            }
            return(InThruster);
        }
Esempio n. 2
0
        static void Postfix(PLThruster __instance)
        {
            int subtypeformodded = __instance.SubType - ThrusterModManager.Instance.VanillaThrusterMaxType;

            if (subtypeformodded > -1 && subtypeformodded < ThrusterModManager.Instance.ThrusterTypes.Count && __instance.ShipStats != null)
            {
                ThrusterModManager.Instance.ThrusterTypes[subtypeformodded].Tick(__instance);
            }
        }
Esempio n. 3
0
        static void Postfix(PLThruster __instance, ref string __result)
        {
            int subtypeformodded = __instance.SubType - ThrusterModManager.Instance.VanillaThrusterMaxType;

            if (subtypeformodded > -1 && subtypeformodded < ThrusterModManager.Instance.ThrusterTypes.Count && __instance.ShipStats != null)
            {
                __result = ThrusterModManager.Instance.ThrusterTypes[subtypeformodded].GetStatLineRight(__instance);
            }
        }
        public static PLThruster CreateThruster(int Subtype, int level)
        {
            PLThruster InThruster;

            if (Subtype >= Instance.VanillaThrusterMaxType)
            {
                InThruster = new PLThruster(EThrusterType.MAX, level);
                int subtypeformodded = Subtype - Instance.VanillaThrusterMaxType;
                if (Global.DebugLogging)
                {
                    Logger.Info($"Subtype for modded is {subtypeformodded}");
                }
                if (subtypeformodded <= Instance.ThrusterTypes.Count && subtypeformodded > -1)
                {
                    if (Global.DebugLogging)
                    {
                        Logger.Info("Creating Thruster from list info");
                    }
                    ThrusterPlugin ThrusterType = Instance.ThrusterTypes[Subtype - Instance.VanillaThrusterMaxType];
                    InThruster.SubType = Subtype;
                    InThruster.Name    = ThrusterType.Name;
                    InThruster.Desc    = ThrusterType.Description;
                    InThruster.GetType().GetField("m_IconTexture", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InThruster, ThrusterType.IconTexture);
                    InThruster.GetType().GetField("m_MaxOutput", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InThruster, ThrusterType.MaxOutput);
                    InThruster.GetType().GetField("m_MaxPowerUsage_Watts", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InThruster, ThrusterType.MaxPowerUsage_Watts);
                    InThruster.GetType().GetField("m_MarketPrice", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InThruster, (ObscuredInt)ThrusterType.MarketPrice);
                    InThruster.CargoVisualPrefabID     = ThrusterType.CargoVisualID;
                    InThruster.CanBeDroppedOnShipDeath = ThrusterType.CanBeDroppedOnShipDeath;
                    InThruster.Experimental            = ThrusterType.Experimental;
                    InThruster.Unstable   = ThrusterType.Unstable;
                    InThruster.Contraband = ThrusterType.Contraband;
                    InThruster.GetType().GetMethod("UpdateMaxPowerWatts", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(InThruster, new object[0]);
                    InThruster.GetType().GetField("Price_LevelMultiplierExponent", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InThruster, (ObscuredFloat)ThrusterType.Price_LevelMultiplierExponent);
                }
            }
            else
            {
                InThruster = new PLThruster((EThrusterType)Subtype, level);
            }
            return(InThruster);
        }
        public override string GetStatLineRight(PLShipComponent InComp)
        {
            PLThruster me = InComp as PLThruster;

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