Example #1
0
class _CompoundAssembler(VehicleAssemblerAbstract):
    appearance = property(lambda self: self.__appearance)

    def __init__(self):
        VehicleAssemblerAbstract.__init__(self)
        self.__appearance = CompoundAppearance()

    def prerequisites(self,
                      typeDescriptor,
                      id,
                      health=1,
                      isCrewActive=True,
                      isTurretDetached=False):
        raise 'pillbox' not in typeDescriptor.type.tags or AssertionError(
            'Pillboxes are not supported and have never been')
        prereqs = self.__appearance.prerequisites(typeDescriptor, id, health,
                                                  isCrewActive,
                                                  isTurretDetached)
        compoundAssembler = prepareCompoundAssembler(
            typeDescriptor, self.__appearance.damageState.modelState,
            BigWorld.player().spaceID, isTurretDetached)
        prereqs += [compoundAssembler]
        return (compoundAssembler, prereqs)

    def _assembleParts(self, vehicle, appearance):
        pass

    def constructAppearance(self, isPlayer):
        self._assembleParts(isPlayer, self.__appearance)
        return self.__appearance
Example #2
0
 def __cacheApperance(self, vId, info):
     appearance = CompoundAppearance()
     prereqs = appearance.prerequisites(info.typeDescr, vId, info.health,
                                        info.isCrewActive,
                                        info.isTurretDetached,
                                        info.outfitCD)
     if vId in self.__assemblersCache:
         assemblerData = self.__assemblersCache.get(vId, None)
         if assemblerData is not None:
             oldAppearance = assemblerData.appearance
             LOG_WARNING(
                 'The latest resources for the vehicle are not loaded yet, deleting old appearance and creating new one %s %s'
                 % (info.typeDescr.name, assemblerData.info.typeDescr))
             del oldAppearance
         del self.__assemblersCache[vId]
     self.__assemblersCache[vId] = _AssemblerData(appearance, info, prereqs)
     if self.__spaceLoaded:
         BigWorld.loadResourceListBG(
             prereqs, makeCallbackWeak(_resourceLoaded, prereqs, vId),
             loadingPriority(vId))
     return prereqs
 def __load(self, vId, info, onLoadedCallback=None):
     _logger.debug('__load(%d)', vId)
     loadInfo = self.__loadingAssemblerQueue.get(vId)
     if loadInfo is not None:
         if onLoadedCallback is not None:
             loadInfo.onConstructed += onLoadedCallback
         return loadInfo.appearance
     else:
         appearance = CompoundAppearance()
         prereqs = appearance.prerequisites(info.typeDescr, vId,
                                            info.health, info.isCrewActive,
                                            info.isTurretDetached,
                                            info.outfitCD)
         taskId = BigWorld.loadResourceListBG(
             prereqs, functools.partial(self.__onAppearanceLoaded, vId),
             loadingPriority(vId))
         _logger.debug('loadResourceListBG vehicle = (%d), task = (%d)',
                       vId, taskId)
         self.__loadingAssemblerQueue[vId] = _LoadInfo(
             appearance, taskId, info.typeDescr, onLoadedCallback)
         return appearance
class _CompoundAssembler(VehicleAssemblerAbstract):
    appearance = property(lambda self: self.__appearance)

    def __init__(self):
        VehicleAssemblerAbstract.__init__(self)
        self.__appearance = CompoundAppearance()

    def prerequisites(self,
                      typeDescriptor,
                      vID,
                      health=1,
                      isCrewActive=True,
                      isTurretDetached=False,
                      outfitCD=''):
        prereqs = self.__appearance.prerequisites(typeDescriptor, vID, health,
                                                  isCrewActive,
                                                  isTurretDetached, outfitCD)
        compoundAssembler = prepareCompoundAssembler(
            typeDescriptor, self.__appearance.modelsSetParams,
            BigWorld.player().spaceID, isTurretDetached)
        if not isTurretDetached:
            bspModels = ((TankPartNames.getIdx(TankPartNames.CHASSIS),
                          typeDescriptor.chassis.hitTester.bspModelName),
                         (TankPartNames.getIdx(TankPartNames.HULL),
                          typeDescriptor.hull.hitTester.bspModelName),
                         (TankPartNames.getIdx(TankPartNames.TURRET),
                          typeDescriptor.turret.hitTester.bspModelName),
                         (TankPartNames.getIdx(TankPartNames.GUN),
                          typeDescriptor.gun.hitTester.bspModelName))
        else:
            bspModels = ((TankPartNames.getIdx(TankPartNames.CHASSIS),
                          typeDescriptor.chassis.hitTester.bspModelName),
                         (TankPartNames.getIdx(TankPartNames.HULL),
                          typeDescriptor.hull.hitTester.bspModelName))
        collisionAssembler = BigWorld.CollisionAssembler(
            bspModels,
            BigWorld.player().spaceID)
        prereqs += [compoundAssembler, collisionAssembler]
        physicalTracksBuilders = typeDescriptor.chassis.physicalTracks
        for name, builder in physicalTracksBuilders.iteritems():
            prereqs.append(
                builder.createLoader('{0}PhysicalTrack'.format(name)))

        return (compoundAssembler, prereqs)

    def _assembleParts(self, vehicle, appearance, resourceRefs):
        pass

    def constructAppearance(self, isPlayer, resourceRefs):
        self._assembleParts(isPlayer, self.__appearance, resourceRefs)
        return self.__appearance
