Add the concept of commands to the world and executing them

This commit is contained in:
Marc Di Luzio 2020-06-03 18:12:08 +01:00
parent 013a69fa63
commit e5d5d123a6
6 changed files with 163 additions and 19 deletions

View file

@ -155,7 +155,7 @@ type SpawnData struct {
type SpawnResponse struct {
BasicResponse
Position game.Position `json:"position"`
Position game.Vector `json:"position"`
}
// HandleSpawn will spawn the player entity for the associated account
@ -192,7 +192,8 @@ func (s *Server) HandleSpawn(w http.ResponseWriter, r *http.Request) {
fmt.Printf("\tspawn data: %v\n", data)
// Create a new instance
inst := s.world.CreateInstance()
inst := uuid.New()
s.world.Spawn(inst)
if pos, err := s.world.GetPosition(inst); err != nil {
response.Error = fmt.Sprint("No position found for created instance")