Move the account registration into the world

This commit is contained in:
Marc Di Luzio 2020-07-24 22:50:35 +01:00
parent 6f2d67bd7c
commit fdfcc88540
2 changed files with 1 additions and 13 deletions

View file

@ -210,17 +210,5 @@ func (s *Server) SpawnRoverForAccount(account string) (string, error) {
return "", err
}
err = s.world.Accountant.AssignData(account, "rover", inst)
if err != nil {
log.Printf("Failed to assign rover to account, %s", err)
// Try and clear up the rover
if err := s.world.DestroyRover(inst); err != nil {
log.Printf("Failed to destroy rover after failed rover assign: %s", err)
}
return "", err
}
return inst, nil
}

View file

@ -97,7 +97,7 @@ func (w *World) SpawnRover(account string) (string, error) {
// Append the rover to the list
w.Rovers[rover.Name] = rover
return rover.Name, nil
return rover.Name, w.Accountant.AssignData(account, "rover", rover.Name)
}
// GetRover gets a specific rover by name