Spawn a border around the world atlas for now
Also spawn the rover within a single chunk in the middle
This commit is contained in:
parent
cb725c96d2
commit
3781a4d10d
5 changed files with 59 additions and 5 deletions
|
@ -32,10 +32,15 @@ func NewWorld() *World {
|
|||
return &World{
|
||||
Rovers: make(map[uuid.UUID]Rover),
|
||||
CommandQueue: make(map[uuid.UUID]CommandStream),
|
||||
Atlas: NewAtlas(2, 8), // TODO: Choose an appropriate world size
|
||||
Atlas: NewAtlas(4, 8), // TODO: Choose an appropriate world size
|
||||
}
|
||||
}
|
||||
|
||||
// SpawnWorldBorder spawns a border at the edge of the world atlas
|
||||
func (w *World) SpawnWorldBorder() error {
|
||||
return w.Atlas.SpawnAtlasBorder()
|
||||
}
|
||||
|
||||
// SpawnRover adds an rover to the game
|
||||
func (w *World) SpawnRover() uuid.UUID {
|
||||
w.worldMutex.Lock()
|
||||
|
@ -56,8 +61,8 @@ func (w *World) SpawnRover() uuid.UUID {
|
|||
|
||||
// Spawn in a random place near the origin
|
||||
rover.Attributes.Pos = Vector{
|
||||
10 - (rand.Int() % 20),
|
||||
10 - (rand.Int() % 20),
|
||||
w.Atlas.ChunkSize - (rand.Int() % (w.Atlas.ChunkSize * 2)),
|
||||
w.Atlas.ChunkSize - (rand.Int() % (w.Atlas.ChunkSize * 2)),
|
||||
}
|
||||
|
||||
// TODO: Verify no blockages in this area
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue