Example #1
3
    def __init__(self, data, position):
        super(_StaticObjectMarker3D, self).__init__()
        path = data.get('path')
        offset = data.get('offset', Math.Vector3(0, 0, 0))
        self.__model = None
        if path is not None:
            try:
                self.__model = BigWorld.Model(path)
                self.__model.position = Math.Vector3(position[:]) + offset
                self.__model.castsShadow = False
            except ValueError:
                LOG_CURRENT_EXCEPTION()
                LOG_ERROR('Model not found', path)
                return
            except AttributeError:
                LOG_CURRENT_EXCEPTION()
                return

            BigWorld.addModel(self.__model)
            action = data.get('action')
            if action is not None and len(action):
                try:
                    self.__model.action(action)()
                except ValueError:
                    LOG_ERROR('Action not found', path, action)

        return
Example #2
1
    def __onFlagModelLoaded(self, flagID, resourceRefs):
        if resourceRefs.failedIDs:
            LOG_ERROR("Failed to load flag model %s" % (resourceRefs.failedIDs,))
        else:
            model = resourceRefs[self.__flagModelFile]
            circleModel = resourceRefs[self.__flagCircleModelFile]
            spawnPosition, isVisible = self.__flags[flagID].get("spawnData", (None, False))
            if spawnPosition is not None:
                model.position = spawnPosition
            BigWorld.addModel(model, BigWorld.player().spaceID)
            model.root.attach(circleModel)
            BigWorld.wgAddEdgeDetectModel(model, 3, 2)
            BigWorld.wgEdgeDetectModelSetVisible(model, isVisible)
            if self.__flagAnimAction is not None:
                try:
                    animAction = model.action(self.__flagAnimAction)
                    animAction()
                except:
                    LOG_WARNING(
                        'Unable to start "%s" animation action for model "%s"'
                        % (self.__flagAnimAction, self.__flagModelFile)
                    )

            self.__flags[flagID]["model"] = model
        return
Example #3
0
 def start(self):
     if self.isPeriodic() and self.__possibility < random.uniform(0.0, 1.0):
         self.__startTime += self.__period
         return
     else:
         if self.__firstLaunch is True:
             BigWorld.addModel(self.__model)
             self.__model.forceReflect = True
             self.__motor = BigWorld.WGWarplaneMotor(self.__curve, 0)
             self.__model.addMotor(self.__motor)
             self.__endTime = self.__motor.totalTime + self.__startTime
             if self.__endTime <= Timer.getTime():
                 self.__fadedIn = True
             else:
                 self.__motor.restart(Timer.getTime() - self.__startTime)
             self.__firstLaunch = False
         else:
             self.pause()
             if self.__motor is not None:
                 self.__model.addMotor(self.__motor)
                 self.__motor.restart()
                 self.__endTime = self.__motor.totalTime + self.__startTime
             if self.__cbID is not None:
                 BigWorld.cancelCallback(self.__cbID)
             if self.__sound is not None:
                 self.__sound.stopAll()
                 self.__sound = None
             self.__fadedIn = False
         self.__model.visible = 1
         self.__startTime += self.__period
         self.__waitEnterWorld()
         return
Example #4
0
 def __init__(self, soundName, parent):
     fakeModelName = Settings.g_instance.scriptConfig.readString(Settings.KEY_FAKE_MODEL)
     self.soundModel = BigWorld.Model(fakeModelName)
     self.soundModel.addMotor(BigWorld.Servo(parent.root))
     BigWorld.addModel(self.soundModel)
     self.sound = SoundGroups.g_instance.playSound(self.soundModel, soundName)
     self.parent = parent
Example #5
0
 def __init__(self, start, end):
     self.model = BigWorld.Model('helpers/models/unit_cube.model')
     self.motor = BigWorld.Servo(Math.Matrix())
     self.model.addMotor(self.motor)
     self.__thickness = 0.1
     self.set(start, end)
     BigWorld.addModel(self.model)
Example #6
0
    def __onResourcesLoaded(self, resourceRefs):
        if self.guid not in BigWorld.userDataObjects:
            return
        else:
            self.__clear()
            if self.modelName in resourceRefs.failedIDs:
                return
            try:
                self.__model = resourceRefs[self.modelName]
                self.__modelMatrix = Matrix()
                self.__modelMatrix.setIdentity()
                servo = BigWorld.Servo(self.__modelMatrix)
                self.__model.addMotor(servo)
                BigWorld.addModel(self.__model)
                if self.actionName != '':
                    action = self.__model.action(self.actionName)
                    if action is not None:
                        action()
                if self.pixieName != '' and self.pixieName not in resourceRefs.failedIDs:
                    pixieNode = self.__model.node(self.pixieHardPoint)
                    pixieNode.attach(resourceRefs[self.pixieName])
                if self.soundName != '':
                    self.__sound = SoundGroups.g_instance.playSoundModel(self.__model, self.soundName)
            except:
                LOG_CURRENT_EXCEPTION()
                self.__model = None
                return

            self.__prevTime = BigWorld.time()
            self.__update()
            return
 def __setupModel(self, buildIdx):
     model = self.__assembleModel()
     model.addMotor(BigWorld.Servo(_createMatrix(_CFG['v_scale'], _CFG['v_start_angles'], _CFG['v_start_pos'])))
     BigWorld.addModel(model)
     if self.__setupModelCb is not None:
         BigWorld.cancelCallback(self.__setupModelCb)
     self.__setupModelCb = BigWorld.callback(0.0, partial(self.__doFinalSetup, buildIdx, model, True))
     return
Example #8
0
 def _createTerrainSelectedArea(self, position, size, overTerrainHeight, color):
     if self.__radiusModelName is None:
         return
     self.__fakeModel = BigWorld.Model('objects/fake_model.model')
     self.__fakeModel.position = position
     BigWorld.addModel(self.__fakeModel, BigWorld.player().spaceID)
     rootNode = self.__fakeModel.node('')
     self.__terrainSelectedArea = BigWorld.PyTerrainSelectedArea()
     self.__terrainSelectedArea.setup(self.__radiusModelName, Vector2(size, size), overTerrainHeight, color)
     rootNode.attach(self.__terrainSelectedArea)
Example #9
0
 def __setupModel(self, buildIdx):
     model = self.__assembleModel()
     model.addMotor(BigWorld.Servo(_createMatrix(_CFG['v_scale'], _CFG['v_start_angles'], _CFG['v_start_pos'])))
     entity = BigWorld.entity(self.__vEntityId)
     if isinstance(entity, HangarVehicle):
         entity.typeDescriptor = self.__vDesc
     BigWorld.addModel(model)
     if self.__setupModelCb is not None:
         BigWorld.cancelCallback(self.__setupModelCb)
     self.__setupModelCb = BigWorld.callback(0.0, partial(self.__doFinalSetup, buildIdx, model, True))
Example #10
0
 def __setModel(self, model):
     if self.__cloud is None or model is None:
         return
     else:
         self.__model = model
         self.__model.addMotor(BigWorld.Servo(self.__cloud.cloudMatrixProvider))
         BigWorld.addModel(self.__model)
         tintFashion = BattlegroundElements.TintFashion(self.__cloud.tintColorLink)
         self.__model.fashion = tintFashion
         return
Example #11
0
 def create(self):
     m = Math.Matrix()
     m.setRotateYPR(Math.Vector3(self.yaw, 0, 0))
     m.translation = self.pos
     self.motor = BigWorld.Servo(m)
     self.model = BigWorld.Model(self.modelPath)
     self.model.addMotor(self.motor)
     BigWorld.addModel(self.model)
     self.model.visible = True
     return self.model
Example #12
0
 def _ensureDummyExists(self):
     if None is self.dummy:
         self.dummy = BigWorld.Model('')
         self.dummy.visibleAttachments = True
         BigWorld.addModel(self.dummy)
         if self.followPlayer and BigWorld.player() != None:
             servo = BigWorld.Servo(BigWorld.player().matrix)
         else:
             servo = BigWorld.Servo(BigWorld.InvViewMatrix())
         self.dummy.motors = (servo,)
     return
Example #13
0
def assemblePyModels(models, position, vehicleDesc):
    chassis = BigWorld.Model(models[0])
    hull = BigWorld.Model(models[1])
    turret = BigWorld.Model(models[2])
    gun = BigWorld.Model(models[3])
    chassis.node('V').attach(hull)
    hull.node('HP_turretJoint').attach(turret)
    turret.node('HP_gunJoint').attach(gun)
    BigWorld.addModel(chassis)
    chassis.position = position
    return chassis
 def __init__(self, beginExplosionPos, endExplosionPos, areaWidth, velocity):
     CallbackDelayer.__init__(self)
     self.model = BigWorld.Model("helpers/models/unit_cube.model")
     BigWorld.addModel(self.model)
     self.model.position = beginExplosionPos
     linearHomer = BigWorld.LinearHomer()
     self.model.addMotor(linearHomer)
     linearHomer.align = mathUtils.createSRTMatrix((areaWidth, 5, 1), (0.0, 0, 0), Vector3(0, 0, 0))
     linearHomer.acceleration = 0
     linearHomer.velocity = velocity
     linearHomer.target = mathUtils.createTranslationMatrix(endExplosionPos)
     linearHomer.proximityCallback = self.__onDeath
Example #15
0
 def play(vehicle_id):
     vehicle = BigWorld.entity(vehicle_id)
     if vehicle is None:
         return
     effects = vehicle.typeDescriptor.type.effects['fullDestruction']
     if not effects:
         return
     vehicle.show(False)
     fakeModel = helpers.newFakeModel()
     BigWorld.addModel(fakeModel)
     fakeModel.position = vehicle.model.position
     effectsPlayer = EffectsListPlayer(effects[0][1], effects[0][0])
     effectsPlayer.play(fakeModel, SpecialKeyPointNames.START, partial(BigWorld.delModel, fakeModel))
Example #16
0
 def show(self, isVisible):
     if self.model is not None:
         if isVisible:
             if not self.model.visible:
                 BigWorld.wgAddEdgeDetectEntity(self, 3, 2, False)
                 if self.__circleModel is not None:
                     BigWorld.addModel(self.__circleModel)
         elif self.model.visible:
             BigWorld.wgDelEdgeDetectEntity(self)
             if self.__circleModel is not None:
                 BigWorld.delModel(self.__circleModel)
         self.model.visible = isVisible
     return
Example #17
0
 def setup(self, position, direction, size, visualPath, color, marker):
     self.__fakeModel = model = BigWorld.player().newFakeModel()
     model.position = position
     model.yaw = direction.yaw
     BigWorld.addModel(model)
     rootNode = model.node('')
     self.__terrainSelectedArea = area = BigWorld.PyTerrainSelectedArea()
     area.setup(visualPath, size, OVER_TERRAIN_HEIGHT, color)
     rootNode.attach(area)
     markerTranslation = mathUtils.MatrixProviders.product(rootNode, mathUtils.createTranslationMatrix(Math.Vector3(0.0, MARKER_HEIGHT, 0.0)))
     self.__nextPosition = position
     self.__speed = Math.Vector3(0.0, 0.0, 0.0)
     self.__time = 0.0
Example #18
0
 def show(self, isVisible):
     if self.model is not None:
         if isVisible:
             if not self.model.visible:
                 BigWorld.wgAddEdgeDetectEntity(self, 3, 2, False)
                 if self.__circleModel is not None:
                     BigWorld.addModel(self.__circleModel)
         elif self.model.visible:
             BigWorld.wgDelEdgeDetectEntity(self)
             if self.__circleModel is not None:
                 BigWorld.delModel(self.__circleModel)
         self.model.visible = isVisible
     return
Example #19
0
def assembleCompoundModel(models, position, vehicleDesc):
    tank = BigWorld.createCompoundTank()
    chassis = BigWorld.ModelLite(models[0])
    hull = BigWorld.ModelLite(models[1])
    turret = BigWorld.ModelLite(models[2])
    gun = BigWorld.ModelLite(models[3])
    matrix = Matrix()
    matrix.translation = position
    tank.attachPart(0, chassis, '', matrix)
    tank.attachPart(1, hull, 'V')
    tank.attachPart(2, turret, 'HP_turretJoint')
    tank.attachPart(3, gun, 'HP_gunJoint')
    BigWorld.addModel(tank)
    return tank
Example #20
0
 def floatAway(self, entity):
     entity.model.root.detach(self.dummy)
     initial = Math.Matrix(entity.model.root)
     final = Math.Matrix()
     final.setTranslate((0, -5, 0))
     final.preMultiply(initial)
     ma = Math.MatrixAnimation()
     ma.keyframes = [(0.0, initial), (5.0, final)]
     ma.loop = False
     ma.time = 0.0
     motor = BigWorld.Servo(ma)
     self.dummy.addMotor(motor)
     BigWorld.addModel(self.dummy)
     BigWorld.callback(5.0, partial(BigWorld.delModel, self.dummy))
Example #21
0
 def play(self):
     vehicle = BigWorld.player().getVehicleAttached()
     if vehicle is not None:
         self.updateVehicleMatrix(vehicle.matrix)
     BigWorld.addModel(self.__vehicleFakeModel, BigWorld.player().spaceID)
     self.__vehicleEffectsPlayer = EffectsList.EffectsListPlayer(self.__vehicleEffects.effectsList, self.__vehicleEffects.keyPoints)
     self.__vehicleEffectsPlayer.play(self.__vehicleFakeModel, waitForKeyOff=True)
     camera = BigWorld.camera()
     if camera is not None:
         self.__cameraTM.source = camera.invViewMatrix
     BigWorld.addModel(self.__cameraFakeModel, BigWorld.player().spaceID)
     self.__cameraEffectsPlayer = EffectsList.EffectsListPlayer(self.__cameraEffects.effectsList, self.__cameraEffects.keyPoints)
     self.__cameraEffectsPlayer.play(self.__cameraFakeModel, waitForKeyOff=True)
     return
 def setup(self, position, direction, size, visualPath, color, marker):
     self.__fakeModel = model = BigWorld.Model('')
     model.position = position
     model.yaw = direction.yaw
     BigWorld.addModel(model)
     rootNode = model.node('')
     self.__terrainSelectedArea = area = BigWorld.PyTerrainSelectedArea()
     area.setup(visualPath, size, OVER_TERRAIN_HEIGHT, color)
     rootNode.attach(area)
     self.__size = size
     self.__color = color
     self.__nextPosition = position
     self.__speed = Math.Vector3(0.0, 0.0, 0.0)
     self.__time = 0.0
Example #23
0
 def start(self):
     self.__isOver = False
     if self.isPeriodic() and self.__possibility < random.uniform(0.0, 1.0):
         self.__startTime += self.__period
         return
     if self.__firstLaunch is True:
         BigWorld.addModel(self.__model)
         self.__model.forceReflect = True
         self.__firstLaunch = False
     else:
         self.pause()
     self.__model.visible = 1
     self.__startTime += self.__period
     self.__waitEnterWorld()
Example #24
0
 def addNew(self, position, effectsList, keyPoints, callbackOnStop, **args):
     model = BigWorld.player().newFakeModel()
     model.position = position
     BigWorld.addModel(model)
     dir = args.get('dir', None)
     if dir is not None:
         model.rotate(dir.yaw, (0.0, 1.0, 0.0))
     self.__incrementalEffectID += 1
     effectID = self.__incrementalEffectID
     desc = dict()
     desc['model'] = model
     desc['effectsPlayer'] = EffectsListPlayer(effectsList, keyPoints, **args)
     desc['effectsPlayer'].play(model, None, partial(self.__callbackBeforeDestroy, effectID, callbackOnStop))
     self._models[effectID] = desc
     return effectID
Example #25
0
 def __onModelLoaded(self, resourceRefs):
     if resourceRefs.failedIDs:
         LOG_ERROR('Failed to load model %s' % (resourceRefs.failedIDs,))
     else:
         model = resourceRefs[self.__modelFile]
         assert model is not None
         model.position = self.position
         roll, pitch, yaw = self.direction
         model.rotate(roll, (0.0, 0.0, 1.0))
         model.rotate(pitch, (1.0, 0.0, 0.0))
         model.rotate(yaw, (0.0, 1.0, 0.0))
         BigWorld.addModel(model, BigWorld.player().spaceID)
         BigWorld.wg_applyOverlayToModel(model, False)
         self.__model = model
         g_ctfManager.updateRegisteredResourcePointModel(self)
 def setup(self, position, direction, size, visualPath, color, marker):
     self.__fakeModel = model = BigWorld.Model('')
     rootNode = model.node('')
     self.__terrainSelectedArea = area = BigWorld.PyTerrainSelectedArea()
     area.setup(visualPath, size, OVER_TERRAIN_HEIGHT, color)
     rootNode.attach(area)
     self.__size = size
     self.__color = color
     BigWorld.addModel(model)
     self.__matrix = Math.Matrix()
     model.addMotor(BigWorld.Servo(self.__matrix))
     self.relocate(position, direction)
     self.__nextPosition = position
     self.__speed = Math.Vector3(0.0, 0.0, 0.0)
     self.__time = 0.0
Example #27
0
 def play(vehicle_id):
     vehicle = BigWorld.entity(vehicle_id)
     if vehicle is None:
         return
     else:
         effects = vehicle.typeDescriptor.type.effects['fullDestruction']
         if not effects:
             return
         vehicle.show(False)
         if vehicle.model is not None:
             fakeModel = helpers.newFakeModel()
             BigWorld.addModel(fakeModel)
             fakeModel.position = vehicle.model.position
             effectsPlayer = EffectsListPlayer(effects[0][1], effects[0][0])
             effectsPlayer.play(fakeModel, SpecialKeyPointNames.START, partial(BigWorld.delModel, fakeModel))
         return
