This commit is contained in:
2025-09-08 23:31:22 +08:00
parent 8a0fbe32e8
commit 390128f503
8 changed files with 139 additions and 263 deletions

Binary file not shown.

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<AnimationDef>
<defName>ARA_FlyEast</defName>
<durationTicks>60</durationTicks>
<keyframeParts>
<li>
<key>ARA_Flight_Attachment</key>
<value>
<keyframes>
<li><graphicState>ARA_FlyEast_0</graphicState><tick>0</tick></li>
<li><graphicState>ARA_FlyEast_1</graphicState><tick>4</tick></li>
<li><graphicState>ARA_FlyEast_2</graphicState><tick>8</tick></li>
<li><graphicState>ARA_FlyEast_3</graphicState><tick>12</tick></li>
<li><graphicState>ARA_FlyEast_4</graphicState><tick>16</tick></li>
<li><graphicState>ARA_FlyEast_5</graphicState><tick>20</tick></li>
<li><graphicState>ARA_FlyEast_6</graphicState><tick>24</tick></li>
<li><graphicState>ARA_FlyEast_7</graphicState><tick>28</tick></li>
</keyframes>
</value>
</li>
<li>
<key>Root</key>
<value><workerType>AnimationWorker_Keyframes</workerType><keyframes>
<li><tick>0</tick><offset>(0,0,-0.05)</offset></li>
<li><tick>30</tick><offset>(0,0,0.05)</offset></li>
<li><tick>60</tick><offset>(0,0,-0.05)</offset></li>
</keyframes></value>
</li>
</keyframeParts>
</AnimationDef>
<AnimationDef>
<defName>ARA_FlyNorth</defName>
<durationTicks>60</durationTicks>
<keyframeParts>
<li>
<key>ARA_Flight_Attachment</key>
<value>
<keyframes>
<li><graphicState>ARA_FlyNorth_0</graphicState><tick>0</tick></li>
<li><graphicState>ARA_FlyNorth_1</graphicState><tick>4</tick></li>
<li><graphicState>ARA_FlyNorth_2</graphicState><tick>8</tick></li>
<li><graphicState>ARA_FlyNorth_3</graphicState><tick>12</tick></li>
<li><graphicState>ARA_FlyNorth_4</graphicState><tick>16</tick></li>
<li><graphicState>ARA_FlyNorth_5</graphicState><tick>20</tick></li>
<li><graphicState>ARA_FlyNorth_6</graphicState><tick>24</tick></li>
<li><graphicState>ARA_FlyNorth_7</graphicState><tick>28</tick></li>
</keyframes>
</value>
</li>
<li>
<key>Root</key>
<value><workerType>AnimationWorker_Keyframes</workerType><keyframes>
<li><tick>0</tick><offset>(0,0,-0.05)</offset></li>
<li><tick>30</tick><offset>(0,0,0.05)</offset></li>
<li><tick>60</tick><offset>(0,0,-0.05)</offset></li>
</keyframes></value>
</li>
</keyframeParts>
</AnimationDef>
<AnimationDef>
<defName>ARA_FlySouth</defName>
<durationTicks>60</durationTicks>
<keyframeParts>
<li>
<key>ARA_Flight_Attachment</key>
<value>
<keyframes>
<li><graphicState>ARA_FlySouth_0</graphicState><tick>0</tick></li>
<li><graphicState>ARA_FlySouth_1</graphicState><tick>4</tick></li>
<li><graphicState>ARA_FlySouth_2</graphicState><tick>8</tick></li>
<li><graphicState>ARA_FlySouth_3</graphicState><tick>12</tick></li>
<li><graphicState>ARA_FlySouth_4</graphicState><tick>16</tick></li>
<li><graphicState>ARA_FlySouth_5</graphicState><tick>20</tick></li>
<li><graphicState>ARA_FlySouth_6</graphicState><tick>24</tick></li>
<li><graphicState>ARA_FlySouth_7</graphicState><tick>28</tick></li>
</keyframes>
</value>
</li>
<li>
<key>Root</key>
<value><workerType>AnimationWorker_Keyframes</workerType><keyframes>
<li><tick>0</tick><offset>(0,0,-0.05)</offset></li>
<li><tick>30</tick><offset>(0,0,0.05)</offset></li>
<li><tick>60</tick><offset>(0,0,-0.05)</offset></li>
</keyframes></value>
</li>
</keyframeParts>
</AnimationDef>
</Defs>

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<!-- North-facing Animation -->
<AnimationDef>
<defName>WULA_Mech_Flyer_North</defName>
<durationTicks>16</durationTicks> <!-- 8 frames * 2 ticks/frame -->
<startOnRandomTick>true</startOnRandomTick>
<keyframeParts>
<li>
<key>ARA_Flight_Attachment</key>
<value>
<keyframes>
<li><graphicState>ARA_Goose_Flying_north_1_gs</graphicState><tick>0</tick></li>
<li><graphicState>ARA_Goose_Flying_north_2_gs</graphicState><tick>2</tick></li>
<li><graphicState>ARA_Goose_Flying_north_3_gs</graphicState><tick>4</tick></li>
<li><graphicState>ARA_Goose_Flying_north_4_gs</graphicState><tick>6</tick></li>
<li><graphicState>ARA_Goose_Flying_north_5_gs</graphicState><tick>8</tick></li>
<li><graphicState>ARA_Goose_Flying_north_6_gs</graphicState><tick>10</tick></li>
<li><graphicState>ARA_Goose_Flying_north_7_gs</graphicState><tick>12</tick></li>
<li><graphicState>ARA_Goose_Flying_north_8_gs</graphicState><tick>14</tick></li>
</keyframes>
</value>
</li>
</keyframeParts>
</AnimationDef>
<!-- East-facing Animation -->
<AnimationDef>
<defName>WULA_Mech_Flyer_East</defName>
<durationTicks>16</durationTicks>
<startOnRandomTick>true</startOnRandomTick>
<keyframeParts>
<li>
<key>ARA_Flight_Attachment</key>
<value>
<keyframes>
<li><graphicState>ARA_Goose_Flying_east_1_gs</graphicState><tick>0</tick></li>
<li><graphicState>ARA_Goose_Flying_east_2_gs</graphicState><tick>2</tick></li>
<li><graphicState>ARA_Goose_Flying_east_3_gs</graphicState><tick>4</tick></li>
<li><graphicState>ARA_Goose_Flying_east_4_gs</graphicState><tick>6</tick></li>
<li><graphicState>ARA_Goose_Flying_east_5_gs</graphicState><tick>8</tick></li>
<li><graphicState>ARA_Goose_Flying_east_6_gs</graphicState><tick>10</tick></li>
<li><graphicState>ARA_Goose_Flying_east_7_gs</graphicState><tick>12</tick></li>
<li><graphicState>ARA_Goose_Flying_east_8_gs</graphicState><tick>14</tick></li>
</keyframes>
</value>
</li>
</keyframeParts>
</AnimationDef>
<!-- South-facing Animation -->
<AnimationDef>
<defName>WULA_Mech_Flyer_South</defName>
<durationTicks>16</durationTicks>
<startOnRandomTick>true</startOnRandomTick>
<keyframeParts>
<li>
<key>ARA_Flight_Attachment</key>
<value>
<keyframes>
<li><graphicState>ARA_Goose_Flying_south_1_gs</graphicState><tick>0</tick></li>
<li><graphicState>ARA_Goose_Flying_south_2_gs</graphicState><tick>2</tick></li>
<li><graphicState>ARA_Goose_Flying_south_3_gs</graphicState><tick>4</tick></li>
<li><graphicState>ARA_Goose_Flying_south_4_gs</graphicState><tick>6</tick></li>
<li><graphicState>ARA_Goose_Flying_south_5_gs</graphicState><tick>8</tick></li>
<li><graphicState>ARA_Goose_Flying_south_6_gs</graphicState><tick>10</tick></li>
<li><graphicState>ARA_Goose_Flying_south_7_gs</graphicState><tick>12</tick></li>
<li><graphicState>ARA_Goose_Flying_south_8_gs</graphicState><tick>14</tick></li>
</keyframes>
</value>
</li>
</keyframeParts>
</AnimationDef>
</Defs>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<!-- North Frames -->
<GraphicStateDef><defName>ARA_FlyNorth_0</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_1_north</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyNorth_1</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_2_north</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyNorth_2</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_3_north</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyNorth_3</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_4_north</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyNorth_4</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_5_north</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyNorth_5</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_6_north</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyNorth_6</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_7_north</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyNorth_7</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_8_north</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<!-- East Frames -->
<GraphicStateDef><defName>ARA_FlyEast_0</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_1_east</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyEast_1</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_2_east</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyEast_2</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_3_east</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyEast_3</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_4_east</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyEast_4</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_5_east</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyEast_5</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_6_east</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyEast_6</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_7_east</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlyEast_7</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_8_east</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<!-- South Frames -->
<GraphicStateDef><defName>ARA_FlySouth_0</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_1_south</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlySouth_1</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_2_south</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlySouth_2</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_3_south</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlySouth_3</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_4_south</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlySouth_4</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_5_south</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlySouth_5</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_6_south</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlySouth_6</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_7_south</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
<GraphicStateDef><defName>ARA_FlySouth_7</defName><defaultGraphicData><graphicClass>Graphic_Single</graphicClass><texPath>Things/Pawn/Animal/Goose/Goose_Flying_8_south</texPath><drawSize>1.35</drawSize></defaultGraphicData></GraphicStateDef>
</Defs>

