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))
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')
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))
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
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
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))
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'))
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
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
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')
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)
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)
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
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
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
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
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)
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')))
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'))
def _readConfig(self, xmlCtx, section): self.enginePowerFactor = _xml.readPositiveFloat(xmlCtx, section, 'enginePowerFactor') self.engineHpLossPerSecond = _xml.readPositiveFloat(xmlCtx, section, 'engineHpLossPerSecond')
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
def _readConfig(self, xmlCtx, section): self.enginePowerFactor = _xml.readPositiveFloat(xmlCtx, section, 'enginePowerFactor') self.durationSeconds = _xml.readInt(xmlCtx, section, 'durationSeconds', 1)
def _readConfig(self, xmlCtx, section): self.enginePowerFactor = _xml.readPositiveFloat(xmlCtx, section, 'enginePowerFactor') self.turretRotationSpeedFactor = _xml.readPositiveFloat(xmlCtx, section, 'turretRotationSpeedFactor')
def _readGunnerGunsmith(xmlCtx, section, subsectionName): res, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName) res['shotDispersionFactorPerLevel'] = _xml.readPositiveFloat(xmlCtx, section, 'shotDispersionFactorPerLevel') return res
def _readConfig(self, xmlCtx, section): self.__factorSoft = _xml.readPositiveFloat( xmlCtx, section, 'softGroundResistanceFactor') self.__factorMedium = _xml.readPositiveFloat( xmlCtx, section, 'mediumGroundResistanceFactor')
def _readGunnerGunsmithSkill(xmlCtx, section, subsectionName): skill, xmlCtx, section = _readSkillBasics(xmlCtx, section, subsectionName) return skills_components.GunnerGunsmithSkill(skill, _xml.readPositiveFloat(xmlCtx, section, 'shotDispersionFactorPerLevel'))
def _readConfig(self, xmlCtx, section): self.enginePowerFactor = _xml.readPositiveFloat( xmlCtx, section, 'enginePowerFactor') self.turretRotationSpeedFactor = _xml.readPositiveFloat( xmlCtx, section, 'turretRotationSpeedFactor')
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
def _readConfig(self, xmlCtx, section): self.__factorSoft = _xml.readPositiveFloat(xmlCtx, section, 'softGroundResistanceFactor') self.__factorMedium = _xml.readPositiveFloat(xmlCtx, section, 'mediumGroundResistanceFactor')
def _readConfig(self, xmlCtx, section): self.enginePowerFactor = _xml.readPositiveFloat( xmlCtx, section, 'enginePowerFactor') self.durationSeconds = _xml.readInt(xmlCtx, section, 'durationSeconds', 1)
def _readConfig(self, xmlCtx, section): self.activateWhenStillSec = _xml.readNonNegativeFloat(xmlCtx, section, 'activateWhenStillSec') self.circularVisionRadiusFactor = _xml.readPositiveFloat(xmlCtx, section, 'circularVisionRadiusFactor')
def _readConfig(self, xmlCtx, section): self.activateWhenStillSec = _xml.readNonNegativeFloat( xmlCtx, section, 'activateWhenStillSec') self.circularVisionRadiusFactor = _xml.readPositiveFloat( xmlCtx, section, 'circularVisionRadiusFactor')
def _readConfig(self, xmlCtx, section): self.skillName = 'loader_pedant' self.ammoBayHealthFactor = _xml.readPositiveFloat( xmlCtx, section, 'ammoBayHealthFactor')
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)
def _readConfig(self, xmlCtx, section): self.enginePowerFactor = _xml.readPositiveFloat( xmlCtx, section, 'enginePowerFactor') self.engineHpLossPerSecond = _xml.readPositiveFloat( xmlCtx, section, 'engineHpLossPerSecond')
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
def _readConfig(self, xmlCtx, section): self.__factor = _xml.readPositiveFloat(xmlCtx, section, 'factor') self.__attr = _xml.readNonEmptyString(xmlCtx, section, 'attribute').split('/', 1)