Fix stashing
Now checks if object is stashable and clears the tile
This commit is contained in:
parent
2846ed796e
commit
00bdad6b40
1 changed files with 6 additions and 2 deletions
|
@ -258,9 +258,13 @@ func (w *World) RoverStash(id uuid.UUID) (byte, error) {
|
|||
if tile, err := w.Atlas.GetTile(r.Pos); err != nil {
|
||||
return objects.Empty, err
|
||||
} else {
|
||||
// TODO: Get if item grabbable and clear tile
|
||||
if tile != objects.Empty {
|
||||
if objects.IsStashable(tile) {
|
||||
r.Inventory = append(r.Inventory, Item{Type: tile})
|
||||
if err := w.Atlas.SetTile(r.Pos, objects.Empty); err != nil {
|
||||
return objects.Empty, err
|
||||
} else {
|
||||
return tile, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue