Skip to content

Add storage containers #346

@dmccoystephenson

Description

@dmccoystephenson

Summary

Add craftable storage containers that can be placed in the world, accessed by right-clicking, and persisted between sessions.

Background

Currently the only way to store items outside the player's inventory is to place them directly in the world, which is lossy and inconvenient. A dedicated storage container entity would give players a proper item management option.

Requirements

Entity

  • Add a Chest entity (src/entity/chest.py) — solid, placeable, with a placeholder asset (assets/images/chest.png)

Crafting

  • Add a Chest recipe to RecipeRegistry (src/crafting/recipeRegistry.py), e.g. 6× OakWood

Interaction

  • Right-clicking a placed Chest in the world opens a chest inventory screen (similar to InventoryScreen)
  • The chest screen should display the chest's contents and allow items to be moved in/out
  • Left-click outside the chest panel drops cursor items (consistent with InventoryScreen behaviour)

Persistence

  • Chest contents must survive save/load cycles
  • Extend RoomJsonReaderWriter (src/world/roomJsonReaderWriter.py) to serialize/deserialize Chest entities and their contents
  • Follow the existing entity registry pattern in inventoryJsonReaderWriter.py and roomJsonReaderWriter.py when adding the new entity type

Pickup

  • Add Chest to the canBePickedUp() check in worldScreen.py (only when empty, to prevent item loss)

Acceptance Criteria

  • Chest can be crafted and placed in the world
  • Right-clicking a chest opens its inventory UI
  • Items can be moved between the player's inventory and the chest
  • Chest contents are saved to the room JSON and restored on load
  • A non-empty chest cannot be picked up
  • All existing tests pass; new tests cover chest save/load and the canBePickedUp guard

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions