From 00bdad6b40f2ba98a08c841cbb1213248922b2b5 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 26 Jun 2020 19:47:01 +0100 Subject: [PATCH] Fix stashing Now checks if object is stashable and clears the tile --- pkg/game/world.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/game/world.go b/pkg/game/world.go index 31859a2..a1e57f4 100644 --- a/pkg/game/world.go +++ b/pkg/game/world.go @@ -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 + } } }