def env(key_type, target_key, entity, *_): for extra in entity.env.extras: try: if target_key in getattr(extra.target_keys, key_type): yield extra except AttributeError: pass for target in recursive_targets(key_type, getattr(extra, 'target_providers', ()), target_key): yield target
def env_items(key_type, target_key, entity, *_): return recursive_targets(key_type, [item for item in entity.env.inven], target_key)
def equip(key_type, target_key, entity, *_): return recursive_targets(key_type, [equip for equip in entity.inven if getattr(equip, 'current_slot', None)], target_key)
def player_env(key_type, target_key, entity, *_): return recursive_targets(key_type, (denizen for denizen in entity.env.denizens if getattr(denizen, 'is_player', False) and denizen != entity), target_key)
def env_living(key_type, target_key, entity, *_): return recursive_targets(key_type, (living for living in entity.env.denizens), target_key)
def feature(key_type, target_key, entity, *_): return recursive_targets(key_type, (feature for feature in entity.env.features), target_key)