diff --git a/Projects/TerraTech/TerraTech/ModuleRemoteChargerManager.cs b/Projects/TerraTech/TerraTech/ModuleRemoteChargerManager.cs index 859afc6..9eea379 100644 --- a/Projects/TerraTech/TerraTech/ModuleRemoteChargerManager.cs +++ b/Projects/TerraTech/TerraTech/ModuleRemoteChargerManager.cs @@ -33,8 +33,7 @@ namespace TerraTech { } private static void ConfigureModuleRemoteCharger(MultipliedObject obj) { - obj.AddField( - new FieldConfiguration("m_ArcFiringInterval", arcFiringIntervalMultiplier)); + obj.AddField(new FieldConfiguration("m_ArcFiringInterval", arcFiringIntervalMultiplier)); obj.AddField(new FieldConfiguration("m_ChargingRadius", chargingRadiusMultiplier)); obj.AddField(new FieldConfiguration("m_PowerTransferPerArc", powerTransferPerArcMultiplier)); } diff --git a/Projects/TerraTech/TerraTech/ModuleWeaponGunManager.cs b/Projects/TerraTech/TerraTech/ModuleWeaponGunManager.cs index fa18bc6..f7dc403 100644 --- a/Projects/TerraTech/TerraTech/ModuleWeaponGunManager.cs +++ b/Projects/TerraTech/TerraTech/ModuleWeaponGunManager.cs @@ -5,11 +5,18 @@ using HarmonyLib; namespace TerraTech { [HarmonyPatch] public class ModuleWeaponGunManager { - private static readonly MultipliedObjectManager manager = + private static readonly MultipliedObjectManager manager = + new MultipliedObjectManager(ConfigureManager); + private static readonly MultipliedObjectManager fireDataManager = new MultipliedObjectManager(ConfigureFireData); public static ConfigEntry kickbackStrengthMultiplier; public static ConfigEntry muzzleVelocityMultiplier; + public static ConfigEntry burstCooldownMultiplier; + public static ConfigEntry burstShotCountMultiplier; + public static ConfigEntry shotCooldownMultiplier; + public static ConfigEntry seekingRoundsAll; + public static ConfigEntry resetBurstOnInterruptAll; public static void Setup(ConfigFile config) { float min = 0.01f; @@ -24,6 +31,39 @@ namespace TerraTech { "FireData", "Muzzle Velocity Multiplier", 1f, new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(min, max))); muzzleVelocityMultiplier.SettingChanged += (sender, args) => DoPatch(); + + burstCooldownMultiplier = config.Bind( + "FireData", "Burst Cooldown Multiplier", 1f, + new ConfigDescription("Burst Cooldown Multiplier", new AcceptableValueRange(min, max))); + burstCooldownMultiplier.SettingChanged += (sender, args) => DoPatch(); + + burstShotCountMultiplier = config.Bind( + "FireData", "Burst Shot Count Multiplier", 1f, + new ConfigDescription("Burst Shot Count Multiplier", new AcceptableValueRange(min, max))); + burstShotCountMultiplier.SettingChanged += (sender, args) => DoPatch(); + + shotCooldownMultiplier = config.Bind( + "FireData", "Shot Cooldown Multiplier", 1f, + new ConfigDescription("Shot Cooldown Multiplier", new AcceptableValueRange(min, max))); + shotCooldownMultiplier.SettingChanged += (sender, args) => DoPatch(); + + seekingRoundsAll = + config.Bind("FireData", "Seeking Rounds All", false, + new ConfigDescription("Seeking Rounds All", new AcceptableValueRange(false, true))); + seekingRoundsAll.SettingChanged += (sender, args) => DoPatch(); + + resetBurstOnInterruptAll = config.Bind( + "FireData", "Reset Burst On Interrupt All", false, + new ConfigDescription("Reset Burst On Interrupt All", new AcceptableValueRange(false, true))); + resetBurstOnInterruptAll.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureManager(MultipliedObject obj) { + // obj.AddField(new FieldConfiguration("m_SeekingRounds", seekingRoundsAll)); + // obj.AddField(new FieldConfiguration("m_ResetBurstOnInterrupt", resetBurstOnInterruptAll)); + obj.AddField(new FieldConfiguration("m_BurstCooldown", burstCooldownMultiplier)); + obj.AddField(new FieldConfiguration("m_BurstShotCount", burstShotCountMultiplier)); + obj.AddField(new FieldConfiguration("m_ShotCooldown", shotCooldownMultiplier)); } private static void ConfigureFireData(MultipliedObject obj) { @@ -36,7 +76,8 @@ namespace TerraTech { static void PostfixCreate(ModuleWeaponGun __instance) { var trav = Traverse.Create(__instance); var firingData = trav.Field("m_FireData"); - manager.OnObjectAttached(firingData.GetValue()); + fireDataManager.OnObjectAttached(firingData.GetValue()); + manager.OnObjectAttached(__instance); } [HarmonyPrefix] @@ -44,10 +85,12 @@ namespace TerraTech { static void PostfixDestroy(ModuleWeaponGun __instance) { var trav = Traverse.Create(__instance); var firingData = trav.Field("m_FireData"); - manager.OnObjectDetached(firingData.GetValue()); + fireDataManager.OnObjectDetached(firingData.GetValue()); + manager.OnObjectDetached(__instance); } public static void DoPatch() { + fireDataManager.ApplyAll(); manager.ApplyAll(); } }