Example #28
0
 def __onModelLoaded(self, applyOverlay, resourceRefs):
     if resourceRefs.failedIDs:
         LOG_ERROR('Failed to load flag model %s' % (resourceRefs.failedIDs,))
     else:
         model = resourceRefs[self.__flagModelFile]
         assert model is not None
         model.position = self.__flagPos
         BigWorld.addModel(model, BigWorld.player().spaceID)
         BigWorld.wg_applyOverlayToModel(model, applyOverlay)
         self.__flagModel = model
         if self.__flagAnimAction is not None:
             try:
                 animAction = model.action(self.__flagAnimAction)
                 animAction()
             except:
                 LOG_WARNING('Unable to start "%s" animation action for model "%s"' % (self.__flagAnimAction, self.__flagModelFile))
Example #29
0
 def _createTerrainSelectedArea(self, position, size, overTerrainHeight, color, terrainSelected = True):
     if self.__radiusModelName is None:
         return
     elif g_ctfManager.isNeedHideAll:
         return
     else:
         self.__fakeModel = BigWorld.Model('objects/fake_model.model')
         self.__fakeModel.position = position
         BigWorld.addModel(self.__fakeModel, BigWorld.player().spaceID)
         self.__fakeModel.addMotor(BigWorld.Servo(Math.Matrix(self.__fakeModel.matrix)))
         rootNode = self.__fakeModel.node('')
         self.__terrainSelectedArea = BigWorld.PyTerrainSelectedArea()
         self.__terrainSelectedArea.setup(self.__radiusModelName, Vector2(size, size), overTerrainHeight, color, terrainSelected)
         rootNode.attach(self.__terrainSelectedArea)
         self.__hideListener = _GlobalHideListener(self.__hideCheckPoint)
         return
Example #30
0
    def start(self):
        self.__model = BigWorld.Model(self.__curve.getChannelProperty(0, 'modelName').asString)
        BigWorld.addModel(self.__model)
        self.__motor = BigWorld.WGWarplaneMotor(self.__curve, 0)
        self.__model.addMotor(self.__motor)
        ds = self.__curve.getChannelProperty(0, 'soundName')
        soundName = ds.asString if ds is not None else ''
        if soundName != '':
            try:
                self.__sound = self.__model.playSound(soundName)
                self.__sound.volume = 0.0
            except:
                self.__sound = None
                LOG_CURRENT_EXCEPTION()

        self.__update()
        return
Example #31
0
 def start(self):
     self.__isOver = False
     if self.isRepeating() and self.__possibility < random.uniform(0.0, 1.0):
         self._startTime += self._interval
         return
     else:
         if self.__firstLaunch is True:
             BigWorld.addModel(self.__model)
             self.__model.forceReflect = True
             self.__firstLaunch = False
         else:
             self.pause()
         self.__model.visible = 1
         self._startTime += self._interval
         if self.__cbID is not None:
             BigWorld.cancelCallback(self.__cbID)
             self.__cbID = None
         self.__waitEnterWorld()
         return
Example #32
0
    def __onFlagModelLoaded(self, flagID, position, isVisible, resourceRefs):
        if resourceRefs.failedIDs:
            LOG_ERROR('Failed to load flag model %s' % (resourceRefs.failedIDs,))
        else:
            model = resourceRefs[self.__flagModelFile]
            if position is not None:
                model.position = position
            BigWorld.addModel(model, BigWorld.player().spaceID)
            BigWorld.wgAddEdgeDetectModel(model, 3, 2)
            BigWorld.wgEdgeDetectModelSetVisible(model, isVisible)
            if self.__flagAnimAction is not None:
                try:
                    animAction = model.action(self.__flagAnimAction)
                    animAction()
                except:
                    pass

            self.__flags[flagID]['model'] = model
        return
Example #33
0
 def __onModelLoaded(self, resourceRefs):
     if resourceRefs.failedIDs:
         LOG_ERROR('Failed to load model %s' % (resourceRefs.failedIDs,))
     else:
         model = resourceRefs[self.__modelFile]
         if not model is not None:
             raise AssertionError
             model.position = self.position
             roll, pitch, yaw = self.direction
             model.rotate(roll, (0.0, 0.0, 1.0))
             model.rotate(pitch, (1.0, 0.0, 0.0))
             model.rotate(yaw, (0.0, 1.0, 0.0))
             BigWorld.addModel(model, BigWorld.player().spaceID)
             BigWorld.wg_applyOverlayToModel(model, False)
             self.__model = model
             g_ctfManager.updateRegisteredResourcePointModel(self)
             g_ctfManager.isNeedHideAll and self.__hideResPointFlag()
         else:
             self.__hideListener = _GlobalHideListener(self.__hideResPointFlag)
     return