def __dropCrate(self): airDropConfig = self.__dynamicObjectsCache.getConfig( self.__sessionProvider.arenaVisitor.getArenaGuiType()).getAirDrop( ) spaceId = BigWorld.player().spaceID compoundName = 'crateModel' modelAssembler = BigWorld.CompoundAssembler(compoundName, spaceId) modelAssembler.addRootPart(airDropConfig.model, 'root') animationPath = airDropConfig.dropAnimation animationBuilder = AnimationSequence.Loader(animationPath, spaceId) dropPoint = self.deliveryPosition + Math.Vector3( 0, self.DROP_ALTITUDE, 0) crateYaw = 0 if self.plane is not None: crateYaw = self.plane.flightYaw self.inactiveCargo = parachuteCargo = ParachuteCargo( crateYaw, dropPoint, self.deliveryPosition, self.DESCEND_TIME) loadComponentSystem( parachuteCargo, self.__onCargoLoad, { 'model': Loader(modelAssembler), 'landingAnimation': Loader(animationBuilder) }) self.delayCallback( self.deliveryTime - BigWorld.time() + self.POST_DELIVERY_CARGO_LIFETIME, self.__killCargo) return
def loadMines(ownerVehicleID, callback, dynamicObjectsCache=None, battleSession=None): gameObject = MinesObject() loaders = {} effDescr = dynamicObjectsCache.getConfig( battleSession.arenaVisitor.getArenaGuiType()).getMinesEffect() isAlly = False ownerVehicleInfo = battleSession.getArenaDP().getVehicleInfo( ownerVehicleID) if ownerVehicleInfo is not None: isAlly = ownerVehicleInfo.team == BigWorld.player().team idleEff = effDescr.idleEffect.ally if isAlly else effDescr.idleEffect.enemy spaceId = BigWorld.player().spaceID loaders['startEffectPlayer'] = Loader( AnimationSequence.Loader(effDescr.plantEffect.effectDescr.path, spaceId)) loaders['destroyEffectPlayer'] = Loader( AnimationSequence.Loader(effDescr.destroyEffect.effectDescr.path, spaceId)) loaders['idleEffectPlayer'] = Loader( AnimationSequence.Loader(idleEff.path, spaceId)) loaders['blowUpEffectPlayer'] = Loader(_CONFIG_PATH, effectsListName='minesBlowUpEffect') loaders['decalEffectPlayer'] = Loader(_CONFIG_PATH, effectsListName='minesDecalEffect') loadComponentSystem(gameObject, callback, loaders) return gameObject
def __getLoaders(self): loaders = {} arenaGuiType = self.__sessionProvider.arenaVisitor.getArenaGuiType() effDescr = self.__dynObjectsCache.getConfig( arenaGuiType).getBerserkerEffects() spaceId = BigWorld.player().spaceID loaders['turretEffectPlayer'] = Loader( AnimationSequence.Loader(effDescr.turretEffect.effectDescr.path, spaceId)) loaders['hullEffectPlayer'] = Loader( AnimationSequence.Loader(effDescr.hullEffect.effectDescr.path, spaceId)) return loaders
def __orderLootCache(self, lootType, lootDescr): if lootDescr is not None: spaceID = self.spaceID if hasattr(lootDescr, 'model'): modelName = lootDescr.model.name offset = getattr(lootDescr.model, 'overTerrainHeight', 0.0) loaders = {} if modelName is not None: modelAssembler = BigWorld.CompoundAssembler( 'model', spaceID) modelAssembler.addRootPart(modelName, 'root') borderName = getattr(lootDescr.model, 'border', None) if borderName is not None: borderMatrix = Math.Matrix() modelAssembler.addPart(borderName, 'root', 'border', borderMatrix) loaders = {'model': Loader(modelAssembler, offset=offset)} mapping = _getSequenceResourceMapping(lootDescr, 'effect', spaceID, True) effectsPaths = [] if mapping: loaders['effect'] = mapping['sequence'] effectsPaths.append(mapping['path']) mapping = _getSequenceResourceMapping(lootDescr, 'pickupEffect', spaceID, True) if mapping: loaders['pickupEffect'] = mapping['sequence'] effectsPaths.append(mapping['path']) loadResourceMapping(loaders, self.__cacheResourceList, lootType, effectsPaths) return
def _loadLootForeground(loot, spaceID, desc): loaders = {} if hasattr(desc, 'model'): modelName = desc.model.name offset = getattr(desc.model, 'overTerrainHeight', 0.0) if modelName is not None: modelAssembler = BigWorld.CompoundAssembler('model', spaceID) modelAssembler.addRootPart(modelName, 'root') borderName = getattr(desc.model, 'border', None) if borderName is not None: borderMatrix = Math.Matrix() modelAssembler.addPart(borderName, 'root', 'border', borderMatrix) loaders['model'] = Loader(modelAssembler, offset=offset) loadComponentSystem(loot.markingSmoke, loot.appendPiece, _getSequenceResourceMapping(desc, 'effect', spaceID), forceForegroundLoad=True) loadComponentSystem(loot.pickupEffect, loot.appendPiece, _getSequenceResourceMapping(desc, 'pickupEffect', spaceID), forceForegroundLoad=True) loadComponentSystem(loot, loot.appendPiece, loaders, forceForegroundLoad=True) _logger.info('[Loot] Loading of loot type %d done', loot.lootTypeID) return
def __getSequenceResourceMapping(desc, effectName, spaceID): effectDesc = getattr(desc, effectName, None) if effectDesc is not None: if isRendererPipelineDeferred(): effectPath = effectDesc.path else: effectPath = effectDesc.path_fwd return {'sequence': Loader(AnimationSequence.Loader(effectPath, spaceID))} else: return {}
def _loadLoot(typeID, radius, callback, desc): loot = LootObject(radius, typeID) loaders = {} if hasattr(desc, 'model'): modelName = desc.model.name offset = getattr(desc.model, 'overTerrainHeight', 0.0) if modelName is None: _logger.warning('Model for loot %s not set', typeID) else: modelAssembler = BigWorld.CompoundAssembler( 'model', BigWorld.player().spaceID) modelAssembler.addRootPart(modelName, 'root') borderName = getattr(desc.model, 'border', None) if borderName is not None: borderMatrix = Math.Matrix() modelAssembler.addPart(borderName, 'root', 'border', borderMatrix) loaders['model'] = Loader(modelAssembler, offset=offset) if hasattr(desc, 'effect'): if isRendererPipelineDeferred(): effectPath = desc.effect.path else: effectPath = desc.effect.path_fwd loaders['markingSmoke'] = Loader( AnimationSequence.Loader(effectPath, BigWorld.player().spaceID)) if hasattr(desc, 'pickupEffect'): if isRendererPipelineDeferred(): effectPath = desc.pickupEffect.path else: effectPath = desc.pickupEffect.path_fwd loaders['pickupEffect'] = Loader( AnimationSequence.Loader(effectPath, BigWorld.player().spaceID)) loadComponentSystem(loot, callback, loaders) return loot
def _getSequenceResourceMapping(desc, effectName, spaceID, includePaths=False): effectDesc = getattr(desc, effectName, None) if effectDesc is not None: if isRendererPipelineDeferred(): effectPath = effectDesc.path else: effectPath = effectDesc.path_fwd res = { 'sequence': Loader(AnimationSequence.Loader(effectPath, spaceID)) } if includePaths: res['path'] = effectPath return res else: return {}
def _loadLoot(typeID, radius, callback, desc): loot = LootObject(radius, typeID) loaders = {} loot.prepareCompositeLoader(callback) spaceID = BigWorld.player().spaceID if hasattr(desc, 'model'): modelName = desc.model.name offset = getattr(desc.model, 'overTerrainHeight', 0.0) if modelName is None: _logger.warning('Model for loot %s not set', typeID) else: modelAssembler = BigWorld.CompoundAssembler('model', spaceID) modelAssembler.addRootPart(modelName, 'root') borderName = getattr(desc.model, 'border', None) if borderName is not None: borderMatrix = Math.Matrix() modelAssembler.addPart(borderName, 'root', 'border', borderMatrix) loaders['model'] = Loader(modelAssembler, offset=offset) loadComponentSystem(loot.markingSmoke, loot.appendPiece, __getSequenceResourceMapping(desc, 'effect', spaceID)) loadComponentSystem(loot.pickupEffect, loot.appendPiece, __getSequenceResourceMapping(desc, 'pickupEffect', spaceID)) loadComponentSystem(loot, loot.appendPiece, loaders) return loot
def _getEffectResourceMapping(name): return {'effectList': Loader(_CONFIG_PATH, effectsListName=name)}
def _getSequenceResourceMapping(path, spaceId): return {'sequence': Loader(AnimationSequence.Loader(path, spaceId))}