diff options
Diffstat (limited to 'patrol_order.go')
| -rw-r--r-- | patrol_order.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/patrol_order.go b/patrol_order.go deleted file mode 100644 index e921e5b..0000000 --- a/patrol_order.go +++ /dev/null @@ -1,46 +0,0 @@ -package main - -import ( - "age_of_empires/ecs" - "age_of_empires/physics" - - "golang.org/x/exp/slog" -) - -type PatrolOrder struct { - origin physics.Point - destination physics.Point -} - -func UpdatePatrolSystem(moveMap physics.MoveMap, masks []ecs.Mask, orders []OrderKind, patrols []PatrolOrder, positions []physics.Point, moves []physics.Move) { - required := ecs.CM_Position | ecs.CM_Move | ecs.CM_Order | ecs.CM_PatrolOrder - for i, mask := range masks { - if mask&required == required { - order := orders[i] - patrol := patrols[i] - position := positions[i] - move := &moves[i] - if order == OrderKindPatrol && !move.IsActive { - if position == patrol.destination { - *move = physics.NewMove(position, patrol.origin, moveMap) - } else { - *move = physics.NewMove(position, patrol.destination, moveMap) - } - } - } - } -} - -func StartPatrolSystem(destination physics.Point, masks []ecs.Mask, positions []physics.Point, moves []physics.Move, orders []OrderKind, patrols []PatrolOrder) { - required := ecs.CM_Position | ecs.CM_Order | ecs.CM_PatrolOrder - for i, mask := range masks { - if mask&required == required { - position := positions[i] - order := &orders[i] - patrol := &patrols[i] - slog.Info("patrolling between", slog.String("origin", position.String()), slog.String("destination", destination.String())) - *patrol = PatrolOrder{origin: position, destination: destination} - *order = OrderKindPatrol - } - } -} |