class _CompoundAssembler(VehicleAssemblerAbstract):
    appearance = property(lambda self: self.__appearance)

    def __init__(self):
        VehicleAssemblerAbstract.__init__(self)
        self.__appearance = CompoundAppearance()

    def prerequisites(self, typeDescriptor, id, health = 1, isCrewActive = True, isTurretDetached = False):
        prereqs = self.__appearance.prerequisites(typeDescriptor, id, health, isCrewActive, isTurretDetached)
        compoundAssembler = prepareCompoundAssembler(typeDescriptor, self.__appearance.damageState.modelState, BigWorld.player().spaceID, isTurretDetached)
        prereqs += [compoundAssembler]
        return (compoundAssembler, prereqs)

    def _assembleParts(self, vehicle, appearance):
        pass

    def constructAppearance(self, isPlayer):
        self._assembleParts(isPlayer, self.__appearance)
        return self.__appearance
class _CompoundAssembler(VehicleAssemblerAbstract):
    appearance = property(lambda self: self.__appearance)

    def __init__(self, vehicle):
        VehicleAssemblerAbstract.__init__(self)
        self.__appearance = CompoundAppearance()
        self.__vehicleRef = weakref.ref(vehicle)

    def prerequisites(self):
        vehicle = self.__vehicleRef()
        prereqs = self.__appearance.prerequisites(vehicle)
        compoundAssembler = prepareCompoundAssembler(vehicle.typeDescriptor, self.__appearance.damageState.modelState, BigWorld.player().spaceID, vehicle.isTurretDetached)
        return prereqs + [compoundAssembler]

    def _assembleParts(self, vehicle, appearance):
        pass

    def constructAppearance(self, prereqs):
        self._assembleParts(self.__vehicleRef(), self.__appearance)
        return self.__appearance
Example #7
0
class _CompoundAssembler(VehicleAssemblerAbstract):
    appearance = property(lambda self: self.__appearance)

    def __init__(self, vehicle):
        VehicleAssemblerAbstract.__init__(self)
        self.__appearance = CompoundAppearance()
        self.__vehicleRef = weakref.ref(vehicle)

    def prerequisites(self):
        vehicle = self.__vehicleRef()
        prereqs = self.__appearance.prerequisites(vehicle)
        compoundAssembler = prepareCompoundAssembler(vehicle.typeDescriptor, self.__appearance.damageState.modelState, BigWorld.player().spaceID, vehicle.isTurretDetached)
        return prereqs + [compoundAssembler]

    def _assembleParts(self, vehicle, appearance):
        pass

    def constructAppearance(self, prereqs):
        self._assembleParts(self.__vehicleRef(), self.__appearance)
        return self.__appearance
 def __init__(self):
     VehicleAssemblerAbstract.__init__(self)
     self.__appearance = CompoundAppearance()
 def __init__(self, vehicle):
     VehicleAssemblerAbstract.__init__(self)
     self.__appearance = CompoundAppearance()
     self.__vehicleRef = weakref.ref(vehicle)
 def __init__(self):
     VehicleAssemblerAbstract.__init__(self)
     self.__appearance = CompoundAppearance()
Example #11
0
 def __init__(self, vehicle):
     VehicleAssemblerAbstract.__init__(self)
     self.__appearance = CompoundAppearance()
     self.__vehicleRef = weakref.ref(vehicle)