aboutsummaryrefslogtreecommitdiff
path: root/order.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2023-10-06 09:21:07 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2023-10-06 09:21:07 +0200
commitad119e88258cf6add42c9570b7a2b7b591fd0b99 (patch)
tree3257ed5ef24c19d2f50ea044a3c842b506be5a20 /order.go
parent987aa73f11f4c5fbc7136313c77aaad42e7e9edd (diff)
feat(order): Gather resources
Diffstat (limited to 'order.go')
-rw-r--r--order.go33
1 files changed, 0 insertions, 33 deletions
diff --git a/order.go b/order.go
index 6836954..5716731 100644
--- a/order.go
+++ b/order.go
@@ -1,31 +1,9 @@
package main
-import (
- "golang.org/x/exp/slog"
-)
-
type Order interface {
Update(e *Entity, g *Game)
}
-type PatrolOrder struct {
- origin Point
- destination Point
-}
-
-func (o *PatrolOrder) Update(e *Entity, g *Game) {
- if e.Position.IsEnabled && e.Move.IsEnabled && e.Order.IsEnabled {
- if !e.Move.Value.IsActive {
- moveMap := g.getMoveMap()
- if e.Position.Value == o.destination {
- e.StartMove(o.origin, moveMap)
- } else {
- e.StartMove(o.destination, moveMap)
- }
- }
- }
-}
-
func (e *Entity) UpdateOrder(g *Game) {
if e.Order.IsEnabled {
if e.Order.Value != nil {
@@ -33,14 +11,3 @@ func (e *Entity) UpdateOrder(g *Game) {
}
}
}
-
-func Patrol(e *Entity, destination Point) Order {
- if e.Selection.IsEnabled && e.Position.IsEnabled && e.Move.IsEnabled && e.Order.IsEnabled {
- if e.Selection.Value.IsSelected {
- origin := e.Position.Value
- slog.Info("patrolling between", slog.String("origin", origin.String()), slog.String("destination", destination.String()))
- e.Order.Value = &PatrolOrder{origin: origin, destination: destination}
- }
- }
- return &PatrolOrder{origin: e.Position.Value, destination: destination}
-}