Exemplo n.º 1
0
    def isVehicleFlagbearer(self, vehicleID):
        for flagID in g_ctfManager.getFlags():
            flagInfo = g_ctfManager.getFlagInfo(flagID)
            if flagInfo['vehicle'] == vehicleID:
                return True

        return False
Exemplo n.º 2
0
    def __onCarriedFlagsPositionUpdated(self, flagIDs):
        for flagID in flagIDs:
            flagInfo = g_ctfManager.getFlagInfo(flagID)
            vehID = flagInfo['vehicle']
            if vehID is not None and vehID != self._getPlayerVehicleID():
                flagPos = g_ctfManager.getFlagMinimapPos(flagID)
                if flagID in self.__flagEntries:
                    self.__updateMarkerFlagPosition(flagID, flagPos)
                else:
                    state = self.__getFlagMarkerStateByVehicle(vehID)
                    self.__addOrUpdateFlag(flagID, flagPos, state)

        return
Exemplo n.º 3
0
    def __onCarriedFlagsPositionUpdated(self, flagIDs):
        for flagID in flagIDs:
            flagInfo = g_ctfManager.getFlagInfo(flagID)
            vehID = flagInfo['vehicle']
            if vehID is not None and vehID != self._getPlayerVehicleID():
                flagPos = g_ctfManager.getFlagMinimapPos(flagID)
                if flagID in self.__flagEntries:
                    self.__updateMarkerFlagPosition(flagID, flagPos)
                else:
                    state = self.__getFlagMarkerStateByVehicle(vehID)
                    self.__addOrUpdateFlag(flagID, flagPos, state)

        return
Exemplo n.º 4
0
    def start(self):
        player = BigWorld.player()
        playerVehicleID = player.playerVehicleID
        arena = player.arena
        arenaType = arena.arenaType
        self.__capturePoints = arenaType.flagAbsorptionPoints
        self.__spawnPoints = arenaType.flagSpawnPoints
        isFlagBearer = False
        for flagID in g_ctfManager.getFlags():
            flagInfo = g_ctfManager.getFlagInfo(flagID)
            vehicleID = flagInfo['vehicle']
            if vehicleID is None:
                self.__onSpawnedAtBase(flagID, flagInfo['minimapPos'])
            elif vehicleID == playerVehicleID:
                isFlagBearer = True

        if isFlagBearer:
            self.__addCaptureMarkers()
        super(_FlagsMarkerPlugin, self).start()
        return
Exemplo n.º 5
0
    def onEnterWorld(self, prereqs):
        if prereqs.failedIDs:
            LOG_ERROR('Failed to load flag model %s' % (prereqs.failedIDs,))
            return
        else:
            self.__parent = g_ctfManager.getFlagInfo(self.flagID)['flag']
            self.model = prereqs[g_ctfManager.flagModelName]
            flagCircleModel = prereqs[g_ctfManager.flagCircleModelName]
            self.model.position = self.position
            self.model.root.attach(flagCircleModel)
            if g_ctfManager.flagAnimAction is not None:
                try:
                    animAction = self.model.action(g_ctfManager.flagAnimAction)
                    animAction()
                except:
                    LOG_WARNING('Unable to start "%s" animation action for model "%s"' % (g_ctfManager.flagAnimAction, g_ctfManager.flagModelName))

            self.model.visible = False
            self.__parent.flagEnterWorld(self)
            return
Exemplo n.º 6
0
    def onEnterWorld(self, prereqs):
        if prereqs.failedIDs:
            LOG_ERROR('Failed to load flag model %s' % (prereqs.failedIDs,))
            return
        else:
            self.__parent = g_ctfManager.getFlagInfo(self.flagID)['flag']
            self.model = prereqs[g_ctfManager.flagModelName]
            self.__circleModel = prereqs[g_ctfManager.flagCircleModelName]
            self.__circleModel.position = self.position
            self.model.position = self.position
            if g_ctfManager.flagAnimAction is not None:
                try:
                    animAction = self.model.action(g_ctfManager.flagAnimAction)
                    animAction()
                except:
                    LOG_WARNING('Unable to start "%s" animation action for model "%s"' % (g_ctfManager.flagAnimAction, g_ctfManager.flagModelName))

            self.model.visible = False
            self.__parent.flagEnterWorld(self)
            self.model.addMotor(BigWorld.Servo(self.matrix))
            return