From 8b931facaf3c5abf9bdadc54287ad1af575167c8 Mon Sep 17 00:00:00 2001 From: Dhruva Sambrani <44899822+DhruvaSambrani@users.noreply.github.com> Date: Tue, 29 Mar 2022 22:35:34 +0530 Subject: [PATCH] Pocket append and drop are on the basis of itemname --- docs/items.md | 9 ++++++++- tetra/items.py | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/items.md b/docs/items.md index 783a97e..a2d79c9 100644 --- a/docs/items.md +++ b/docs/items.md @@ -32,7 +32,14 @@ code_file: "[string]" Pocket is a list of items that are "collected" by the user. This can be used to record what the user has seen, or to retain items which may be useful for the user to progress in the game. Pocket items can be [reinteracted](#interaction) with. Items can be marked as collectable in the [`.item` file](#.item-files) or can be added manually via [code file](#item-coding). -The game always starts with no items in the `Pocket`. +The game always initializes with no items in the `Pocket`. + +The function + +```py +Pocket.append(itemname, game) +Pocket.remove(itemname, game) +``` ## Interaction diff --git a/tetra/items.py b/tetra/items.py index e35e269..a98894e 100644 --- a/tetra/items.py +++ b/tetra/items.py @@ -172,8 +172,8 @@ def show_desc(self, win, name): [win[f"desc_{i.name}"].update(visible = False) for i in self.itemlist] win[f"desc_{name}"].update(visible = True) - def append(self, item): - self.itemlist.append(item) + def append(self, itemname, game): + self.itemlist.append(game.item(itemname)) - def drop(self, item): - self.remove(item) + def drop(self, itemname, game): + self.itemlist.remove(game.item(itemname))