Skip to content

Commit

Permalink
ability resource enabled for equipmentslot too
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkroeg committed Jul 21, 2021
1 parent 03a41b4 commit 581a13e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
42 changes: 42 additions & 0 deletions IRTweaks/IRTweaks/Modules/Combat/AbilityResourceFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,48 @@ public static void Postfix(CombatHUDActionButton __instance, string creatorGUID,
}
}

[HarmonyPatch(typeof(CombatHUDEquipmentSlot), "ActivateAbility", new Type[]
{
typeof(string),
typeof(string)
})]
public static class CombatHUDEquipmentSlot_ActivateAbility_Confirmed
{
public static bool Prepare()
{
return Mod.Config.Fixes.AbilityResourceFix;
}

public static void Postfix(CombatHUDEquipmentSlot __instance, string creatorGUID, string targetGUID)
{
var HUD = Traverse.Create((object)__instance).Property("HUD", (object[])null).GetValue<CombatHUD>();
var selectedActor = HUD.SelectedActor;
if (__instance.Ability.Def.Resource == AbilityDef.ResourceConsumed.ConsumesFiring)
{
// selectedActor.HasFiredThisRound = true;
// this doesnt work to disable firing.
}
else if (__instance.Ability.Def.Resource == AbilityDef.ResourceConsumed.ConsumesMovement)
{
// selectedActor.HasMovedThisRound = true;
//this doesnt work to disable movement
}
else if (__instance.Ability.Def.Resource == AbilityDef.ResourceConsumed.ConsumesActivation)
{
if (selectedActor is Mech mech)
{
mech.GenerateAndPublishHeatSequence(-1, true, false, selectedActor.GUID);
Mod.Log.Info?.Write($"Generated and Published Heat Sequence for {mech.Description.UIName}.");
}

selectedActor.DoneWithActor();//need to to onactivationend too
selectedActor.OnActivationEnd(selectedActor.GUID, __instance.GetInstanceID());
}
}
}



[HarmonyPatch(typeof(CombatHUDMechwarriorTray), "ResetAbilityButtons", new Type[] {typeof(AbstractActor)})]

public static class CombatHUDMechwarriorTray_ResetAbilityButtons_Patch
Expand Down
4 changes: 2 additions & 2 deletions IRTweaks/IRTweaks/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.3.03")]
[assembly: AssemblyFileVersion("0.9.3.03")]
[assembly: AssemblyVersion("0.9.3.4")]
[assembly: AssemblyFileVersion("0.9.3.4")]

0 comments on commit 581a13e

Please sign in to comment.