From a5fef758107888853c14a592696b45768ef56df8 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Fri, 4 Jul 2025 17:55:53 +0200 Subject: Refactor into packages --- patrol_order.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'patrol_order.go') diff --git a/patrol_order.go b/patrol_order.go index b7201ed..eb9dfb0 100644 --- a/patrol_order.go +++ b/patrol_order.go @@ -1,10 +1,14 @@ package main -import "golang.org/x/exp/slog" +import ( + "age_of_empires/physics" + + "golang.org/x/exp/slog" +) type PatrolOrder struct { - origin Point - destination Point + origin physics.Point + destination physics.Point } func (o *PatrolOrder) Update(e *Entity, g *Game) { @@ -12,15 +16,15 @@ func (o *PatrolOrder) Update(e *Entity, g *Game) { if !e.Move.Value.IsActive { moveMap := g.getMoveMap() if e.Position.Value == o.destination { - e.StartMove(o.origin, moveMap) + physics.StartMove(&e.Move, e.Position, o.origin, moveMap) } else { - e.StartMove(o.destination, moveMap) + physics.StartMove(&e.Move, e.Position, o.destination, moveMap) } } } } -func Patrol(e *Entity, destination Point) Order { +func Patrol(e *Entity, destination physics.Point) Order { if e.Selection.IsEnabled && e.Position.IsEnabled && e.Move.IsEnabled && e.Order.IsEnabled { if e.Selection.Value.IsSelected { origin := e.Position.Value -- cgit v1.3