暂存
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user