diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 47bdf0a..9ae295f 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/1.6/1.6/Defs/AnimationDefs/WULA_Mech_Flyer_Anim.xml b/1.6/1.6/Defs/AnimationDefs/WULA_Mech_Flyer_Anim.xml index 34824ca..07f4e14 100644 --- a/1.6/1.6/Defs/AnimationDefs/WULA_Mech_Flyer_Anim.xml +++ b/1.6/1.6/Defs/AnimationDefs/WULA_Mech_Flyer_Anim.xml @@ -4,15 +4,21 @@ WULA_Mech_Flyer_North - 4 + 16 true
  • ARA_Flight_Attachment -
  • WULA_Mech_Flyer_Flying_north_0_gs0
  • -
  • WULA_Mech_Flyer_Flying_north_1_gs2
  • +
  • ARA_Goose_Flying_north_1_gs0
  • +
  • ARA_Goose_Flying_north_2_gs2
  • +
  • ARA_Goose_Flying_north_3_gs4
  • +
  • ARA_Goose_Flying_north_4_gs6
  • +
  • ARA_Goose_Flying_north_5_gs8
  • +
  • ARA_Goose_Flying_north_6_gs10
  • +
  • ARA_Goose_Flying_north_7_gs12
  • +
  • ARA_Goose_Flying_north_8_gs14
  • @@ -22,15 +28,21 @@ WULA_Mech_Flyer_East - 4 + 16 true
  • ARA_Flight_Attachment -
  • WULA_Mech_Flyer_Flying_east_0_gs0
  • -
  • WULA_Mech_Flyer_Flying_east_1_gs2
  • +
  • ARA_Goose_Flying_east_1_gs0
  • +
  • ARA_Goose_Flying_east_2_gs2
  • +
  • ARA_Goose_Flying_east_3_gs4
  • +
  • ARA_Goose_Flying_east_4_gs6
  • +
  • ARA_Goose_Flying_east_5_gs8
  • +
  • ARA_Goose_Flying_east_6_gs10
  • +
  • ARA_Goose_Flying_east_7_gs12
  • +
  • ARA_Goose_Flying_east_8_gs14
  • @@ -40,15 +52,21 @@ WULA_Mech_Flyer_South - 4 + 16 true
  • ARA_Flight_Attachment -
  • WULA_Mech_Flyer_Flying_south_0_gs0
  • -
  • WULA_Mech_Flyer_Flying_south_1_gs2
  • +
  • ARA_Goose_Flying_south_1_gs0
  • +
  • ARA_Goose_Flying_south_2_gs2
  • +
  • ARA_Goose_Flying_south_3_gs4
  • +
  • ARA_Goose_Flying_south_4_gs6
  • +
  • ARA_Goose_Flying_south_5_gs8
  • +
  • ARA_Goose_Flying_south_6_gs10
  • +
  • ARA_Goose_Flying_south_7_gs12
  • +
  • ARA_Goose_Flying_south_8_gs14
  • diff --git a/1.6/1.6/Defs/GraphicStateDefs/WULA_Mech_Flyer_Graphics.xml b/1.6/1.6/Defs/GraphicStateDefs/WULA_Mech_Flyer_Graphics.xml index 92aadc2..a099234 100644 --- a/1.6/1.6/Defs/GraphicStateDefs/WULA_Mech_Flyer_Graphics.xml +++ b/1.6/1.6/Defs/GraphicStateDefs/WULA_Mech_Flyer_Graphics.xml @@ -1,50 +1,174 @@ - + - WULA_Mech_Flyer_Flying_north_0_gs + ARA_Goose_Flying_north_1_gs - Wula/Things/WULA_Mech_Flyer/WULA_Mech_Flyer_Flying_north_0 + Things/Pawn/Animal/Goose/Goose_Flying_1_north 1.35 - WULA_Mech_Flyer_Flying_north_1_gs + ARA_Goose_Flying_north_2_gs - Wula/Things/WULA_Mech_Flyer/WULA_Mech_Flyer_Flying_north_1 + Things/Pawn/Animal/Goose/Goose_Flying_2_north + 1.35 + + + + ARA_Goose_Flying_north_3_gs + + Things/Pawn/Animal/Goose/Goose_Flying_3_north + 1.35 + + + + ARA_Goose_Flying_north_4_gs + + Things/Pawn/Animal/Goose/Goose_Flying_4_north + 1.35 + + + + ARA_Goose_Flying_north_5_gs + + Things/Pawn/Animal/Goose/Goose_Flying_5_north + 1.35 + + + + ARA_Goose_Flying_north_6_gs + + Things/Pawn/Animal/Goose/Goose_Flying_6_north + 1.35 + + + + ARA_Goose_Flying_north_7_gs + + Things/Pawn/Animal/Goose/Goose_Flying_7_north + 1.35 + + + + ARA_Goose_Flying_north_8_gs + + Things/Pawn/Animal/Goose/Goose_Flying_8_north 1.35 - - WULA_Mech_Flyer_Flying_east_0_gs + ARA_Goose_Flying_east_1_gs - Wula/Things/WULA_Mech_Flyer/WULA_Mech_Flyer_Flying_east_0 + Things/Pawn/Animal/Goose/Goose_Flying_1_east 1.35 - WULA_Mech_Flyer_Flying_east_1_gs + ARA_Goose_Flying_east_2_gs - Wula/Things/WULA_Mech_Flyer/WULA_Mech_Flyer_Flying_east_1 + Things/Pawn/Animal/Goose/Goose_Flying_2_east + 1.35 + + + + ARA_Goose_Flying_east_3_gs + + Things/Pawn/Animal/Goose/Goose_Flying_3_east + 1.35 + + + + ARA_Goose_Flying_east_4_gs + + Things/Pawn/Animal/Goose/Goose_Flying_4_east + 1.35 + + + + ARA_Goose_Flying_east_5_gs + + Things/Pawn/Animal/Goose/Goose_Flying_5_east + 1.35 + + + + ARA_Goose_Flying_east_6_gs + + Things/Pawn/Animal/Goose/Goose_Flying_6_east + 1.35 + + + + ARA_Goose_Flying_east_7_gs + + Things/Pawn/Animal/Goose/Goose_Flying_7_east + 1.35 + + + + ARA_Goose_Flying_east_8_gs + + Things/Pawn/Animal/Goose/Goose_Flying_8_east 1.35 - - WULA_Mech_Flyer_Flying_south_0_gs + ARA_Goose_Flying_south_1_gs - Wula/Things/WULA_Mech_Flyer/WULA_Mech_Flyer_Flying_south_0 + Things/Pawn/Animal/Goose/Goose_Flying_1_south 1.35 - WULA_Mech_Flyer_Flying_south_1_gs + ARA_Goose_Flying_south_2_gs - Wula/Things/WULA_Mech_Flyer/WULA_Mech_Flyer_Flying_south_1 + Things/Pawn/Animal/Goose/Goose_Flying_2_south + 1.35 + + + + ARA_Goose_Flying_south_3_gs + + Things/Pawn/Animal/Goose/Goose_Flying_3_south + 1.35 + + + + ARA_Goose_Flying_south_4_gs + + Things/Pawn/Animal/Goose/Goose_Flying_4_south + 1.35 + + + + ARA_Goose_Flying_south_5_gs + + Things/Pawn/Animal/Goose/Goose_Flying_5_south + 1.35 + + + + ARA_Goose_Flying_south_6_gs + + Things/Pawn/Animal/Goose/Goose_Flying_6_south + 1.35 + + + + ARA_Goose_Flying_south_7_gs + + Things/Pawn/Animal/Goose/Goose_Flying_7_south + 1.35 + + + + ARA_Goose_Flying_south_8_gs + + Things/Pawn/Animal/Goose/Goose_Flying_8_south 1.35 diff --git a/1.6/1.6/Defs/PawnRenderTreeDefs/ARA_RenderTree.xml b/1.6/1.6/Defs/PawnRenderTreeDefs/ARA_RenderTree.xml index 1973a1d..8582cf4 100644 --- a/1.6/1.6/Defs/PawnRenderTreeDefs/ARA_RenderTree.xml +++ b/1.6/1.6/Defs/PawnRenderTreeDefs/ARA_RenderTree.xml @@ -46,7 +46,12 @@ Arachnae Flight Attachment ARA_Flight_Attachment ArachnaeSwarm/Things/General/Invisible/Inv - -10 + 60 + + + -10 + + diff --git a/Source/ArachnaeSwarm/HarmonyPatches.cs b/Source/ArachnaeSwarm/HarmonyPatches.cs index db53363..8d753f8 100644 --- a/Source/ArachnaeSwarm/HarmonyPatches.cs +++ b/Source/ArachnaeSwarm/HarmonyPatches.cs @@ -5,96 +5,76 @@ using Verse.AI; namespace ArachnaeSwarm { - // Note: We are no longer patching PawnGenerator. - // We will inject/override flight logic at more precise points. + // Restore the simple, flat structure. [HarmonyPatch] on the methods themselves. [HarmonyPatch] public static class FlightHarmonyPatches { - // Patch 1: Override the animation selection [HarmonyPrefix] [HarmonyPatch(typeof(Pawn_FlightTracker), "GetBestFlyAnimation")] - public static bool GetBestFlyAnimation_Prefix(Pawn_FlightTracker __instance, Pawn ___pawn, Rot4? facingOverride, ref AnimationDef __result) + public static bool GetBestFlyAnimation_Prefix(Pawn ___pawn, ref AnimationDef __result) { - var flightComp = ___pawn.TryGetComp(); - if (flightComp == null) + var flightComp = ___pawn?.TryGetComp(); + if (flightComp == null || flightComp.props == null) { - return true; // Let original method run for non-comped pawns + return true; } var compProps = flightComp.Props; - bool isFemale = ___pawn.gender == Gender.Female; - - // Determine which animation to use based on rotation and gender AnimationDef selectedAnim = null; - switch ((facingOverride ?? ___pawn.Rotation).AsInt) + + if (___pawn.gender == Gender.Female && compProps.flyingAnimationNorthFemale != null) { - case 0: // North - selectedAnim = isFemale ? compProps.flyingAnimationNorthFemale : compProps.flyingAnimationNorth; - break; - case 1: // East - selectedAnim = isFemale ? compProps.flyingAnimationEastFemale : compProps.flyingAnimationEast; - break; - case 2: // South - selectedAnim = isFemale ? compProps.flyingAnimationSouthFemale : compProps.flyingAnimationSouth; - break; - case 3: // West - Use East animation as fallback if West is not defined - selectedAnim = isFemale ? (compProps.flyingAnimationEastFemale ?? compProps.flyingAnimationEast) : compProps.flyingAnimationEast; - break; + switch (___pawn.Rotation.AsInt) + { + case 0: selectedAnim = compProps.flyingAnimationNorthFemale; break; + case 1: selectedAnim = compProps.flyingAnimationEastFemale; break; + case 2: selectedAnim = compProps.flyingAnimationSouthFemale; break; + case 3: selectedAnim = compProps.flyingAnimationEastFemale ?? compProps.flyingAnimationEast; break; + } + } + else + { + switch (___pawn.Rotation.AsInt) + { + case 0: selectedAnim = compProps.flyingAnimationNorth; break; + case 1: selectedAnim = compProps.flyingAnimationEast; break; + case 2: selectedAnim = compProps.flyingAnimationSouth; break; + case 3: selectedAnim = compProps.flyingAnimationEast; break; + } } - // If we have a valid animation from our comp, use it and stop the original method. if (selectedAnim != null) { __result = selectedAnim; - return false; // Stop original method + return false; } - - return true; // Fallback to original if no animation is found in comp + return true; } - - // Patch 2: Decide whether to fly when a new job starts [HarmonyPrefix] [HarmonyPatch(typeof(Pawn_FlightTracker), "Notify_JobStarted")] public static bool Notify_JobStarted_Prefix(Job job, Pawn_FlightTracker __instance, Pawn ___pawn) { - var flightComp = ___pawn.TryGetComp(); - if (flightComp == null || !__instance.CanEverFly || ___pawn.Dead) + var flightComp = ___pawn?.TryGetComp(); + if (flightComp == null || flightComp.props == null || __instance == null || !__instance.CanEverFly || ___pawn == null || ___pawn.Dead) { - return true; // Let original method run + return true; } var compProps = flightComp.Props; - bool shouldBeFlying = false; + bool shouldBeFlying = (compProps.flightCondition == FlightCondition.Drafted && ___pawn.Drafted); - // Check our custom condition - if (compProps.flightCondition == FlightCondition.Drafted) - { - if (___pawn.Drafted) - { - shouldBeFlying = true; - } - } - - // Apply the decision if (shouldBeFlying) { - if (!__instance.Flying) - { - __instance.StartFlying(); - } - job.flying = true; // Mark the job as a flying job + if (!__instance.Flying) __instance.StartFlying(); + job.flying = true; } else { - if (__instance.Flying) - { - __instance.ForceLand(); - } + if (__instance.Flying) __instance.ForceLand(); job.flying = false; } - - return false; // We have handled the logic, stop the original method. + return false; } } } \ No newline at end of file