Summary
When the player dies, spawn a Gravestone entity at their location containing all dropped items. The player can right-click it to retrieve everything at once. Implement item storage on the entity in a way that can be reused by chests in the future.
Background
Currently checkForLivingEntityDeaths() in worldScreen.py drops the player's inventory items directly onto the ground as individual entities. Retrieving them after respawning requires picking up each item one by one. A gravestone that holds the items as a collection would be much less tedious and naturally leads toward a reusable storage interface needed for chests (see #346).
Requirements
Shared Storage Interface
- Create a
StorableInventory mixin or base class (e.g. src/entity/storableEntity.py) that holds an Inventory instance and exposes getStoredInventory() — this same interface should be used by the future Chest entity
Gravestone Entity
- Add
Gravestone (src/entity/gravestone.py) — solid, not craftable, not directly pickupable, with a placeholder asset (assets/images/gravestone.png)
Gravestone uses StorableInventory to hold the player's dropped items
On Player Death
- In
worldScreen.py checkForLivingEntityDeaths(), instead of scattering individual items into the room, create a Gravestone, transfer the full player inventory into its stored inventory, and place it at the player's last known location
Interaction
- Right-clicking a
Gravestone in the world transfers all stored items into the player's inventory (using placeIntoFirstAvailableInventorySlot) and removes the Gravestone from the room
- If the player's inventory is full, set a status message via
status.set("Inventory full") and leave the gravestone in place
Persistence
- Extend
RoomJsonReaderWriter (src/world/roomJsonReaderWriter.py) to serialize/deserialize Gravestone entities including their stored inventory contents
- Follow the existing entity registry pattern in
roomJsonReaderWriter.py and inventoryJsonReaderWriter.py
Pickup / Placement Guards
Gravestone should not appear in canBePickedUp() in worldScreen.py
Gravestone should not appear in the crafting registry
Acceptance Criteria
Summary
When the player dies, spawn a
Gravestoneentity at their location containing all dropped items. The player can right-click it to retrieve everything at once. Implement item storage on the entity in a way that can be reused by chests in the future.Background
Currently
checkForLivingEntityDeaths()inworldScreen.pydrops the player's inventory items directly onto the ground as individual entities. Retrieving them after respawning requires picking up each item one by one. A gravestone that holds the items as a collection would be much less tedious and naturally leads toward a reusable storage interface needed for chests (see #346).Requirements
Shared Storage Interface
StorableInventorymixin or base class (e.g.src/entity/storableEntity.py) that holds anInventoryinstance and exposesgetStoredInventory()— this same interface should be used by the futureChestentityGravestone Entity
Gravestone(src/entity/gravestone.py) — solid, not craftable, not directly pickupable, with a placeholder asset (assets/images/gravestone.png)GravestoneusesStorableInventoryto hold the player's dropped itemsOn Player Death
worldScreen.pycheckForLivingEntityDeaths(), instead of scattering individual items into the room, create aGravestone, transfer the full player inventory into its stored inventory, and place it at the player's last known locationInteraction
Gravestonein the world transfers all stored items into the player's inventory (usingplaceIntoFirstAvailableInventorySlot) and removes theGravestonefrom the roomstatus.set("Inventory full")and leave the gravestone in placePersistence
RoomJsonReaderWriter(src/world/roomJsonReaderWriter.py) to serialize/deserializeGravestoneentities including their stored inventory contentsroomJsonReaderWriter.pyandinventoryJsonReaderWriter.pyPickup / Placement Guards
Gravestoneshould not appear incanBePickedUp()inworldScreen.pyGravestoneshould not appear in the crafting registryAcceptance Criteria
Gravestoneis spawned at the player's location containing all dropped itemsStorableInventoryis decoupled enough to be reused by the futureChestentity (Add storage containers #346)