示例#1
0
def readWheelsAndGroups(xmlCtx, section):
    """Reads sections 'wheels/group' and 'wheels/wheel' for each chassis.
    :param xmlCtx: tuple(root ctx or None, path to section).
    :param section: instance of DataSection.
    :return: tuple(sequence of groups, sequence of wheels).
    """
    wheelGroups = []
    wheels = []
    defSyncAngle = section.readFloat('wheels/leadingWheelSyncAngle', 60)
    for sname, subsection in _xml.getChildren(xmlCtx, section, 'wheels'):
        if sname == 'group':
            ctx = (xmlCtx, 'wheels/group')
            group = chassis_components.WheelGroup(
                isLeft=_xml.readBool(ctx, subsection, 'isLeft'),
                template=_xml.readNonEmptyString(ctx, subsection, 'template'),
                count=_xml.readInt(ctx, subsection, 'count', 1),
                startIndex=subsection.readInt('startIndex', 0),
                radius=_xml.readPositiveFloat(ctx, subsection, 'radius'))
            wheelGroups.append(group)
        elif sname == 'wheel':
            ctx = (xmlCtx, 'wheels/wheel')
            w = chassis_components.Wheel(
                isLeft=_xml.readBool(ctx, subsection, 'isLeft'),
                radius=_xml.readPositiveFloat(ctx, subsection, 'radius'),
                nodeName=_xml.readNonEmptyString(ctx, subsection, 'name'),
                isLeading=subsection.readBool('isLeading', False),
                leadingSyncAngle=subsection.readFloat('syncAngle',
                                                      defSyncAngle))
            wheels.append(w)

    return (tuple(wheelGroups), tuple(wheels))
示例#2
0
 def _readConfig(self, xmlCtx, section):
     self.delay = _xml.readPositiveFloat(xmlCtx, section, 'delay')
     self.modelName = _xml.readString(xmlCtx, section, 'modelName')
     if IS_CLIENT:
         self.soundEvent = _xml.readString(xmlCtx, section, 'wwsoundEvent')
     self.speed = _xml.readInt(xmlCtx, section, 'speed')
     self.heights = _xml.readTupleOfPositiveInts(xmlCtx, section, 'heights', 2)
     self.areaLength = _xml.readPositiveFloat(xmlCtx, section, 'areaLength')
     self.areaWidth = _xml.readPositiveFloat(xmlCtx, section, 'areaWidth')
     self.antepositions = _xml.readTupleOfFloats(xmlCtx, section, 'antepositions')
     self.lateropositions = _xml.readTupleOfFloats(xmlCtx, section, 'lateropositions')
     self.bombingMask = tuple((bool(v) for v in _xml.readTupleOfInts(xmlCtx, section, 'bombingMask')))
     if not len(self.antepositions) == len(self.lateropositions) == len(self.bombingMask):
         _xml.raiseWrongSection(xmlCtx, 'bombers number mismatch')
     self.waveFraction = _xml.readPositiveFloat(xmlCtx, section, 'waveFraction')
     self.bombsNumber = _xml.readNonNegativeInt(xmlCtx, section, 'bombsNumber')
     self.shellCompactDescr = _xml.readInt(xmlCtx, section, 'shellCompactDescr')
     self.tracerKind = _xml.readInt(xmlCtx, section, 'tracerKind')
     self.piercingPower = _xml.readTupleOfPositiveInts(xmlCtx, section, 'piercingPower', 2)
     self.gravity = _xml.readPositiveFloat(xmlCtx, section, 'gravity')
     self.areaVisual = _xml.readStringOrNone(xmlCtx, section, 'areaVisual')
     self.areaColor = _xml.readIntOrNone(xmlCtx, section, 'areaColor')
     self.areaMarker = _xml.readStringOrNone(xmlCtx, section, 'areaMarker')
     self.reusable = _xml.readBool(xmlCtx, section, 'reusable')
     self.cooldownTime = _xml.readNonNegativeFloat(xmlCtx, section, 'cooldownTime') if self.reusable else 0.0
     self.deployTime = _xml.readNonNegativeFloat(xmlCtx, section, 'deployTime')
示例#3
0
def readWheelsAndGroups(xmlCtx, section):
    wheelGroups = []
    wheels = []
    defSyncAngle = section.readFloat('wheels/leadingWheelSyncAngle', 60)
    for sname, subsection in _xml.getChildren(xmlCtx, section, 'wheels'):
        if sname == 'group':
            ctx = (xmlCtx, 'wheels/group')
            group = chassis_components.WheelGroup(
                isLeft=_xml.readBool(ctx, subsection, 'isLeft'),
                template=intern(
                    _xml.readNonEmptyString(ctx, subsection, 'template')),
                count=_xml.readInt(ctx, subsection, 'count', 1),
                startIndex=subsection.readInt('startIndex', 0),
                radius=_xml.readPositiveFloat(ctx, subsection, 'radius'))
            wheelGroups.append(group)
        if sname == 'wheel':
            ctx = (xmlCtx, 'wheels/wheel')
            w = chassis_components.Wheel(
                isLeft=_xml.readBool(ctx, subsection, 'isLeft'),
                radius=_xml.readPositiveFloat(ctx, subsection, 'radius'),
                nodeName=intern(
                    _xml.readNonEmptyString(ctx, subsection, 'name')),
                isLeading=subsection.readBool('isLeading', False),
                leadingSyncAngle=subsection.readFloat('syncAngle',
                                                      defSyncAngle))
            wheels.append(w)

    return (tuple(wheelGroups), tuple(wheels))
