Added chests, they are immortal and contain objects the player can take for free.
This commit is contained in:
@ -6,7 +6,7 @@ from typing import Any, Optional
|
||||
|
||||
from .display.texturepack import TexturePack
|
||||
from .entities.player import Player
|
||||
from .entities.friendly import Merchant
|
||||
from .entities.friendly import Merchant, Chest
|
||||
from .enums import GameMode, KeyValues, DisplayActions
|
||||
from .settings import Settings
|
||||
from .translations import gettext as _, Translator
|
||||
@ -158,3 +158,23 @@ class StoreMenu(Menu):
|
||||
Returns the values of the menu.
|
||||
"""
|
||||
return self.merchant.inventory if self.merchant else []
|
||||
|
||||
|
||||
class ChestMenu(Menu):
|
||||
"""
|
||||
A special instance of a menu : the menu for the inventory of a chest.
|
||||
"""
|
||||
chest: Chest = None
|
||||
|
||||
def update_chest(self, chest: Chest) -> None:
|
||||
"""
|
||||
Updates the player.
|
||||
"""
|
||||
self.chest = chest
|
||||
|
||||
@property
|
||||
def values(self) -> list:
|
||||
"""
|
||||
Returns the values of the menu.
|
||||
"""
|
||||
return self.chest.inventory if self.chest else []
|
||||
|
Reference in New Issue
Block a user