能量核心2补
This commit is contained in:
@@ -44,7 +44,44 @@ namespace WulaFallenEmpire
|
||||
|
||||
yield return Toils_Goto.GotoThing(PatientInd, PathEndMode.Touch);
|
||||
yield return Toils_Ingest.ChewIngestible(Patient, 1.5f, FoodSourceInd, TargetIndex.None).FailOnCannotTouch(PatientInd, PathEndMode.Touch);
|
||||
yield return Toils_Ingest.FinalizeIngest(Patient, FoodSourceInd);
|
||||
|
||||
// Custom Finalize Ingest Logic
|
||||
Toil finalizeToil = new Toil();
|
||||
finalizeToil.initAction = delegate
|
||||
{
|
||||
Pawn patient = Patient;
|
||||
Thing food = Food;
|
||||
if (patient == null || food == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If it's not an energy core, use the default vanilla method.
|
||||
if (food.def.defName != "WULA_Charge_Cube")
|
||||
{
|
||||
patient.needs.food.CurLevel += FoodUtility.GetNutrition(patient, food, food.def);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Our custom logic for energy core
|
||||
// 1. Apply the charging hediff
|
||||
Hediff hediff = HediffMaker.MakeHediff(HediffDef.Named("WULA_ChargingHediff"), patient);
|
||||
hediff.Severity = 1.0f;
|
||||
patient.health.AddHediff(hediff);
|
||||
|
||||
// 2. Spawn the used core
|
||||
Thing usedCore = ThingMaker.MakeThing(ThingDef.Named("WULA_Charge_Cube_No_Power"));
|
||||
GenPlace.TryPlaceThing(usedCore, pawn.Position, pawn.Map, ThingPlaceMode.Near);
|
||||
}
|
||||
|
||||
// Destroy the food item (it has been carried by the feeder)
|
||||
if (!food.Destroyed)
|
||||
{
|
||||
food.Destroy();
|
||||
}
|
||||
};
|
||||
finalizeToil.defaultCompleteMode = ToilCompleteMode.Instant;
|
||||
yield return finalizeToil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user