示例#4
0
def _readCommanderEagleEye(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res['distanceFactorPerLevelWhenDeviceWorking'] = _xml.readPositiveFloat(
        xmlCtx, section, 'distanceFactorPerLevelWhenDeviceWorking')
    res['distanceFactorPerLevelWhenDeviceDestroyed'] = _xml.readPositiveFloat(
        xmlCtx, section, 'distanceFactorPerLevelWhenDeviceDestroyed')
    return res
示例#5
0
def _readBadRoadsKing(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res['softGroundResistanceFactorPerLevel'] = _xml.readPositiveFloat(
        xmlCtx, section, 'softGroundResistanceFactorPerLevel')
    res['mediumGroundResistanceFactorPerLevel'] = _xml.readPositiveFloat(
        xmlCtx, section, 'mediumGroundResistanceFactorPerLevel')
    return res
示例#6
0
def readShot(xmlCtx, section, nationID, projectileSpeedFactor, cache):
    """Reads section 'gun/shots/<shell_name>'.
    :param xmlCtx: tuple(root ctx or None, path to section).
    :param section: instance of DataSection.
    :param nationID: integer containing ID of nation.
    :param projectileSpeedFactor: float containing factor that is applied to projectile speeds and
        gravities at reading from configs.
    :param cache: instance of vehicles.Cache to get desired shell by name.
    :return: instance of GunShot.
    """
    shellName = section.name
    shellID = cache.shellIDs(nationID).get(shellName)
    if shellID is None:
        _xml.raiseWrongXml(xmlCtx, '', 'unknown shell type name')
    shellDescr = cache.shells(nationID)[shellID]
    return gun_components.GunShot(
        shellDescr,
        0.0 if not section.has_key('defaultPortion') else _xml.readFraction(
            xmlCtx, section, 'defaultPortion'),
        _xml.readVector2(xmlCtx, section, 'piercingPower'),
        _xml.readPositiveFloat(xmlCtx, section, 'speed') *
        projectileSpeedFactor,
        _xml.readNonNegativeFloat(xmlCtx, section, 'gravity') *
        projectileSpeedFactor**2,
        _xml.readPositiveFloat(xmlCtx, section, 'maxDistance'),
        section.readFloat('maxHeight', 1000000.0))
示例#7
0
 def _readConfig(self, xmlCtx, section):
     self.delay = _xml.readPositiveFloat(xmlCtx, section, 'delay')
     self.modelName = _xml.readString(xmlCtx, section, 'modelName')
     self.soundEvent = _xml.readString(xmlCtx, section, 'soundEvent')
     self.speed = _xml.readInt(xmlCtx, section, 'speed')
     self.heights = _xml.readTupleOfPositiveInts(xmlCtx, section, 'heights', 2)
     self.areaLength = _xml.readPositiveFloat(xmlCtx, section, 'areaLength')
     self.areaWidth = _xml.readPositiveFloat(xmlCtx, section, 'areaWidth')
     self.antepositions = _xml.readTupleOfFloats(xmlCtx, section, 'antepositions')
     self.lateropositions = _xml.readTupleOfFloats(xmlCtx, section, 'lateropositions')
     self.bombingMask = tuple((bool(v) for v in _xml.readTupleOfInts(xmlCtx, section, 'bombingMask')))
     if not len(self.antepositions) == len(self.lateropositions) == len(self.bombingMask):
         _xml.raiseWrongSection(xmlCtx, 'bombers number mismatch')
     self.waveFraction = _xml.readPositiveFloat(xmlCtx, section, 'waveFraction')
     self.bombsNumber = _xml.readNonNegativeInt(xmlCtx, section, 'bombsNumber')
     self.shellCompactDescr = _xml.readInt(xmlCtx, section, 'shellCompactDescr')
     self.tracerKind = _xml.readInt(xmlCtx, section, 'tracerKind')
     self.piercingPower = _xml.readTupleOfPositiveInts(xmlCtx, section, 'piercingPower', 2)
     self.gravity = _xml.readPositiveFloat(xmlCtx, section, 'gravity')
     self.areaVisual = _xml.readStringOrNone(xmlCtx, section, 'areaVisual')
     self.areaColor = _xml.readIntOrNone(xmlCtx, section, 'areaColor')
     self.areaMarker = _xml.readStringOrNone(xmlCtx, section, 'areaMarker')
     self.reusable = _xml.readBool(xmlCtx, section, 'reusable')
     self.cooldownTime = _xml.readNonNegativeFloat(xmlCtx, section, 'cooldownTime') if self.reusable else 0.0
     self.deployTime = _xml.readNonNegativeFloat(xmlCtx, section, 'deployTime')
def readWheelsAndGroups(xmlCtx, section):
    wheelGroups = []
    wheels = []
    wheelId = 0
    defSyncAngle = section.readFloat('wheels/leadingWheelSyncAngle', 60)
    for sname, subsection in _xml.getChildren(xmlCtx, section, 'wheels'):
        if sname == 'group':
            ctx = (xmlCtx, 'wheels/group')
            group = chassis_components.WheelGroup(
                isLeft=_xml.readBool(ctx, subsection, 'isLeft'),
                template=intern(
                    _xml.readNonEmptyString(ctx, subsection, 'template')),
                count=_xml.readInt(ctx, subsection, 'count', 1),
                startIndex=subsection.readInt('startIndex', 0),
                radius=_xml.readPositiveFloat(ctx, subsection, 'radius'))
            wheelGroups.append(group)
        if sname == 'wheel':
            from items.vehicles import _readHitTester, _readArmor
            ctx = (xmlCtx, 'wheels/wheel[{}]'.format(wheelId))
            radiusKey = 'radius' if subsection.has_key(
                'radius') else 'geometry/radius'
            index = _xml.readIntOrNone(ctx, subsection, 'index')
            actualIndex = wheelId if index is None else index
            w = chassis_components.Wheel(
                index=index,
                isLeft=_xml.readBool(ctx, subsection, 'isLeft'),
                radius=_xml.readPositiveFloat(ctx, subsection, radiusKey),
                nodeName=intern(
                    _xml.readNonEmptyString(ctx, subsection, 'name')),
                isLeading=subsection.readBool('isLeading', False),
                leadingSyncAngle=subsection.readFloat('syncAngle',
                                                      defSyncAngle),
                hitTester=_readHitTester(ctx,
                                         subsection,
                                         'hitTester',
                                         optional=True),
                materials=_readArmor(ctx,
                                     subsection,
                                     'armor',
                                     optional=True,
                                     index=actualIndex),
                position=subsection.readVector3('wheelPos', (0, 0, 0)))
            if IS_EDITOR:
                w.editorData.defSyncAngle = defSyncAngle
            wheels.append(w)
            wheelId += 1

    wheelIndices = [wheel.index for wheel in wheels]
    if sorted(wheelIndices) == range(len(wheels)):
        sortedWheels = [None] * len(wheels)
        for wheel in wheels:
            sortedWheels[wheel.index] = wheel

        wheels = sortedWheels
    elif wheelIndices == [None] * len(wheels):
        pass
    else:
        LOG_ERROR('Invalid wheel index detected', xmlCtx, wheels)
    return (tuple(wheelGroups), tuple(wheels))
def _readDriverBadRoadsKing(xmlCtx, section, subsectionName):
    skill, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    return skills_components.DriverBadRoadsKingSkill(
        skill,
        _xml.readPositiveFloat(xmlCtx, section,
                               'softGroundResistanceFactorPerLevel'),
        _xml.readPositiveFloat(xmlCtx, section,
                               'mediumGroundResistanceFactorPerLevel'))
def _readCommanderEagleEye(xmlCtx, section, subsectionName):
    skill, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    return skills_components.CommanderEagleEyeSkill(
        skill,
        _xml.readPositiveFloat(xmlCtx, section,
                               'distanceFactorPerLevelWhenDeviceWorking'),
        _xml.readPositiveFloat(xmlCtx, section,
                               'distanceFactorPerLevelWhenDeviceDestroyed'))
示例#11
0
def _readBadRoadsKing(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res["softGroundResistanceFactorPerLevel"] = _xml.readPositiveFloat(
        xmlCtx, section, "softGroundResistanceFactorPerLevel"
    )
    res["mediumGroundResistanceFactorPerLevel"] = _xml.readPositiveFloat(
        xmlCtx, section, "mediumGroundResistanceFactorPerLevel"
    )
    return res
示例#12
0
def _readCommanderEagleEye(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res["distanceFactorPerLevelWhenDeviceWorking"] = _xml.readPositiveFloat(
        xmlCtx, section, "distanceFactorPerLevelWhenDeviceWorking"
    )
    res["distanceFactorPerLevelWhenDeviceDestroyed"] = _xml.readPositiveFloat(
        xmlCtx, section, "distanceFactorPerLevelWhenDeviceDestroyed"
    )
    return res
示例#13
0
 def _readConfig(self, xmlCtx, section):
     self.delay = _xml.readPositiveFloat(xmlCtx, section, 'delay')
     self.duration = _xml.readPositiveFloat(xmlCtx, section, 'duration')
     self.shotsNumber = _xml.readNonNegativeInt(xmlCtx, section, 'shotsNumber')
     self.areaRadius = _xml.readPositiveFloat(xmlCtx, section, 'areaRadius')
     self.shellCompactDescr = _xml.readInt(xmlCtx, section, 'shellCompactDescr')
     self.piercingPower = _xml.readTupleOfPositiveInts(xmlCtx, section, 'piercingPower', 2)
     self.areaVisual = _xml.readStringOrNone(xmlCtx, section, 'areaVisual')
     self.areaColor = _xml.readIntOrNone(xmlCtx, section, 'areaColor')
     self.areaMarker = _xml.readStringOrNone(xmlCtx, section, 'areaMarker')
     self.areaLength = self.areaWidth = self.areaRadius * 2
     self.reusable = _xml.readBool(xmlCtx, section, 'reusable')
     self.cooldownTime = _xml.readNonNegativeFloat(xmlCtx, section, 'cooldownTime') if self.reusable else 0.0
     self.deployTime = _xml.readNonNegativeFloat(xmlCtx, section, 'deployTime')
示例#14
0
 def _readConfig(self, xmlCtx, section):
     self.delay = _xml.readPositiveFloat(xmlCtx, section, 'delay')
     self.duration = _xml.readPositiveFloat(xmlCtx, section, 'duration')
     self.shotsNumber = _xml.readNonNegativeInt(xmlCtx, section, 'shotsNumber')
     self.areaRadius = _xml.readPositiveFloat(xmlCtx, section, 'areaRadius')
     self.shellCompactDescr = _xml.readInt(xmlCtx, section, 'shellCompactDescr')
     self.piercingPower = _xml.readTupleOfPositiveInts(xmlCtx, section, 'piercingPower', 2)
     self.areaVisual = _xml.readStringOrNone(xmlCtx, section, 'areaVisual')
     self.areaColor = _xml.readIntOrNone(xmlCtx, section, 'areaColor')
     self.areaMarker = _xml.readStringOrNone(xmlCtx, section, 'areaMarker')
     self.areaLength = self.areaWidth = self.areaRadius * 2
     self.reusable = _xml.readBool(xmlCtx, section, 'reusable')
     self.cooldownTime = _xml.readNonNegativeFloat(xmlCtx, section, 'cooldownTime') if self.reusable else 0.0
     self.deployTime = _xml.readNonNegativeFloat(xmlCtx, section, 'deployTime')
示例#15
0
 def _readConfig(self, xmlCtx, section):
     if not section.has_key('fireStartingChanceFactor'):
         self.fireStartingChanceFactor = 1.0
     else:
         self.fireStartingChanceFactor = _xml.readPositiveFloat(
             xmlCtx, section, 'fireStartingChanceFactor')
     self.autoactivate = section.readBool('autoactivate', False)
示例#16
0
def readEmblemSlots(xmlCtx, section, subsectionName):
    """Reads section 'emblemSlots' to fetch sequence of emblem slots if they exist.
    :param xmlCtx: tuple(root ctx or None, path to section).
    :param section: instance of DataSection.
    :param subsectionName: string containing name of section to find slots configuration.
    :return: tuple containing EmblemSlot items.
    """
    slots = []
    for sname, subsection in _xml.getChildren(xmlCtx, section, subsectionName):
        if sname not in component_constants.ALLOWED_EMBLEM_SLOTS:
            _xml.raiseWrongXml(xmlCtx, 'emblemSlots/{}'.format(sname),
                               'expected {}'.format(_ALLOWED_EMBLEM_SLOTS))
        ctx = (xmlCtx, 'emblemSlots/{}'.format(sname))
        descr = shared_components.EmblemSlot(
            _xml.readVector3(ctx, subsection, 'rayStart'),
            _xml.readVector3(ctx, subsection, 'rayEnd'),
            _xml.readVector3(ctx, subsection, 'rayUp'),
            _xml.readPositiveFloat(ctx, subsection, 'size'),
            subsection.readBool('hideIfDamaged', False),
            _ALLOWED_EMBLEM_SLOTS[_ALLOWED_EMBLEM_SLOTS.index(sname)],
            subsection.readBool('isMirrored', False),
            subsection.readBool('isUVProportional', True),
            _xml.readIntOrNone(ctx, subsection, 'emblemId'))
        slots.append(descr)

    return tuple(slots)
示例#17
0
def _readLoaderDesperado(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res['vehicleHealthFraction'] = _xml.readFraction(xmlCtx, section,
                                                     'vehicleHealthFraction')
    res['gunReloadTimeFactor'] = _xml.readPositiveFloat(
        xmlCtx, section, 'gunReloadTimeFactor')
    return res
示例#18
0
def readShot(xmlCtx, section, nationID, projectileSpeedFactor, cache):
    shellName = section.name
    shellID = cache.shellIDs(nationID).get(shellName)
    if shellID is None:
        _xml.raiseWrongXml(xmlCtx, '', 'unknown shell type name')
    shellDescr = cache.shells(nationID)[shellID]
    return gun_components.GunShot(
        shellDescr, ZERO_FLOAT if not section.has_key('defaultPortion') else
        _xml.readFraction(xmlCtx, section, 'defaultPortion'),
        _xml.readVector2(xmlCtx, section, 'piercingPower'),
        _xml.readPositiveFloat(xmlCtx, section, 'speed') *
        projectileSpeedFactor,
        _xml.readNonNegativeFloat(xmlCtx, section, 'gravity') *
        projectileSpeedFactor**2,
        _xml.readPositiveFloat(xmlCtx, section, 'maxDistance'),
        _xml.readFloat(xmlCtx, section, 'maxHeight', 1000000.0))
def _readEmblemSlot(ctx, subsection, slotType):
    descr = shared_components.EmblemSlot(
        _xml.readVector3(ctx, subsection, 'rayStart'),
        _xml.readVector3(ctx, subsection, 'rayEnd'),
        _xml.readVector3(ctx, subsection, 'rayUp'),
        _xml.readPositiveFloat(ctx, subsection, 'size'),
        subsection.readBool('hideIfDamaged', False), slotType,
        subsection.readBool('isMirrored', False),
        subsection.readBool('isUVProportional', True),
        _xml.readIntOrNone(ctx, subsection, 'emblemId'))
    return descr
示例#20
0
def readConfig():
    section = ResMgr.openSection(_CONFIG_FILE)
    if section is None:
        _xml.raiseWrongXml(None, _CONFIG_FILE, 'can not open or read')
    xmlCtx = (None, _CONFIG_FILE)
    c = {}
    c['baseStunDuration'] = _xml.readNonNegativeFloat(xmlCtx, section, 'baseStunDuration')
    c['guaranteedStunDuration'] = _xml.readFraction(xmlCtx, section, 'guaranteedStunDuration')
    c['damageDurationCoeff'] = _xml.readFraction(xmlCtx, section, 'damageDurationCoeff')
    c['guaranteedStunEffect'] = _xml.readFraction(xmlCtx, section, 'guaranteedStunEffect')
    c['damageEffectCoeff'] = _xml.readFraction(xmlCtx, section, 'damageEffectCoeff')
    c['minStunDuration'] = _xml.readNonNegativeFloat(xmlCtx, section, 'minStunDuration')
    c['shellEffectFactor'] = _xml.readFraction(xmlCtx, section, 'shellEffectFactor')
    c['stunFactorEnginePower'] = _xml.readFraction(xmlCtx, section, 'stunFactorEnginePower')
    c['stunFactorVehicleRotationSpeed'] = _xml.readFraction(xmlCtx, section, 'stunFactorVehicleRotationSpeed')
    c['stunFactorTurretTraverse'] = _xml.readFraction(xmlCtx, section, 'stunFactorTurretTraverse')
    c['stunFactorViewDistance'] = _xml.readFraction(xmlCtx, section, 'stunFactorViewDistance')
    c['stunFactorMaxSpeed'] = _xml.readFraction(xmlCtx, section, 'stunFactorMaxSpeed')
    c['stunFactorReloadTime'] = _xml.readPositiveFloat(xmlCtx, section, 'stunFactorReloadTime', 1.0)
    _validateValue1inf('stunFactorReloadTime', c['stunFactorReloadTime'])
    c['stunFactorAimingTime'] = _xml.readPositiveFloat(xmlCtx, section, 'stunFactorAimingTime', 1.0)
    _validateValue1inf('stunFactorAimingTime', c['stunFactorAimingTime'])
    c['stunFactorVehicleMovementShotDispersion'] = _xml.readPositiveFloat(xmlCtx, section, 'stunFactorVehicleMovementShotDispersion', 1.0)
    _validateValue1inf('stunFactorVehicleMovementShotDispersion', c['stunFactorVehicleMovementShotDispersion'])
    c['stunFactorVehicleRotationShotDispersion'] = _xml.readPositiveFloat(xmlCtx, section, 'stunFactorVehicleRotationShotDispersion', 1.0)
    _validateValue1inf('stunFactorVehicleRotationShotDispersion', c['stunFactorVehicleRotationShotDispersion'])
    c['stunFactorTurretRotationShotDispersion'] = _xml.readPositiveFloat(xmlCtx, section, 'stunFactorTurretRotationShotDispersion', 1.0)
    _validateValue1inf('stunFactorTurretRotationShotDispersion', c['stunFactorTurretRotationShotDispersion'])
    c['stunFactorMinShotDispersion'] = _xml.readPositiveFloat(xmlCtx, section, 'stunFactorMinShotDispersion', 1.0)
    _validateValue1inf('stunFactorMinShotDispersion', c['stunFactorMinShotDispersion'])
    return c
示例#21
0
def _readEmblemSlot(ctx, subsection, slotType):
    descr = shared_components.EmblemSlot(
        _xml.readVector3(ctx, subsection, 'rayStart'),
        _xml.readVector3(ctx, subsection, 'rayEnd'),
        _xml.readVector3(ctx, subsection, 'rayUp'),
        _xml.readPositiveFloat(ctx, subsection, 'size'),
        subsection.readBool('hideIfDamaged', False), slotType,
        subsection.readBool('isMirrored', False),
        subsection.readBool('isUVProportional', True),
        _xml.readIntOrNone(ctx, subsection, 'emblemId'),
        _xml.readInt(ctx, subsection, 'slotId'),
        subsection.readBool('applyToFabric', True),
        _readCompatibleModels(subsection, ctx))
    _verifySlotId(ctx, slotType, descr.slotId)
    return descr
示例#22
0
def readEmblemSlots(xmlCtx, section, subsectionName):
    slots = []
    for sname, subsection in _xml.getChildren(xmlCtx, section, subsectionName):
        if sname not in component_constants.ALLOWED_EMBLEM_SLOTS:
            _xml.raiseWrongXml(xmlCtx, 'emblemSlots/{}'.format(sname),
                               'expected {}'.format(_ALLOWED_EMBLEM_SLOTS))
        ctx = (xmlCtx, 'emblemSlots/{}'.format(sname))
        descr = shared_components.EmblemSlot(
            _xml.readVector3(ctx, subsection, 'rayStart'),
            _xml.readVector3(ctx, subsection, 'rayEnd'),
            _xml.readVector3(ctx, subsection, 'rayUp'),
            _xml.readPositiveFloat(ctx, subsection, 'size'),
            subsection.readBool('hideIfDamaged', False),
            _ALLOWED_EMBLEM_SLOTS[_ALLOWED_EMBLEM_SLOTS.index(sname)],
            subsection.readBool('isMirrored', False),
            subsection.readBool('isUVProportional', True),
            _xml.readIntOrNone(ctx, subsection, 'emblemId'))
        slots.append(descr)

    return tuple(slots)
示例#23
0
def _readGunnerRancorousSkill(xmlCtx, section, subsectionName):
    skill, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    return skills_components.GunnerRancorousSkill(skill, _xml.readPositiveFloat(xmlCtx, section, 'duration'), math.radians(_xml.readPositiveFloat(xmlCtx, section, 'sectorHalfAngle')))
示例#24
0
def _readLoaderDesperadoSkill(xmlCtx, section, subsectionName):
    skill, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    return skills_components.LoaderDesperadoSkill(skill, _xml.readFraction(xmlCtx, section, 'vehicleHealthFraction'), _xml.readPositiveFloat(xmlCtx, section, 'gunReloadTimeFactor'))
示例#25
0
 def _readConfig(self, xmlCtx, section):
     self.enginePowerFactor = _xml.readPositiveFloat(xmlCtx, section, 'enginePowerFactor')
     self.engineHpLossPerSecond = _xml.readPositiveFloat(xmlCtx, section, 'engineHpLossPerSecond')
示例#26
0
def _readGunnerRancorous(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res["duration"] = _xml.readPositiveFloat(xmlCtx, section, "duration")
    res["sectorHalfAngle"] = math.radians(_xml.readPositiveFloat(xmlCtx, section, "sectorHalfAngle"))
    return res
示例#27
0
 def _readConfig(self, xmlCtx, section):
     self.enginePowerFactor = _xml.readPositiveFloat(xmlCtx, section, 'enginePowerFactor')
     self.durationSeconds = _xml.readInt(xmlCtx, section, 'durationSeconds', 1)
示例#28
0
 def _readConfig(self, xmlCtx, section):
     self.enginePowerFactor = _xml.readPositiveFloat(xmlCtx, section, 'enginePowerFactor')
     self.turretRotationSpeedFactor = _xml.readPositiveFloat(xmlCtx, section, 'turretRotationSpeedFactor')
示例#29
0
def _readGunnerGunsmith(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res['shotDispersionFactorPerLevel'] = _xml.readPositiveFloat(xmlCtx, section, 'shotDispersionFactorPerLevel')
    return res
示例#30
0
 def _readConfig(self, xmlCtx, section):
     self.__factorSoft = _xml.readPositiveFloat(
         xmlCtx, section, 'softGroundResistanceFactor')
     self.__factorMedium = _xml.readPositiveFloat(
         xmlCtx, section, 'mediumGroundResistanceFactor')
示例#31
0
def _readGunnerGunsmithSkill(xmlCtx, section, subsectionName):
    skill, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    return skills_components.GunnerGunsmithSkill(skill, _xml.readPositiveFloat(xmlCtx, section, 'shotDispersionFactorPerLevel'))
示例#32
0
 def _readConfig(self, xmlCtx, section):
     self.enginePowerFactor = _xml.readPositiveFloat(
         xmlCtx, section, 'enginePowerFactor')
     self.turretRotationSpeedFactor = _xml.readPositiveFloat(
         xmlCtx, section, 'turretRotationSpeedFactor')
示例#33
0
def _readGunnerRancorous(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res['duration'] = _xml.readPositiveFloat(xmlCtx, section, 'duration')
    res['sectorHalfAngle'] = math.radians(_xml.readPositiveFloat(xmlCtx, section, 'sectorHalfAngle'))
    return res
示例#34
0
 def _readConfig(self, xmlCtx, section):
     self.__factorSoft = _xml.readPositiveFloat(xmlCtx, section, 'softGroundResistanceFactor')
     self.__factorMedium = _xml.readPositiveFloat(xmlCtx, section, 'mediumGroundResistanceFactor')
示例#35
0
 def _readConfig(self, xmlCtx, section):
     self.enginePowerFactor = _xml.readPositiveFloat(
         xmlCtx, section, 'enginePowerFactor')
     self.durationSeconds = _xml.readInt(xmlCtx, section, 'durationSeconds',
                                         1)
示例#36
0
def _readGunnerRancorous(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res['duration'] = _xml.readPositiveFloat(xmlCtx, section, 'duration')
    res['sectorHalfAngle'] = math.radians(_xml.readPositiveFloat(xmlCtx, section, 'sectorHalfAngle'))
    return res
示例#37
0
 def _readConfig(self, xmlCtx, section):
     self.activateWhenStillSec = _xml.readNonNegativeFloat(xmlCtx, section, 'activateWhenStillSec')
     self.circularVisionRadiusFactor = _xml.readPositiveFloat(xmlCtx, section, 'circularVisionRadiusFactor')
示例#38
0
 def _readConfig(self, xmlCtx, section):
     self.activateWhenStillSec = _xml.readNonNegativeFloat(
         xmlCtx, section, 'activateWhenStillSec')
     self.circularVisionRadiusFactor = _xml.readPositiveFloat(
         xmlCtx, section, 'circularVisionRadiusFactor')
示例#39
0
 def _readConfig(self, xmlCtx, section):
     self.skillName = 'loader_pedant'
     self.ammoBayHealthFactor = _xml.readPositiveFloat(
         xmlCtx, section, 'ammoBayHealthFactor')
示例#40
0
def _readGunnerGunsmith(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res['shotDispersionFactorPerLevel'] = _xml.readPositiveFloat(xmlCtx, section, 'shotDispersionFactorPerLevel')
    return res
示例#41
0
 def _readConfig(self, xmlCtx, section):
     if not section.has_key('fireStartingChanceFactor'):
         self.fireStartingChanceFactor = 1.0
     else:
         self.fireStartingChanceFactor = _xml.readPositiveFloat(xmlCtx, section, 'fireStartingChanceFactor')
     self.autoactivate = section.readBool('autoactivate', False)
示例#42
0
 def _readConfig(self, xmlCtx, section):
     self.enginePowerFactor = _xml.readPositiveFloat(
         xmlCtx, section, 'enginePowerFactor')
     self.engineHpLossPerSecond = _xml.readPositiveFloat(
         xmlCtx, section, 'engineHpLossPerSecond')
示例#43
0
def _readLoaderDesperado(xmlCtx, section, subsectionName):
    res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName)
    res['vehicleHealthFraction'] = _xml.readFraction(xmlCtx, section, 'vehicleHealthFraction')
    res['gunReloadTimeFactor'] = _xml.readPositiveFloat(xmlCtx, section, 'gunReloadTimeFactor')
    return res
示例#44
0
 def _readConfig(self, xmlCtx, section):
     self.__factor = _xml.readPositiveFloat(xmlCtx, section, 'factor')
     self.__attr = _xml.readNonEmptyString(xmlCtx, section,
                                           'attribute').split('/', 1)
示例#45
0
 def _readConfig(self, xmlCtx, section):
     self.__factor = _xml.readPositiveFloat(xmlCtx, section, 'factor')
     self.__attr = _xml.readNonEmptyString(xmlCtx, section, 'attribute').split('/', 1)