diff options
| -rw-r--r-- | gather_order.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gather_order.go b/gather_order.go index b306cd1..aee8b37 100644 --- a/gather_order.go +++ b/gather_order.go @@ -18,13 +18,12 @@ func (o *GatherOrder) Update(e *Entity, g *Game) { } gatherer := &e.ResourceGatherer.Value - source := gatherer.CurrentTarget.ResourceSource.Value if gatherer.CurrentVolume == gatherer.MaxCapacity { o.updateGathererFull(e, g, gatherer) return } if physics.Distance(e.Position.Value, gatherer.CurrentTarget.Position.Value) <= 100 { - o.updateGathering(gatherer, source) + o.updateGathering(gatherer, &gatherer.CurrentTarget.ResourceSource.Value) return } if !e.Move.Value.IsActive { @@ -32,7 +31,7 @@ func (o *GatherOrder) Update(e *Entity, g *Game) { } } -func (*GatherOrder) updateGathering(gatherer *ResourceGatherer, source ResourceSource) { +func (*GatherOrder) updateGathering(gatherer *ResourceGatherer, source *ResourceSource) { now := time.Now() if gatherer.CurrentVolume >= gatherer.MaxCapacity || gatherer.LastPickupTime.Add(200*time.Millisecond).After(now) { return |
