Пример #1
0
def new_readEngine(base, xmlCtx, section, item, *args):
    base(xmlCtx, section, item, *args)
    nationID, _ = item.id
    sounds = item.sounds
    itemData = _config.data['engines'].get(nations.NAMES[nationID], {}).get(item.name, {})
    item.sounds = sound_components.WWTripleSoundConfig(sounds.wwsound, itemData.get('wwsoundPC', sounds.wwsoundPC),
                                                       itemData.get('wwsoundNPC', sounds.wwsoundNPC))
def readWWTripleSoundConfig(section):
    if IS_DEVELOPMENT:
        for name in ('sound', 'soundPC', 'soundNPC'):
            if section.has_key(name):
                raise SoftException(
                    'Section "[hull|engine]/{}" is no longer supported'.format(
                        name))

    return sound_components.WWTripleSoundConfig(
        intern(section.readString('wwsound',
                                  component_constants.EMPTY_STRING)),
        intern(
            section.readString('wwsoundPC', component_constants.EMPTY_STRING)),
        intern(
            section.readString('wwsoundNPC',
                               component_constants.EMPTY_STRING)))
Пример #3
0
def new_vehicleType_init(base, self, nationID, *args, **kwargs):
    base(self, nationID, *args, **kwargs)
    for item in self.engines:
        nationID, itemID = item.id
        sounds = item.sounds
        itemData = _config.data['engines'].get(nations.NAMES[nationID], {}).get(item.name, {})
        item.sounds = sound_components.WWTripleSoundConfig(sounds.wwsound, itemData.get('wwsoundPC', sounds.wwsoundPC),
                                                           itemData.get('wwsoundNPC', sounds.wwsoundNPC))
    for turrets in self.turrets:
        for turret in turrets:
            for item in turret.guns:
                nationID, itemID = item.id
                item.effects = items.vehicles.g_cache._gunEffects.get(
                    _config.data['guns'].get(self.name, {}).get(item.name, {}).get(
                        'effects',
                        _config.data['guns'].get(nations.NAMES[nationID], {}).get(item.name, {}).get('effects', '')),
                    item.effects)
Пример #4
0
def readWWTripleSoundConfig(section):
    """Reads WW sound configuration of hull or engine that contains 3 names of sounds: default sound,
        sound for current player, sound for other players.
    :param section: instance of DataSection.
    :return: instance of WWTripleSoundConfig.
    """
    if IS_DEVELOPMENT:
        for name in ('sound', 'soundPC', 'soundNPC'):
            if section.has_key(name):
                raise ValueError(
                    'Section "[hull|engine]/{}" is no longer supported'.format(
                        name))

    return sound_components.WWTripleSoundConfig(
        section.readString('wwsound', component_constants.EMPTY_STRING),
        section.readString('wwsoundPC', component_constants.EMPTY_STRING),
        section.readString('wwsoundNPC', component_constants.EMPTY_STRING))