public override bool TryDoJob()
{
// keep track of work done
var workDone = false;
// clean up designations that were completed.
CleanDeadDesignations();
// clean up designations that are (now) in the wrong area.
CleanAreaDesignations();
// add designations in the game that could have been handled by this job
AddRelevantGameDesignations();
// designate plants until trigger is met.
int count = Trigger.CurCount + CurrentDesignatedCount;
if ( count < Trigger.Count )
{
List<Plant> targets = GetValidForagingTargetsSorted();
for ( var i = 0; i < targets.Count && count < Trigger.Count; i++ )
{
var des = new Designation( targets[i], DesignationDefOf.HarvestPlant );
count += targets[i].YieldNow();
AddDesignation( des );
workDone = true;
}
}
return workDone;
}