qol: take multiple items at once
This commit is contained in:
parent
e89959a32a
commit
171b9b13c8
1 changed files with 14 additions and 0 deletions
14
setage.py
14
setage.py
|
@ -453,6 +453,19 @@ class SetageShell(Cmd):
|
|||
if arg == "":
|
||||
print("> What should I take?")
|
||||
return
|
||||
elif len(arg.split(",")) > 1:
|
||||
for item in [a.strip() for a in arg.split(",")]:
|
||||
if "items" not in cur_room:
|
||||
print("> I don't see anything that I could take...")
|
||||
return
|
||||
if len(cur_room["items"]) == 0:
|
||||
print("> I don't see anything that I could take...")
|
||||
return
|
||||
if item in cur_room["items"].keys():
|
||||
inventory.update({item: cur_room["items"].pop(item)})
|
||||
print(f"{item} added to inventory.")
|
||||
else:
|
||||
print("> I don't see anything like that...")
|
||||
elif arg:
|
||||
if "items" not in cur_room:
|
||||
print("> I don't see anything that I could take...")
|
||||
|
@ -477,6 +490,7 @@ class SetageShell(Cmd):
|
|||
if not text:
|
||||
return list(items)
|
||||
else:
|
||||
# FIXME: handle multiple items
|
||||
return [comp for comp in items if comp.startswith(text)]
|
||||
|
||||
def do_inventory(self, arg):
|
||||
|
|
Loading…
Reference in a new issue