Files
ArachnaeSwarm/Source/ArachnaeSwarm/Abilities/ARA_FanShapedStunKnockback/Safer_PawnFlyer.cs
2026-03-27 17:27:59 +08:00

40 lines
949 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
using Verse.AI;
using Verse.Sound;
namespace ArachnaeSwarm
{
public class SaferPawnFlyer : PawnFlyer
{
// 重写TickInterval增加空值检查
protected override void TickInterval(int delta)
{
// 如果FlyingThing为空直接销毁并返回
if (FlyingThing == null || FlyingThing.Destroyed)
{
Destroy();
return;
}
base.TickInterval(delta);
}
// 重写RespawnPawn增加空值检查
protected override void RespawnPawn()
{
// 如果FlyingThing为空直接销毁并返回
if (FlyingThing == null || FlyingThing.Destroyed)
{
Destroy();
return;
}
// 调用基类方法
base.RespawnPawn();
}
}
}