aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-07-08 23:37:08 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-07-08 23:37:08 +0200
commitee4c612c2a1ec1b98cddea11bfd74fe9afbe85a6 (patch)
tree0df9e2d5ef63fd31974bf0974975428435e2ca1b
parent2b05b9d8aa47f6cc9d768c6758f1cca4e8721a4c (diff)
Really decrease resource count
-rw-r--r--gather_order.go5
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