diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-07-24 15:05:22 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-07-24 15:05:22 +0200 |
| commit | 337dee61ada57e1d44079822abc437b8fc168843 (patch) | |
| tree | 1a87534523882d8fc1d862df017396dbdd376f3b /spawn.go | |
| parent | e6e4ce18083ae5552563eab3291ac1642371d025 (diff) | |
refactor: Extract closest
Diffstat (limited to 'spawn.go')
| -rw-r--r-- | spawn.go | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -42,7 +42,7 @@ func UpdateSpawn(g *Game, spawn *ecs.Component[Spawn], position ecs.Component[ph if len(spawn.Value.Requests) == 0 || now.Sub(spawn.Value.Requests[0].start) < time.Duration(spawn.Value.UnitSpawnDuration) { return } - spawnPosition, _ := g.Closest(position.Value, physics.AdjacentPoints(position.Value)) + spawnPosition, _ := physics.Closest(position.Value, physics.AdjacentPoints(position.Value), g.getMoveMap()) unit := g.UnitBuilder.Build() unit.Position = ecs.C(spawnPosition) g.Entities = append(g.Entities, &unit) |
