Пример #1
0
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
Пример #2
0
def env_items(key_type, target_key, entity, *_):
    return recursive_targets(key_type, [item for item in entity.env.inven], target_key)
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
def env_living(key_type, target_key, entity, *_):
    return recursive_targets(key_type, (living for living in entity.env.denizens),  target_key)
Пример #6
0
def feature(key_type, target_key, entity, *_):
    return recursive_targets(key_type, (feature for feature in entity.env.features), target_key)