Simplify duplicate command types

This commit is contained in:
Marc Di Luzio 2020-06-06 12:45:45 +01:00
parent 97d3583384
commit e3ce87e964
8 changed files with 28 additions and 56 deletions

View file

@ -15,7 +15,6 @@ import (
"github.com/mdiluz/rove/pkg/accounts"
"github.com/mdiluz/rove/pkg/game"
"github.com/mdiluz/rove/pkg/persistence"
"github.com/mdiluz/rove/pkg/rove"
)
const (
@ -195,19 +194,3 @@ func (s *Server) SpawnRoverForAccount(accountid uuid.UUID) (game.Vector, uuid.UU
}
}
}
// ConvertCommands converts server commands to game commands
func (s *Server) ConvertCommands(commands []rove.Command, inst uuid.UUID) ([]game.Command, error) {
var cmds []game.Command
for _, c := range commands {
switch c.Command {
case rove.CommandMove:
if bearing, err := game.DirectionFromString(c.Bearing); err != nil {
return nil, err
} else {
cmds = append(cmds, s.world.CommandMove(inst, bearing, c.Duration))
}
}
}
return cmds, nil
}