internal static void PostSeatruckStart(ref SeaTruckMotor __instance)
        {
            QuickLogger.Debug(nameof(PostSeatruckStart));
            VehicleUpgrader vehicleUpgrader = __instance.gameObject.EnsureComponent <VehicleUpgrader>();

            vehicleUpgrader.Initialize(ref __instance);
        }
        internal static void PreExosuitAwake(ref Exosuit __instance)
        {
            QuickLogger.Debug(nameof(PreExosuitAwake));
            VehicleUpgrader vehicleUpgrader = __instance.gameObject.EnsureComponent <VehicleUpgrader>();

            vehicleUpgrader.Initialize(ref __instance);
        }
Example #3
0
        public static void Patch()
        {
            try
            {
                QuickLogger.Message("Started patching - " + QuickLogger.GetAssemblyVersion());

                if (TechTypeHandler.TryGetModdedTechType("SeamothHullModule4", out TechType vehicleHullModule4) &&
                    TechTypeHandler.TryGetModdedTechType("SeamothHullModule5", out TechType vehicleHullModule5))
                {
                    VehicleUpgrader.SetModdedDepthModules(vehicleHullModule4, vehicleHullModule5);
                }

                SpeedBooster speedModule = SpeedBooster.Main;
                speedModule.Patch();

                VehicleUpgrader.SetSpeedBooster(speedModule);

                var harmony = HarmonyInstance.Create("com.upgradedvehicles.psmod");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Message("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error("EXCEPTION on Patch: " + ex.ToString());
            }
        }
        internal static void Prefix(ref Exosuit __instance)
        {
            QuickLogger.Debug("Exosuit_Start_Patcher");
            VehicleUpgrader vehicleUpgrader = __instance.gameObject.EnsureComponent <VehicleUpgrader>();

            vehicleUpgrader.Initialize(ref __instance);
        }
Example #5
0
        internal static void Prefix(ref SeaMoth __instance)
        {
            QuickLogger.Debug(nameof(SeaMoth_Awake_Patcher));
            VehicleUpgrader vehicleUpgrader = __instance.gameObject.EnsureComponent <VehicleUpgrader>();

            vehicleUpgrader.Initialize(ref __instance);
        }
Example #6
0
        private static void HandleConfigOptions()
        {
            configOptions = new UpgradeOptions();
            configOptions.Initialize();

            VehicleUpgrader.SetBonusSpeedMultipliers(configOptions.SeamothBonusSpeedMultiplier, configOptions.ExosuitBonusSpeedMultiplier);
        }
Example #7
0
 private static void HandleCrossModUpdates()
 {
     if (TechTypeHandler.TryGetModdedTechType("SeamothHullModule4", out TechType vehicleHullModule4) &&
         TechTypeHandler.TryGetModdedTechType("SeamothHullModule5", out TechType vehicleHullModule5))
     {
         VehicleUpgrader.SetModdedDepthModules(vehicleHullModule4, vehicleHullModule5);
     }
 }
        public static void CrossModUpdates()
        {
            QuickLogger.Info("Checking if MoreSeamothDepth mod is present");

            IQMod moreSeamothDepth = QModServices.Main.FindModById("MoreSeamothDepth");

            if (moreSeamothDepth != null &&
                TechTypeHandler.TryGetModdedTechType("SeamothHullModule4", out TechType vehicleHullModule4) &&
                TechTypeHandler.TryGetModdedTechType("SeamothHullModule5", out TechType vehicleHullModule5))
            {
                QuickLogger.Info("Detected Seamoth Depth Modules Mk4 & Mk5");
                // the AddDepthModule will add the module to the common upgrades set, the common depth modules set, and the vehicle-specific set
                VehicleUpgrader.AddDepthModule(vehicleHullModule4, 4, VehicleUpgrader.EVehicleType.Seamoth);
                VehicleUpgrader.AddDepthModule(vehicleHullModule5, 5, VehicleUpgrader.EVehicleType.Seamoth);
            }

#if BELOWZERO
            QuickLogger.Info("Checking if SeaTruckDepthUpgrades mod is present");

            IQMod moreSeatruckDepth = QModServices.Main.FindModById("SeaTruckDepthUpgrades");
            if (moreSeatruckDepth != null &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckDepthMK4", out TechType seaTruckHull4) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckDepthMK5", out TechType seaTruckHull5) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckDepthMK6", out TechType seaTruckHull6))
            {
                QuickLogger.Info("Detected SeaTruck Depth Modules Mk4, Mk5 and Mk6");
                VehicleUpgrader.AddDepthModule(seaTruckHull4, 4, VehicleUpgrader.EVehicleType.Seatruck);
                VehicleUpgrader.AddDepthModule(seaTruckHull5, 5, VehicleUpgrader.EVehicleType.Seatruck);
                VehicleUpgrader.AddDepthModule(seaTruckHull6, 6, VehicleUpgrader.EVehicleType.Seatruck);
            }

            IQMod seatruckSpeed = QModServices.Main.FindModById("SeaTruckSpeedUpgrades");
            if (seatruckSpeed != null &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckSpeedMK1", out TechType speedMk1) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckSpeedMK2", out TechType speedMk2) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckSpeedMK3", out TechType speedMk3))
            {
                QuickLogger.Info("Detected Seatruck Speed Modules Mk1, Mk2 and Mk3");
                VehicleUpgrader.AddSpeedModifier(speedMk1, 1f, 0f);
                VehicleUpgrader.AddSpeedModifier(speedMk2, 2f, 0f);
                VehicleUpgrader.AddSpeedModifier(speedMk3, 3f, 0f);
            }

            IQMod seatruckArmour = QModServices.Main.FindModById("SeaTruckArmorUpgrades");
            if (seatruckSpeed != null &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckArmorMK1", out TechType armour1) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckArmorMK2", out TechType armour2) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckArmorMK3", out TechType armour3))
            {
                QuickLogger.Info("Detected Seatruck Armour Modules Mk1, Mk2 and Mk3");
                VehicleUpgrader.AddArmourModule(armour1, 1);
                VehicleUpgrader.AddArmourModule(armour2, 2);
                VehicleUpgrader.AddArmourModule(armour3, 3);
            }
#endif
        }
Example #9
0
 public SpeedBooster()
     : base(classId: "SpeedModule",
            friendlyName: "Speed Boost Module",
            description: "Allows small vehicle engines to go into overdrive, adding greater speeds but at the cost of higher energy consumption rates.")
 {
     OnFinishedPatching += () =>
     {
         VehicleUpgrader.AddSpeedModifier(this.TechType, 1f, 1f);
     };
 }
Example #10
0
 public HullArmorMk2()
     : base(classId: "HullArmorMk2",
            friendlyName: "Hull Reinforcement Mk II",
            description: "An upgrade containing nanites improving and maintaining the inner structure of the hull.\nEquivalent to 2 regular Hull Reinforcements")
 {
     OnFinishedPatching += () =>
     {
         VehicleUpgrader.AddArmourModule(this.TechType, ArmorCount);
     };
 }
Example #11
0
        internal static void Postfix(ref float __result, GameObject target)
        {
            Vehicle vehicle = target.GetComponent <Vehicle>();

            if (vehicle != null) // Target is vehicle
            {
                VehicleUpgrader vehicleUpgrader = vehicle.gameObject.EnsureComponent <VehicleUpgrader>();

                __result = vehicleUpgrader.GeneralDamageReduction * __result;
            }
        }
        public static VehicleUpgrader GetUpgrader <T>(T vehicle) where T : Vehicle
        {
            VehicleUpgrader vehicleUpgrader = Upgraders.Find(v => v.InstanceID == vehicle.GetInstanceID());

            if (vehicleUpgrader == null)
            {
                QuickLogger.Debug("GetUpgrader: Creating new upgrader");
                vehicleUpgrader = CreateNewUpgrader(vehicle);
            }
            else
            {
                QuickLogger.Debug("GetUpgrader: Upgrader okay to send back");
            }

            return(vehicleUpgrader);
        }
        private static VehicleUpgrader CreateNewUpgrader <T>(T vehicle) where T : Vehicle
        {
            var upgrader = new VehicleUpgrader();

            if (upgrader.Initialize(vehicle))
            {
                Upgraders.Add(upgrader);
                QuickLogger.Debug("CreateNewUpgrader: Initialize successful");
                return(upgrader);
            }
            else
            {
                QuickLogger.Debug("CreateNewUpgrader: Initialize failed");
                return(null);
            }
        }
        internal static void Postfix(ref float __result, GameObject target)
        {
            MonoBehaviour vehicle = target.GetComponent <Vehicle>();

#if BELOWZERO
            if (vehicle == null)
            {
                vehicle = target.GetComponent <SeaTruckMotor>();
            }
#endif
            if (vehicle != null) // Target is vehicle
            {
                VehicleUpgrader vehicleUpgrader = vehicle.gameObject.EnsureComponent <VehicleUpgrader>();

                __result = vehicleUpgrader.GeneralDamageReduction * __result;
            }
        }
        public static void Patch()
        {
#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
#endif

            try
            {
                QuickLogger.Info("Started patching - " + QuickLogger.GetAssemblyVersion());

                CrossModUpdates();

                CraftTreeHandler.AddTabNode(CraftTree.Type.Workbench, WorkBenchTab, "Armor Modules", SpriteManager.Get(TechType.VehicleArmorPlating));

                //Handle SpeedBooster
                var speedModule = new SpeedBooster();
                speedModule.Patch();

                //Handle HullArmorUpgrades
                var hullArmorMk2Module = new HullArmorMk2();
                hullArmorMk2Module.Patch();

                var hullArmorMk3Module = new HullArmorMk3(hullArmorMk2Module.TechType);
                hullArmorMk3Module.Patch();

                var hullArmorMk4Module = new HullArmorMk4(hullArmorMk3Module.TechType);
                hullArmorMk4Module.Patch();

                //Handle Config Options
                var configOptions = new UpgradeOptions();
                configOptions.Initialize();

                VehicleUpgrader.SetBonusSpeedMultipliers(configOptions.SeamothBonusSpeedMultiplier, configOptions.ExosuitBonusSpeedMultiplier);

                var harmony = HarmonyInstance.Create("com.upgradedvehicles.psmod");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Example #16
0
        private static void HandleSpeedBooster()
        {
            speedModule = SpeedBooster.GetSpeedBoosterCraftable();

            VehicleUpgrader.SetSpeedBooster(speedModule);
        }