public override Activity Tick(Actor self) { if (IsCanceled) { claimLayer.RemoveClaim(self); return(NextActivity); } harv.LastHarvestedCell = self.Location; if (harv.IsFull) { claimLayer.RemoveClaim(self); return(NextActivity); } // Turn to one of the harvestable facings if (harvInfo.HarvestFacings != 0) { var current = facing.Facing; var desired = body.QuantizeFacing(current, harvInfo.HarvestFacings); if (desired != current) { return(ActivityUtils.SequenceActivities(new Turn(self, desired), this)); } } var resource = resLayer.Harvest(self.Location); if (resource == null) { claimLayer.RemoveClaim(self); return(NextActivity); } harv.AcceptResource(resource); foreach (var t in self.TraitsImplementing <INotifyHarvesterAction>()) { t.Harvested(self, resource); } return(ActivityUtils.SequenceActivities(new Wait(harvInfo.BaleLoadDelay), this)); }
protected override void OnLastRun(Actor self) { claimLayer.RemoveClaim(self); }