View File

@@ -1,176 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<!-- Using Goose Frames for Testing -->
<GraphicStateDef>
<defName>ARA_Goose_Flying_north_1_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_1_north</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_north_2_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_2_north</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_north_3_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_3_north</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_north_4_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_4_north</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_north_5_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_5_north</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_north_6_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_6_north</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_north_7_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_7_north</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_north_8_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_8_north</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_east_1_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_1_east</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_east_2_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_2_east</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_east_3_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_3_east</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_east_4_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_4_east</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_east_5_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_5_east</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_east_6_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_6_east</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_east_7_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_7_east</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_east_8_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_8_east</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_south_1_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_1_south</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_south_2_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_2_south</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_south_3_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_3_south</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_south_4_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_4_south</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_south_5_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_5_south</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_south_6_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_6_south</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_south_7_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_7_south</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
<GraphicStateDef>
<defName>ARA_Goose_Flying_south_8_gs</defName>
<defaultGraphicData>
<texPath>Things/Pawn/Animal/Goose/Goose_Flying_8_south</texPath>
<drawSize>1.35</drawSize>
</defaultGraphicData>
</GraphicStateDef>
</Defs>

View File

@@ -42,6 +42,7 @@
</li>
<!-- ===== OUR CUSTOM NODE INSERTION START ===== -->
<!-- Using Milira's exact structure for testing -->
<li>
<debugLabel>Arachnae Flight Attachment</debugLabel>
<tagDef>ARA_Flight_Attachment</tagDef>

