Files
ages/agame/util.py
Alek Ratzloff dd2128beb1 Initial commit with a mostly working engine.
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>
2021-11-18 11:31:21 -08:00

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