存
This commit is contained in:
Binary file not shown.
@@ -57,7 +57,14 @@ namespace ArachnaeSwarm
|
|||||||
protected override void Tick()
|
protected override void Tick()
|
||||||
{
|
{
|
||||||
base.Tick();
|
base.Tick();
|
||||||
if (this.Wearer == null) return;
|
if (this.Wearer == null)
|
||||||
|
{
|
||||||
|
if (!this.Destroyed)
|
||||||
|
{
|
||||||
|
this.Destroy();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var fuelComp = this.GetComp<CompRefuelableNutrition>();
|
var fuelComp = this.GetComp<CompRefuelableNutrition>();
|
||||||
if (fuelComp != null)
|
if (fuelComp != null)
|
||||||
@@ -180,12 +187,8 @@ namespace ArachnaeSwarm
|
|||||||
GenPlace.TryPlaceThing(building, pawn.Position, pawn.Map, ThingPlaceMode.Near);
|
GenPlace.TryPlaceThing(building, pawn.Position, pawn.Map, ThingPlaceMode.Near);
|
||||||
Log.Message($"[PA_Debug] Notify_Unequipped: After spawning building (ID: {building.thingIDNumber}) - HitPoints: {building.HitPoints}, StackCount: {building.stackCount}");
|
Log.Message($"[PA_Debug] Notify_Unequipped: After spawning building (ID: {building.thingIDNumber}) - HitPoints: {building.HitPoints}, StackCount: {building.stackCount}");
|
||||||
|
|
||||||
// To prevent the game from spawning a duplicate item, we must destroy the apparel.
|
// The destruction is now handled by the Tick() method when it detects Wearer is null.
|
||||||
// However, using DestroyMode.Vanish or Kill can cause "Spawning destroyed thing" errors
|
// This is the safest way to implement delayed self-destruction.
|
||||||
// if called directly within Notify_Unequipped.
|
|
||||||
// DestroyMode.QuestLogic is the correct way: it marks the thing as destroyed
|
|
||||||
// but defers the actual cleanup until the end of the current tick, avoiding race conditions.
|
|
||||||
this.Destroy(DestroyMode.QuestLogic);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,10 @@ namespace ArachnaeSwarm
|
|||||||
apparelFuelComp.ReceiveFuel(buildingFuelComp.Fuel);
|
apparelFuelComp.ReceiveFuel(buildingFuelComp.Fuel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wear the apparel, ensuring it's not locked.
|
// Wear the apparel. The second argument 'false' is lockWhileWorn.
|
||||||
actor.apparel.Wear(apparel, false, true);
|
// The third argument 'false' is playerForced, which is CRITICAL.
|
||||||
|
// If playerForced is true, the game automatically locks the apparel.
|
||||||
|
actor.apparel.Wear(apparel, false, false);
|
||||||
|
|
||||||
// Despawn the building
|
// Despawn the building
|
||||||
building.DeSpawn();
|
building.DeSpawn();
|
||||||
|
|||||||
Reference in New Issue
Block a user