This commit is contained in:
2025-07-21 20:36:58 +08:00
parent 0f24b38d71
commit 94a099c774
11 changed files with 104 additions and 106 deletions

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
using Verse;
using Verse.AI;
using RimWorld; // Added for AbilityDef
namespace WulaFallenEmpire
{
public class JobDriver_CastEmergencyEnergyRestore : JobDriver
{
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return true;
}
protected override IEnumerable<Toil> MakeNewToils()
{
this.FailOnDespawnedOrNull(TargetIndex.A);
yield return new Toil
{
initAction = delegate
{
var ability = pawn.abilities.GetAbility(DefDatabase<AbilityDef>.GetNamed("WULA_EmergencyEnergyRestore"));
if (ability != null)
{
ability.Activate(pawn.Position, pawn);
}
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}