Try and clean up a failed primary instance creation
This commit is contained in:
parent
78774329a8
commit
a0657b32e7
3 changed files with 53 additions and 10 deletions
pkg/game
|
@ -47,6 +47,16 @@ func (w *World) CreateInstance() uuid.UUID {
|
|||
return id
|
||||
}
|
||||
|
||||
// Removes an instance from the game
|
||||
func (w *World) DestroyInstance(id uuid.UUID) error {
|
||||
if _, ok := w.Instances[id]; ok {
|
||||
delete(w.Instances, id)
|
||||
} else {
|
||||
return fmt.Errorf("no instance matching id")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPosition returns the position of a given instance
|
||||
func (w World) GetPosition(id uuid.UUID) (Position, error) {
|
||||
if i, ok := w.Instances[id]; ok {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue