diff --git a/Assemblies/DualWield.dll b/Assemblies/DualWield.dll index 77772aa..20cc733 100644 Binary files a/Assemblies/DualWield.dll and b/Assemblies/DualWield.dll differ diff --git a/Source/DualWield/Harmony/Jobdriver_Wait.cs b/Source/DualWield/Harmony/Jobdriver_Wait.cs index fe774da..e6d6ad2 100644 --- a/Source/DualWield/Harmony/Jobdriver_Wait.cs +++ b/Source/DualWield/Harmony/Jobdriver_Wait.cs @@ -9,6 +9,7 @@ namespace DualWield.Harmony { + [HarmonyPatch(typeof(JobDriver_Wait), "CheckForAutoAttack")] public class Jobdriver_Wait_CheckForAutoAttack { @@ -30,12 +31,13 @@ static IEnumerable Transpiler(IEnumerable inst } public static bool FullBodyAndOffHandBusy(Pawn_StanceTracker instance) { - if(instance.pawn.GetStancesOffHand() is Pawn_StanceTracker stOffHand) + if(instance.pawn.GetStancesOffHand() is Pawn_StanceTracker stOffHand && instance.pawn.equipment != null && instance.pawn.equipment.TryGetOffHandEquipment(out ThingWithComps twc)) { return stOffHand.FullBodyBusy && instance.FullBodyBusy; } return instance.FullBodyBusy; } } + } diff --git a/Source/DualWield/Harmony/RunAndGun.cs b/Source/DualWield/Harmony/RunAndGun.cs index 572f70b..b4ad40a 100644 --- a/Source/DualWield/Harmony/RunAndGun.cs +++ b/Source/DualWield/Harmony/RunAndGun.cs @@ -38,28 +38,6 @@ static void Postfix(Pawn_StanceTracker stanceTracker, Stance_Cooldown stance) //SetStanceOffHand(stanceTracker, stance); Verb_TryCastNextBurstShot.SetStanceOffHand(stanceTracker, stance); } - /* - static void SetStanceOffHand(Pawn_StanceTracker stanceTracker, Stance_Cooldown stance) - { - ThingWithComps offHandEquip = null; - CompEquippable compEquippable = null; - Log.Message("calling RunAndGun.SetStanceOffHand"); - if (stanceTracker.pawn.equipment != null && stanceTracker.pawn.equipment.TryGetOffHandEquipment(out ThingWithComps result) && result != stanceTracker.pawn.equipment.Primary) - { - offHandEquip = result; - compEquippable = offHandEquip.TryGetComp(); - } - //Check if verb is one from a offhand weapon. - if (compEquippable != null && stance.verb == compEquippable.PrimaryVerb && stanceTracker.pawn.GetStancesOffHand().curStance is Stance_Warmup_DW) - { - Log.Message("found offhand verb!, setting offhand stance cooldown"); - Log.Message("Stance.type: " + stance.GetType().Name); - Log.Message("Stance.ticks: " + stance.ticksLeft); - stanceTracker.pawn.GetStancesOffHand().SetStance(stance); - } - } - */ - //When Run and Gun or the to be patched method isn't found, patch this stub method so no error is thrown. public static void Stub(Pawn_StanceTracker stanceTracker, Stance_Cooldown stance) diff --git a/Source/DualWield/Harmony/Verb.cs b/Source/DualWield/Harmony/Verb.cs index 2ae7ee1..2a8eec4 100644 --- a/Source/DualWield/Harmony/Verb.cs +++ b/Source/DualWield/Harmony/Verb.cs @@ -61,7 +61,7 @@ public static void SetStanceOffHand(Pawn_StanceTracker stanceTracker, Stance_Co { stanceTracker.pawn.GetStancesOffHand().SetStance(stance); } - else if (!(stanceTracker.curStance is Stance_Cooldown) && stanceTracker.curStance.GetType().Name != "Stance_RunAndGun_Cooldown") + else if (stanceTracker.curStance.GetType().Name != "Stance_RunAndGun_Cooldown") { stanceTracker.SetStance(stance); }