Basic commands are being parsed. I think the only weird part is the 'use' command because it needs to possibly target two things. A tiny test example is provided in __main__, this will probably be broken out later. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
12 lines
325 B
Python
12 lines
325 B
Python
from typing import Iterable, Optional, TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from agame.item import ItemInst
|
|
|
|
|
|
def search_item_name(seq: Iterable["ItemInst"], item_name: str) -> Optional["ItemInst"]:
|
|
for item in seq:
|
|
if item.name == item_name or item_name in item.synonyms:
|
|
return item
|
|
return None
|