diff --git a/QCreatureConfig/Patches/AttachAndSuck_SuckBlood_Patch.cs b/QCreatureConfig/Patches/AttachAndSuck_SuckBlood_Patch.cs new file mode 100644 index 0000000..38bc08a --- /dev/null +++ b/QCreatureConfig/Patches/AttachAndSuck_SuckBlood_Patch.cs @@ -0,0 +1,19 @@ +using Harmony; + +namespace QCreatureConfig.Patches +{ + [HarmonyPatch(typeof(AttachAndSuck))] + [HarmonyPatch("SuckBlood")] + class AttachAndSuck_SuckBlood_Patch + { + public static void Prefix(AttachAndSuck __instance) + { + QCreatures.lastTouched = __instance.bleeder; + } + + public static void Postfix() + { + QCreatures.lastTouched = null; + } + } +} diff --git a/QCreatureConfig/Patches/CrabSnake_OnTouch_Patch.cs b/QCreatureConfig/Patches/CrabSnake_OnTouch_Patch.cs index 1f51183..ec08db9 100644 --- a/QCreatureConfig/Patches/CrabSnake_OnTouch_Patch.cs +++ b/QCreatureConfig/Patches/CrabSnake_OnTouch_Patch.cs @@ -10,5 +10,10 @@ public static void Prefix(CrabsnakeMeleeAttack __instance) { QCreatures.lastTouched = __instance.gameObject.GetComponent(); } + + public static void Postfix() + { + QCreatures.lastTouched = null; + } } } diff --git a/QCreatureConfig/Patches/Crash_Detonate_Patch.cs b/QCreatureConfig/Patches/Crash_Detonate_Patch.cs index 05b2681..380c8db 100644 --- a/QCreatureConfig/Patches/Crash_Detonate_Patch.cs +++ b/QCreatureConfig/Patches/Crash_Detonate_Patch.cs @@ -10,5 +10,10 @@ public static void Prefix(Crash __instance) { QCreatures.lastTouched = __instance; } + + public static void Postfix() + { + QCreatures.lastTouched = null; + } } } diff --git a/QCreatureConfig/Patches/Knife_OnToolUseAnim_Patch.cs b/QCreatureConfig/Patches/Knife_OnToolUseAnim_Patch.cs deleted file mode 100644 index 9d52b14..0000000 --- a/QCreatureConfig/Patches/Knife_OnToolUseAnim_Patch.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Harmony; - -namespace QCreatureConfig.Patches -{ - [HarmonyPatch(typeof(Knife))] - [HarmonyPatch("OnToolUseAnim")] - class Knife_OnToolUseAnim_Patch - { - public static void Prefix(Knife __instance, GUIHand hand) - { - QCreatures.lastTouched = null; - } - } -} diff --git a/QCreatureConfig/Patches/MeleeAttack_OnTouch_Patch.cs b/QCreatureConfig/Patches/MeleeAttack_OnTouch_Patch.cs index bcd3985..0d2dbd8 100644 --- a/QCreatureConfig/Patches/MeleeAttack_OnTouch_Patch.cs +++ b/QCreatureConfig/Patches/MeleeAttack_OnTouch_Patch.cs @@ -11,5 +11,10 @@ public static void Prefix(MeleeAttack __instance, Collider collider) { QCreatures.lastTouched = __instance.gameObject.GetComponent(); } + + public static void Postfix() + { + QCreatures.lastTouched = null; + } } } \ No newline at end of file diff --git a/QCreatureConfig/Patches/ReaperLeviathan_DamageVehicle_Patch.cs b/QCreatureConfig/Patches/ReaperLeviathan_DamageVehicle_Patch.cs index 00cd4db..f0ff5b8 100644 --- a/QCreatureConfig/Patches/ReaperLeviathan_DamageVehicle_Patch.cs +++ b/QCreatureConfig/Patches/ReaperLeviathan_DamageVehicle_Patch.cs @@ -10,5 +10,10 @@ public static void Prefix(ReaperLeviathan __instance) { QCreatures.lastTouched = __instance; } + + public static void Postfix() + { + QCreatures.lastTouched = null; + } } } diff --git a/QCreatureConfig/Patches/ReaperMeleeAttack_OnTouch_Patch.cs b/QCreatureConfig/Patches/ReaperMeleeAttack_OnTouch_Patch.cs index 8f5157d..2a077a1 100644 --- a/QCreatureConfig/Patches/ReaperMeleeAttack_OnTouch_Patch.cs +++ b/QCreatureConfig/Patches/ReaperMeleeAttack_OnTouch_Patch.cs @@ -10,5 +10,10 @@ public static void Prefix(ReaperMeleeAttack __instance) { QCreatures.lastTouched = __instance.gameObject.GetComponent(); } + + public static void Postfix() + { + QCreatures.lastTouched = null; + } } } diff --git a/QCreatureConfig/Patches/SeaDragonMeleeAttack_OnTouchFront_Patch.cs b/QCreatureConfig/Patches/SeaDragonMeleeAttack_OnTouchFront_Patch.cs index f01109b..f5cebaa 100644 --- a/QCreatureConfig/Patches/SeaDragonMeleeAttack_OnTouchFront_Patch.cs +++ b/QCreatureConfig/Patches/SeaDragonMeleeAttack_OnTouchFront_Patch.cs @@ -8,7 +8,12 @@ class SeaDragonMeleeAttack_OnTouchFront_Patch { public static void Prefix(SeaDragonMeleeAttack __instance) { - QCreatures.lastTouched = __instance.gameObject.GetComponent(); + QCreatures.lastTouched = __instance.seaDragon; + } + + public static void Postfix() + { + QCreatures.lastTouched = null; } } } \ No newline at end of file diff --git a/QCreatureConfig/Patches/SeaDragon_DamageExosuit_Patch.cs b/QCreatureConfig/Patches/SeaDragon_DamageExosuit_Patch.cs index cb28f21..106b729 100644 --- a/QCreatureConfig/Patches/SeaDragon_DamageExosuit_Patch.cs +++ b/QCreatureConfig/Patches/SeaDragon_DamageExosuit_Patch.cs @@ -6,9 +6,14 @@ namespace QCreatureConfig.Patches [HarmonyPatch("DamageExosuit")] class SeaDragon_DamageExosuit_Patch { - public static void Prefix(ReaperLeviathan __instance) + public static void Prefix(SeaDragon __instance) { QCreatures.lastTouched = __instance; } + + public static void Postfix() + { + QCreatures.lastTouched = null; + } } } diff --git a/QCreatureConfig/Patches/WarpBall_Warp_Patch.cs b/QCreatureConfig/Patches/WarpBall_Warp_Patch.cs new file mode 100644 index 0000000..3027da8 --- /dev/null +++ b/QCreatureConfig/Patches/WarpBall_Warp_Patch.cs @@ -0,0 +1,23 @@ +using Harmony; +using UnityEngine; +using System.Reflection; + +namespace QCreatureConfig.Patches +{ + [HarmonyPatch(typeof(WarpBall))] + [HarmonyPatch("Warp")] + class WarpBall_Warp_Patch + { + public static void Prefix(WarpBall __instance) + { + FieldInfo field = typeof(WarpBall).GetField("warperGO", BindingFlags.Instance | BindingFlags.NonPublic); + GameObject warperGO = (GameObject)field.GetValue(__instance); + QCreatures.lastTouched = warperGO.GetComponent(); + } + + public static void Postfix() + { + QCreatures.lastTouched = null; + } + } +} diff --git a/QCreatureConfig/QCreatureConfig.csproj b/QCreatureConfig/QCreatureConfig.csproj index 316b8f2..67e5cab 100644 --- a/QCreatureConfig/QCreatureConfig.csproj +++ b/QCreatureConfig/QCreatureConfig.csproj @@ -52,16 +52,17 @@ + - +