24 lines
633 B
Go
24 lines
633 B
Go
package game
|
|
|
|
import "github.com/google/uuid"
|
|
|
|
// A command is simply a function that acts on the a given instance in the world
|
|
type Command func() error
|
|
|
|
// CommandMove will move the instance in question
|
|
func (w *World) CommandMove(id uuid.UUID, bearing float64, duration int64) Command {
|
|
return func() error {
|
|
// TODO: Calculate the move itself
|
|
|
|
//_, err := w.MovePosition(id, vec)
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// CommandSpawn
|
|
// TODO: Two spawn commands with the same id could trigger a fail later on, we should prevent that somehow
|
|
func (w *World) CommandSpawn(id uuid.UUID) Command {
|
|
return func() error {
|
|
return w.Spawn(id)
|
|
}
|
|
}
|