存修蜂巢断联

This commit is contained in:
2025-09-04 23:22:51 +08:00
parent e220192bbe
commit 3d0bc51391
5 changed files with 11 additions and 14 deletions

View File

@@ -42,18 +42,7 @@ namespace ArachnaeSwarm
{
get
{
// Only remove if base ShouldRemove is true, OR if pawn is dead
// We do NOT want to remove it just because target is invalid, as the Comp will handle delayed death
if (base.ShouldRemove && pawn.Dead)
{
return true;
}
// Also remove if pawn is no longer spawned or on a map
if (!pawn.Spawned || pawn.Map == null)
{
return true;
}
return false; // Let the Comp handle the unlinked death
return this.pawn.Dead;
}
}
@@ -61,8 +50,7 @@ namespace ArachnaeSwarm
{
base.PostRemoved();
// Deregister from the master when this hediff is removed
// Ensure target is a Pawn and not dead before attempting to deregister
if (this.target is Pawn master && master != null && !master.Destroyed && !master.Dead)
if (this.target is Pawn master && master != null && !master.Destroyed)
{
var masterHediff = master.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("ARA_HiveMindMaster")) as Hediff_HiveMindMaster;
masterHediff?.DeregisterDrone(this.pawn);

View File

@@ -11,6 +11,8 @@ namespace ArachnaeSwarm
public override string LabelInBrackets => drones.Count.ToString();
public override bool ShouldRemove => false;
public override void ExposeData()
{
base.ExposeData();