View File

@@ -1178,9 +1178,9 @@
<flightCondition>Drafted</flightCondition>
<!-- 链接到我们刚刚创建的 AnimationDef -->
<flyingAnimationNorth>WULA_Mech_Flyer_North</flyingAnimationNorth>
<flyingAnimationEast>WULA_Mech_Flyer_East</flyingAnimationEast>
<flyingAnimationSouth>WULA_Mech_Flyer_South</flyingAnimationSouth>
<flyingAnimationNorth>ARA_FlyNorth</flyingAnimationNorth>
<flyingAnimationEast>ARA_FlyEast</flyingAnimationEast>
<flyingAnimationSouth>ARA_FlySouth</flyingAnimationSouth>
</li>
</comps>

View File

@@ -5,16 +5,16 @@ using Verse.AI;
namespace ArachnaeSwarm
{
// Restore the simple, flat structure. [HarmonyPatch] on the methods themselves.
[HarmonyPatch]
public static class FlightHarmonyPatches
{
// Corrected Patch 1: The method signature now correctly matches the static target method.
[HarmonyPrefix]
[HarmonyPatch(typeof(Pawn_FlightTracker), "GetBestFlyAnimation")]
public static bool GetBestFlyAnimation_Prefix(Pawn ___pawn, ref AnimationDef __result)
public static bool GetBestFlyAnimation_Prefix(Pawn pawn, ref AnimationDef __result) // Correct parameters: Pawn pawn, not __instance and ___pawn
{
var flightComp = ___pawn?.TryGetComp<CompPawnFlight>();
if (flightComp == null || flightComp.props == null)
var flightComp = pawn?.TryGetComp<CompPawnFlight>();
if (flightComp == null) // No props check needed, as the crash was due to wrong signature
{
return true;
}
@@ -22,9 +22,9 @@ namespace ArachnaeSwarm
var compProps = flightComp.Props;
AnimationDef selectedAnim = null;
if (___pawn.gender == Gender.Female && compProps.flyingAnimationNorthFemale != null)
if (pawn.gender == Gender.Female && compProps.flyingAnimationNorthFemale != null)
{
switch (___pawn.Rotation.AsInt)
switch (pawn.Rotation.AsInt)
{
case 0: selectedAnim = compProps.flyingAnimationNorthFemale; break;
case 1: selectedAnim = compProps.flyingAnimationEastFemale; break;
@@ -34,7 +34,7 @@ namespace ArachnaeSwarm
}
else
{
switch (___pawn.Rotation.AsInt)
switch (pawn.Rotation.AsInt)
{
case 0: selectedAnim = compProps.flyingAnimationNorth; break;
case 1: selectedAnim = compProps.flyingAnimationEast; break;
@@ -51,12 +51,13 @@ namespace ArachnaeSwarm
return true;
}
// Patch 2 remains correct as Notify_JobStarted is a non-static method.
[HarmonyPrefix]
[HarmonyPatch(typeof(Pawn_FlightTracker), "Notify_JobStarted")]
public static bool Notify_JobStarted_Prefix(Job job, Pawn_FlightTracker __instance, Pawn ___pawn)
{
var flightComp = ___pawn?.TryGetComp<CompPawnFlight>();
if (flightComp == null || flightComp.props == null || __instance == null || !__instance.CanEverFly || ___pawn == null || ___pawn.Dead)
if (flightComp == null || __instance == null || !__instance.CanEverFly || ___pawn == null || ___pawn.Dead)
{
return true;
}