Add movement speed patch

This commit is contained in:
2024-07-24 00:01:01 +02:00
parent c3120e0914
commit c204838602
2 changed files with 60 additions and 105 deletions

View File

@@ -19,16 +19,7 @@ namespace Regiments {
public static ConfigEntry<float> FireRateMultiplier; public static ConfigEntry<float> FireRateMultiplier;
public static ConfigEntry<float> AimIntervalMultiplier; public static ConfigEntry<float> AimIntervalMultiplier;
public static ConfigEntry<float> SupplyRateMultiplier; public static ConfigEntry<float> SupplyRateMultiplier;
// public static ConfigEntry<float> magnetRadiusMultiplier; public static ConfigEntry<float> MovementSpeedMultiplier;
// public static ConfigEntry<float> beamStrenghtMultiplier;
// public static ConfigEntry<float> beamRadiusMultiplier;
// public static ConfigEntry<float> fuelTankRefillMultiplier;
// public static ConfigEntry<float> fuelTankCapacityMultiplier;
// public static ConfigEntry<float> minerGroundArea;
// public static ConfigEntry<float> minerMiningSpeed;
// public static ConfigEntry<float> wheelTorqueMultiplier;
// public static ConfigEntry<float> wheelSpeedMultiplier;
// public static ConfigEntry<float> jetThrustMultiplier;
public void Awake() { public void Awake() {
SPMultiplier = Config.Bind("General", "SP Multiplier", 1f, SPMultiplier = Config.Bind("General", "SP Multiplier", 1f,
@@ -48,42 +39,8 @@ namespace Regiments {
new AcceptableValueRange<float>(0.1f, 32f))); new AcceptableValueRange<float>(0.1f, 32f)));
AimIntervalMultiplier = Config.Bind("General", "Aiming Interval Multiplier", 1f, AimIntervalMultiplier = Config.Bind("General", "Aiming Interval Multiplier", 1f,
new ConfigDescription("Aiming Interval Multiplier", new AcceptableValueRange<float>(0.1f, 32f))); new ConfigDescription("Aiming Interval Multiplier", new AcceptableValueRange<float>(0.1f, 32f)));
// beamStrenghtMultiplier = Config.Bind("Attractors", "Beam Strength Multiplier", 1f, MovementSpeedMultiplier = Config.Bind("General", "Movement Speed Multiplier", 1f,
// new ConfigDescription("Beam Strength Multiplier", new AcceptableValueRange<float>(1f, 16f))); new ConfigDescription("Movement Speed Multiplier", new AcceptableValueRange<float>(0.1f, 32f)));
// beamRadiusMultiplier = Config.Bind("Attractors", "Beam Radius Multiplier", 1f,
// new ConfigDescription("Beam Radius Multiplier", new AcceptableValueRange<float>(1f, 16f)));
//
// fuelTankRefillMultiplier = Config.Bind("Propulsion", "Fuel Tank Refill Rate Multiplier", 1f,
// new ConfigDescription("Fuel Tank Refill Rate Multiplier", new AcceptableValueRange<float>(1f, 32f)));
// fuelTankCapacityMultiplier = Config.Bind("Propulsion", "Fuel Tank Capacity Multiplier", 1f,
// new ConfigDescription("Fuel Tank Capacity Multiplier", new AcceptableValueRange<float>(1f, 32f)));
// wheelTorqueMultiplier = Config.Bind("Propulsion", "Wheel Torque Multiplier", 1f,
// new ConfigDescription("Wheel Torque Multiplier", new AcceptableValueRange<float>(1f, 32f)));
// wheelSpeedMultiplier = Config.Bind("Propulsion", "Wheel Max RPM Multiplier", 1f,
// new ConfigDescription("Wheel Max RPM Multiplier", new AcceptableValueRange<float>(1f, 32f)));
// jetThrustMultiplier = Config.Bind("Propulsion", "Jet Thrust Multiplier", 1f,
// new ConfigDescription("Jet Thrust Multiplier", new AcceptableValueRange<float>(1f, 32f)));
//
// minerGroundArea = Config.Bind("Production", "Miner Ground Deposit Scan Area", 1f,
// new ConfigDescription("Miner Ground Deposit Scan Area", new AcceptableValueRange<float>(1f, 32f)));
// minerMiningSpeed = Config.Bind("Production", "Miner Mining Speed", 1f,
// new ConfigDescription("Miner Mining Speed", new AcceptableValueRange<float>(1f, 32f)));
//
// allProjectilesHoming = Config.Bind("General", "Make All Projectiles Home", false);
// shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
// energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();
// magnetStrenghtMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
// magnetRadiusMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
// beamStrenghtMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
// beamRadiusMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
// fuelTankRefillMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
// fuelTankCapacityMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
// wheelTorqueMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
// wheelSpeedMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
// jetThrustMultiplier.SettingChanged += (sender, args) => ThrusterPropertiesManager.DoPatch();
// minerGroundArea.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
// minerMiningSpeed.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
Logger.LogInfo("Cyka mod loaded"); Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true; HarmonyFileLog.Enabled = true;

View File

@@ -1,22 +1,14 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using birdseye; using birdseye;
using birdseye.Regiments; using birdseye.Regiments;
using birdseye.Regiments.Commanders; using birdseye.Regiments.Commanders;
using birdseye.Regiments.GameModes;
using birdseye.Regiments.Menu.GUI;
using birdseye.Regiments.Platoons;
using birdseye.Regiments.Platoons.Modules; using birdseye.Regiments.Platoons.Modules;
using birdseye.Regiments.Units.Rigging;
using birdseye.Regiments.Units.WeaponSystems; using birdseye.Regiments.Units.WeaponSystems;
using birdseye.Regiments.Zones; using birdseye.Regiments.Zones;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
// Patch maxSupPoints in PlatoonSupplyModule
// Patch Operational Authority point gain
namespace Regiments { namespace Regiments {
[HarmonyPatch] [HarmonyPatch]
public class Patches { public class Patches {
@@ -120,6 +112,12 @@ namespace Regiments {
Console.WriteLine("Patching refit step to: {0} {1}", hpVal, ammoVal); Console.WriteLine("Patching refit step to: {0} {1}", hpVal, ammoVal);
} }
[HarmonyPostfix]
[HarmonyPatch(typeof(UnitMovementRig), nameof(UnitMovementRig.maxSpeed), MethodType.Getter)]
static void MovementSpeedMultiplier(ref float __result) {
__result *= Main.MovementSpeedMultiplier.Value;
}
// [HarmonyPatch(typeof(AdvancedRulesData), "Validate")] // [HarmonyPatch(typeof(AdvancedRulesData), "Validate")]
// static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { // static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
// var codes = new List<CodeInstruction>(instructions); // var codes = new List<CodeInstruction>(instructions);