def localToonHitBySuit(self, suitNum):
     self.notify.debug("localToonHitBySuit %d" % suitNum)
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     pos = self.cogInfo[suitNum]["suit"].suit.getPos()
     self.sendUpdate("hitBySuit", [self.localAvId, timestamp, suitNum, pos[0], pos[1], pos[2]])
     self.showToonHitBySuit(self.localAvId, timestamp)
     self.makeSuitRespondToToonHit(timestamp, suitNum)
 def b_pieThrow(self, toon, power):
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     pos = toon.getPos()
     h = toon.getH()
     toonId = toon.doId
     self.view.pieThrow(toonId, timestamp, h, pos, power)
     self.d_broadcastPieThrow(toonId, timestamp, h, pos[0], pos[1], pos[2], power)
 def handleEnterBarrel(self, colEntry):
     if self.gameIsEnding:
         return
     intoName = colEntry.getIntoNodePath().getName()
     fromName = colEntry.getFromNodePath().getName()
     debugInto = intoName.split('/')
     debugFrom = fromName.split('/')
     self.notify.debug('handleEnterBarrel gameTime=%s %s into %s' % (self.getCurrentGameTime(), debugFrom[-1], debugInto[-1]))
     if 'CogThiefSphere' in intoName:
         parts = intoName.split('-')
         cogIndex = int(parts[1])
         barrelName = colEntry.getFromNodePath().getName()
         barrelParts = barrelName.split('-')
         barrelIndex = int(barrelParts[1])
         cog = self.cogInfo[cogIndex]['suit']
         if cog.barrel == CTGG.NoBarrelCarried and barrelIndex not in self.stolenBarrels:
             timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
             if cog.suit:
                 cogPos = cog.suit.getPos()
                 collisionPos = colEntry.getContactPos(render)
                 if (cogPos - collisionPos).length() > 4:
                     import pdb
                     pdb.set_trace()
                 self.sendUpdate('cogHitBarrel', [timestamp,
                  cogIndex,
                  barrelIndex,
                  cogPos[0],
                  cogPos[1],
                  cogPos[2]])
 def _DistributedMazeGame__hitBySuit(self, suitNum):
     self.notify.debug('hitBySuit')
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime())
     self.sendUpdate('hitBySuit', [
         self.localAvId,
         timestamp])
     self._DistributedMazeGame__showToonHitBySuit(self.localAvId, timestamp)
 def sendSuitSync(self, clientstamp, suitNum):
     pos = self.cogInfo[suitNum]["pos"]
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     goalType = self.cogInfo[suitNum]["goal"]
     goalId = self.cogInfo[suitNum]["goalId"]
     gameTime = self.getCurrentGameTime()
     self.sendUpdate("updateSuitGoal", [timestamp, clientstamp, suitNum, goalType, goalId, pos[0], pos[1], pos[2]])
 def b_makeCogDropBarrel(self, clientStamp, cogIndex, barrelIndex, barrelPos):
     if self.barrelInfo[barrelIndex]['carriedBy'] != cogIndex:
         self.notify.error("self.barrelInfo[%s]['carriedBy'] != %s" % (barrelIndex, cogIndex))
     
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits = 32)
     self.makeCogDropBarrel(timestamp, clientStamp, cogIndex, barrelIndex, barrelPos)
     self.d_makeCogDropBarrel(timestamp, clientStamp, cogIndex, barrelIndex, barrelPos)
 def markBarrelStolen(self, clientStamp, barrelIndex):
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits = 32)
     self.sendUpdate('markBarrelStolen', [
         timestamp,
         clientStamp,
         barrelIndex])
     self.barrelInfo[barrelIndex]['stolen'] = True
 def setClientTriggered(self):
     if not hasattr(self, "gameStartTime"):
         self.gameStartTime = globalClock.getRealTime()
     if not self.started:
         self.b_setGameStart(
             globalClockDelta.localToNetworkTime(self.gameStartTime), self.moleTarget, self.timeToPlay
         )
         self.started = 1
 def b_makeCogCarryBarrel(self, clientStamp, cogIndex, barrelIndex):
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     self.notify.debug('b_makeCogCarryBarrel timeStamp=%s clientStamp=%s cog=%s barrel=%s' % (timestamp,
      clientStamp,
      cogIndex,
      barrelIndex))
     self.makeCogCarryBarrel(timestamp, clientStamp, cogIndex, barrelIndex)
     self.d_makeCogCarryBarrel(timestamp, clientStamp, cogIndex, barrelIndex)
 def chaseBarrel(self, suitNum, barrelIndex):
     goalType = CTGG.BarrelGoal
     goalId = barrelIndex
     self.cogInfo[suitNum]["goal"] = goalType
     self.cogInfo[suitNum]["goalId"] = goalId
     pos = self.cogInfo[suitNum]["pos"]
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     self.notify.debug("chaseBarrel time=%s suitNum=%s, barrelIndex=%s" % (timestamp, suitNum, barrelIndex))
     gameTime = self.getCurrentGameTime()
     self.sendUpdate("updateSuitGoal", [timestamp, timestamp, suitNum, goalType, goalId, pos[0], pos[1], pos[2]])
 def runAway(self, clientStamp, cogIndex, cogPos, barrelIndex, returnPosIndex):
     self.cogInfo[cogIndex]["pos"] = cogPos
     self.b_makeCogCarryBarrel(clientStamp, cogIndex, barrelIndex)
     goalType = CTGG.RunAwayGoal
     goalId = returnPosIndex
     self.cogInfo[cogIndex]["goal"] = goalType
     self.cogInfo[cogIndex]["goalId"] = 0
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     gameTime = self.getCurrentGameTime()
     self.sendUpdate(
         "updateSuitGoal", [timestamp, clientStamp, cogIndex, goalType, goalId, cogPos[0], cogPos[1], cogPos[2]]
     )
Example #12
0
 def chaseToon(self, suitNum, avId):
     goalType = CTGG.ToonGoal
     goalId = avId
     self.cogInfo[suitNum]['goal'] = goalType
     self.cogInfo[suitNum]['goalId'] = goalId
     pos = self.cogInfo[suitNum]['pos']
     timestamp = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime(), bits=32)
     self.notify.debug('chaseToon time=%s suitNum=%s, avId=%s' %
                       (timestamp, suitNum, avId))
     gameTime = self.getCurrentGameTime()
     self.sendUpdate('updateSuitGoal', [
         timestamp, timestamp, suitNum, goalType, goalId, pos[0], pos[1],
         pos[2]
     ])
 def runAway(self, clientStamp, cogIndex, cogPos, barrelIndex,
             returnPosIndex):
     self.cogInfo[cogIndex]['pos'] = cogPos
     self.b_makeCogCarryBarrel(clientStamp, cogIndex, barrelIndex)
     goalType = CTGG.RunAwayGoal
     goalId = returnPosIndex
     self.cogInfo[cogIndex]['goal'] = goalType
     self.cogInfo[cogIndex]['goalId'] = 0
     timestamp = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime(), bits=32)
     gameTime = self.getCurrentGameTime()
     self.sendUpdate('updateSuitGoal', [
         timestamp, clientStamp, cogIndex, goalType, goalId, cogPos[0],
         cogPos[1], cogPos[2]
     ])
Example #14
0
 def sendSuitSync(self, clientstamp, suitNum):
     pos = self.cogInfo[suitNum]['pos']
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits = 32)
     goalType = self.cogInfo[suitNum]['goal']
     goalId = self.cogInfo[suitNum]['goalId']
     gameTime = self.getCurrentGameTime()
     self.sendUpdate('updateSuitGoal', [
         timestamp,
         clientstamp,
         suitNum,
         goalType,
         goalId,
         pos[0],
         pos[1],
         pos[2]])
 def handlePieHitting(self, colEntry):
     if self.gameIsEnding:
         return
     into = colEntry.getIntoNodePath()
     intoName = into.getName()
     if "CogThiefPieSphere" in intoName:
         timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
         parts = intoName.split("-")
         suitNum = int(parts[1])
         pos = self.cogInfo[suitNum]["suit"].suit.getPos()
         if pos in CTGG.CogStartingPositions:
             self.notify.debug("Cog %d hit at starting pos %s, ignoring" % (suitNum, pos))
         else:
             self.sendUpdate("pieHitSuit", [self.localAvId, timestamp, suitNum, pos[0], pos[1], pos[2]])
             self.makeSuitRespondToPieHit(timestamp, suitNum)
 def startInvasion(self, suitName = None, skel = False):
     self.withdrawAllCogs()
     
     self.skel = skel
     self.curInvading = suitName if suitName != "" else None
     
     self.duration = int(random.random() * 600 + 300) # 5 - 15 mins
     self.startTime = globalClockDelta.localToNetworkTime(globalClock.getRealTime(), bits = 32)
     
     taskMgr.doMethodLater(self.duration, self.__stop, self.taskName('end-invasion'))
     
     self.sendUpdate("startInvasion", [suitName or "", skel, 0, self.startTime, self.duration])
     
     self.notify.info("Invasion started: %s (%s); duration = %s secs" % (suitName, skel, self.duration))
     messenger.send("startInvasion")
 def handlePieCollision(self, colEntry):
     if not self.activity.isState('Active') or self.player is None:
         return
     handled = False
     into = colEntry.getIntoNodePath()
     intoName = into.getName()
     timestamp = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime(), bits=32)
     if 'PartyCog' in intoName:
         if self.toonPieTracks.get(base.localAvatar.doId) is not None:
             self.toonPieTracks[base.localAvatar.doId].finish()
             self.toonPieTracks[base.localAvatar.doId] = None
         parts = intoName.split('-')
         cogID = int(parts[1])
         point = colEntry.getSurfacePoint(self.cogManager.cogs[cogID].root)
         cog = self.cogManager.cogs[cogID]
         hitHead = point.getZ() > cog.getHeadLocation(
         ) and not parts[2].startswith('Arm')
         if self.activity.getTeam(
                 base.localAvatar.doId
         ) == PartyGlobals.TeamActivityTeams.LeftTeam:
             direction = -1.0
         else:
             direction = 1.0
         self.activity.b_pieHitsCog(timestamp, cogID, point, direction,
                                    hitHead)
         if hitHead:
             hitPoints = self.player.hitHead()
         else:
             hitPoints = self.player.hitBody()
         self.player.updateScore()
         if hitPoints > 0:
             cog.showHitScore(hitPoints)
         handled = True
     elif 'distAvatarCollNode' in intoName:
         parts = intoName.split('-')
         hitToonId = int(parts[1])
         toon = base.cr.doId2do.get(hitToonId)
         if toon is not None and self.activity.getTeam(
                 hitToonId) != self.player.team:
             point = colEntry.getSurfacePoint(toon)
             self.activity.b_pieHitsToon(hitToonId, timestamp, point)
             handled = True
     if handled:
         eventName = self.toonPieEventNames.get(colEntry.getFromNodePath())
         if eventName is not None:
             self.ignore(eventName)
             del self.toonPieEventNames[colEntry.getFromNodePath()]
Example #18
0
 def chaseBarrel(self, suitNum, barrelIndex):
     """Make this suit try to grab the given barrel."""
     goalType = CTGG.BarrelGoal
     goalId = barrelIndex
     self.cogInfo[suitNum]['goal'] = goalType
     self.cogInfo[suitNum]['goalId'] = goalId
     pos = self.cogInfo[suitNum]['pos']
     timestamp = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime(), bits=32)
     self.notify.debug('chaseBarrel time=%s suitNum=%s, barrelIndex=%s' %
                       (timestamp, suitNum, barrelIndex))
     gameTime = self.getCurrentGameTime()
     self.sendUpdate('updateSuitGoal', [
         timestamp, timestamp, suitNum, goalType, goalId, pos[0], pos[1],
         pos[2]
     ])
 def controlKeyPressed(self):
     if self.isToonPlayingHitTrack(self.localAvId):
         return
     if self.gameIsEnding:
         return
     if self.getCurrentGameTime() - self.lastTimeControlPressed > self.ControlKeyLimitTime:
         self.lastTimeControlPressed = self.getCurrentGameTime()
         self.notify.debug("controlKeyPressed")
         toonSD = self.toonSDs[self.localAvId]
         curState = toonSD.fsm.getCurrentState().getName()
         toon = self.getAvatar(self.localAvId)
         timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
         pos = toon.getPos()
         heading = toon.getH()
         self.sendUpdate("throwingPie", [self.localAvId, timestamp, heading, pos[0], pos[1], pos[2]])
         self.showToonThrowingPie(self.localAvId, timestamp, heading, pos)
 def chaseToon(self, suitNum, avId):
     goalType = CTGG.ToonGoal
     goalId = avId
     self.cogInfo[suitNum]['goal'] = goalType
     self.cogInfo[suitNum]['goalId'] = goalId
     pos = self.cogInfo[suitNum]['pos']
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     self.notify.debug('chaseToon time=%s suitNum=%s, avId=%s' % (timestamp, suitNum, avId))
     gameTime = self.getCurrentGameTime()
     self.sendUpdate('updateSuitGoal', [timestamp,
      timestamp,
      suitNum,
      goalType,
      goalId,
      pos[0],
      pos[1],
      pos[2]])
Example #21
0
    def runAway(self, clientStamp, cogIndex, cogPos, barrelIndex, returnPosIndex):
        """Make this cog run away to a given reuturn position."""
        # should we use the info on where the toons were last were to influence where
        # we should go?
        assert self.notify.debugStateCall(self)
            
        self.cogInfo[cogIndex]['pos'] = cogPos
        
        self.b_makeCogCarryBarrel(clientStamp, cogIndex, barrelIndex)
        goalType = CTGG.RunAwayGoal
        goalId = returnPosIndex
        self.cogInfo[cogIndex]['goal'] = goalType
        self.cogInfo[cogIndex]['goalId'] = 0

        timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
        gameTime = self.getCurrentGameTime()
        self.sendUpdate('updateSuitGoal', [timestamp, clientStamp, cogIndex,  goalType, goalId,
                                           cogPos[0],cogPos[1], cogPos[2]])      
Example #22
0
 def handlePieHitting(self, colEntry):
     if self.gameIsEnding:
         return
     into = colEntry.getIntoNodePath()
     intoName = into.getName()
     if 'CogThiefPieSphere' in intoName:
         timestamp = globalClockDelta.localToNetworkTime(
             globalClock.getFrameTime(), bits=32)
         parts = intoName.split('-')
         suitNum = int(parts[1])
         pos = self.cogInfo[suitNum]['suit'].suit.getPos()
         if pos in CTGG.CogStartingPositions:
             self.notify.debug('Cog %d hit at starting pos %s, ignoring' %
                               (suitNum, pos))
         else:
             self.sendUpdate('pieHitSuit', [
                 self.localAvId, timestamp, suitNum, pos[0], pos[1], pos[2]
             ])
             self.makeSuitRespondToPieHit(timestamp, suitNum)
Example #23
0
 def handlePieCollision(self, colEntry):
     if not self.activity.isState('Active') or self.player is None:
         return
     handled = False
     into = colEntry.getIntoNodePath()
     intoName = into.getName()
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     if 'PartyCog' in intoName:
         if self.toonPieTracks.get(base.localAvatar.doId) is not None:
             self.toonPieTracks[base.localAvatar.doId].finish()
             self.toonPieTracks[base.localAvatar.doId] = None
         parts = intoName.split('-')
         cogID = int(parts[1])
         point = colEntry.getSurfacePoint(self.cogManager.cogs[cogID].root)
         cog = self.cogManager.cogs[cogID]
         if point.getZ() > cog.getHeadLocation():
             hitHead = not parts[2].startswith('Arm')
             if self.activity.getTeam(base.localAvatar.doId) == PartyGlobals.TeamActivityTeams.LeftTeam:
                 direction = -1.0
             else:
                 direction = 1.0
             self.activity.b_pieHitsCog(timestamp, cogID, point, direction, hitHead)
             if hitHead:
                 hitPoints = self.player.hitHead()
             else:
                 hitPoints = self.player.hitBody()
             self.player.updateScore()
             if hitPoints > 0:
                 cog.showHitScore(hitPoints)
             handled = True
         elif 'distAvatarCollNode' in intoName:
             parts = intoName.split('-')
             hitToonId = int(parts[1])
             toon = base.cr.doId2do.get(hitToonId)
             if toon is not None and self.activity.getTeam(hitToonId) != self.player.team:
                 point = colEntry.getSurfacePoint(toon)
                 self.activity.b_pieHitsToon(hitToonId, timestamp, point)
                 handled = True
         if handled:
             eventName = self.toonPieEventNames.get(colEntry.getFromNodePath())
             eventName is not None and self.ignore(eventName)
             del self.toonPieEventNames[colEntry.getFromNodePath()]
     return
Example #24
0
 def controlKeyPressed(self):
     if self.isToonPlayingHitTrack(self.localAvId):
         return
     if self.gameIsEnding:
         return
     if self.getCurrentGameTime(
     ) - self.lastTimeControlPressed > self.ControlKeyLimitTime:
         self.lastTimeControlPressed = self.getCurrentGameTime()
         self.notify.debug('controlKeyPressed')
         toonSD = self.toonSDs[self.localAvId]
         curState = toonSD.fsm.getCurrentState().getName()
         toon = self.getAvatar(self.localAvId)
         timestamp = globalClockDelta.localToNetworkTime(
             globalClock.getFrameTime(), bits=32)
         pos = toon.getPos()
         heading = toon.getH()
         self.sendUpdate(
             'throwingPie',
             [self.localAvId, timestamp, heading, pos[0], pos[1], pos[2]])
         self.showToonThrowingPie(self.localAvId, timestamp, heading, pos)
    def startInvasion(self, suitName=None, skel=False):
        self.withdrawAllCogs()

        self.skel = skel
        self.curInvading = suitName if suitName != "" else None

        self.duration = int(random.random() * 600 + 300)  # 5 - 15 mins
        self.startTime = globalClockDelta.localToNetworkTime(
            globalClock.getRealTime(), bits=32)

        taskMgr.doMethodLater(self.duration, self.__stop,
                              self.taskName('end-invasion'))

        self.sendUpdate(
            "startInvasion",
            [suitName or "", skel, 0, self.startTime, self.duration])

        self.notify.info("Invasion started: %s (%s); duration = %s secs" %
                         (suitName, skel, self.duration))
        messenger.send("startInvasion")
 def enterGame(self):
     self.markStartTime()
     self.sendUpdate('setGameStart', [globalClockDelta.localToNetworkTime(self.getStartTime())])
 def enterFinish(self):
     self.markFinishTime()
     self.sendUpdate('setGameFinish', [globalClockDelta.localToNetworkTime(self.getFinishTime())])
Example #28
0
 def setClientTriggered(self):
     """A player entered us, start the moles."""
     if not hasattr(self, 'gameStartTime'):
         self.gameStartTime = globalClock.getRealTime()
         self.b_setGameStart(globalClockDelta.localToNetworkTime(\
                         self.gameStartTime))
 def sendCogAtReturnPos(self, cogIndex, barrelIndex):
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     self.sendUpdate('cogAtReturnPos', [timestamp, cogIndex, barrelIndex])
 def restartGame(self):
     if not hasattr(self, 'entId'):
         return
     self.gameStartTime = globalClock.getRealTime()
     self.started = 0
     self.b_setGameStart(globalClockDelta.localToNetworkTime(self.gameStartTime), self.moleTarget, self.timeToPlay)
Example #31
0
 def getTimeout(self):
     return globalClockDelta.localToNetworkTime(self.timeout)
Example #32
0
 def restartGame(self):
     if not hasattr(self, 'entId'):
         return
     self.gameStartTime = globalClock.getRealTime()
     self.started = 0
     self.b_setGameStart(globalClockDelta.localToNetworkTime(self.gameStartTime), self.moleTarget, self.timeToPlay)
Example #33
0
 def setClientTriggered(self):
     if not hasattr(self, 'gameStartTime'):
         self.gameStartTime = globalClock.getRealTime()
     if not self.started:
         self.b_setGameStart(globalClockDelta.localToNetworkTime(self.gameStartTime), self.moleTarget, self.timeToPlay)
         self.started = 1
Example #34
0
 def sendCogAtReturnPos(self, cogIndex, barrelIndex):
     timestamp = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime(), bits=32)
     self.sendUpdate('cogAtReturnPos', [timestamp, cogIndex, barrelIndex])
 def setClientTriggered(self):
     if not hasattr(self, 'gameStartTime'):
         self.gameStartTime = globalClock.getRealTime()
         self.b_setGameStart(globalClockDelta.localToNetworkTime(self.gameStartTime))
Example #36
0
 def markBarrelStolen(self, clientStamp, barrelIndex):
     """Tell the clients the barrel is stolen, mark it in AI too."""
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     self.sendUpdate('markBarrelStolen', [timestamp, clientStamp, barrelIndex])
     self.barrelInfo[barrelIndex]['stolen'] = True
 def restartGame(self, task=None):
     self.gameStartTime = globalClock.getRealTime()
     self.started = 0
     self.b_setGameStart(globalClockDelta.localToNetworkTime(self.gameStartTime))
     taskMgr.doMethodLater(900, self.restartGame, self.RebootTaskName)
Example #38
0
 def getTimeout(self):
     return globalClockDelta.localToNetworkTime(self.timeout)
 def getCurrentNetworkTime(self):
     return globalClockDelta.localToNetworkTime(globalClock.getRealTime())
Example #40
0
 def setClientTriggered(self):
     if not hasattr(self, 'gameStartTime'):
         self.gameStartTime = globalClock.getRealTime()
         self.b_setGameStart(
             globalClockDelta.localToNetworkTime(self.gameStartTime))
Example #41
0
 def d_requestUseGag(self, x, y, h):
     networkTime = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime())
     self.sendUpdate('requestUseGag', [x, y, h, networkTime])
Example #42
0
 def b_setMeal(self, meal):
     local_time = globalClock.getFrameTime()
     net_time = globalClockDelta.localToNetworkTime(local_time)
     net_time = globalClockDelta.getFrameNetworkTime()
     self.d_setMeal(meal, net_time)
     self.setMeal(meal, local_time)
Example #43
0
 def d_requestHitBySuit(self, suitType, suitNum):
     networkTime = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime())
     self.sendUpdate('requestHitBySuit', [suitType, suitNum, networkTime])
 def getSpawnInfo(self):
     return (self._entranceId,
             globalClockDelta.localToNetworkTime(self._spawnTime))
Example #45
0
 def d_setSpeedDamage(self, speedDamage, recoverRate, recoverStartTime):
     timestamp = globalClockDelta.localToNetworkTime(recoverStartTime)
     self.sendUpdate('setSpeedDamage',
                     [speedDamage, recoverRate, timestamp])
 def __hitBySuit(self, suitNum):
     self.notify.debug('hitBySuit')
     timestamp = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime())
     self.sendUpdate('hitBySuit', [self.localAvId, timestamp])
     self.__showToonHitBySuit(self.localAvId, timestamp)
Example #47
0
 def d_requestUseGag(self, x, y, h):
     networkTime = globalClockDelta.localToNetworkTime(globalClock.getFrameTime())
     self.sendUpdate('requestUseGag', [x,
      y,
      h,
      networkTime])
Example #48
0
 def b_makeCogDropBarrel(self, clientStamp, cogIndex, barrelIndex, barrelPos):
     if self.barrelInfo[barrelIndex]['carriedBy'] != cogIndex:
         self.notify.error("self.barrelInfo[%s]['carriedBy'] != %s" % (barrelIndex, cogIndex))
     timestamp = globalClockDelta.localToNetworkTime(globalClock.getFrameTime(), bits=32)
     self.makeCogDropBarrel(timestamp, clientStamp, cogIndex, barrelIndex, barrelPos)
     self.d_makeCogDropBarrel(timestamp, clientStamp, cogIndex, barrelIndex, barrelPos)
Example #49
0
 def d_requestHitBySuit(self, suitType, suitNum):
     networkTime = globalClockDelta.localToNetworkTime(globalClock.getFrameTime())
     self.sendUpdate('requestHitBySuit', [suitType, suitNum, networkTime])
 def d_setSpeedDamage(self, speedDamage, recoverRate, recoverStartTime):
     timestamp = globalClockDelta.localToNetworkTime(recoverStartTime)
     self.sendUpdate('setSpeedDamage', [speedDamage, recoverRate, timestamp])
Example #51
0
    def getStartTime(self):
        # We convert the start time back into network time for
        # transmission.  The 32-bit conversion must be specified here
        # again.

        return globalClockDelta.localToNetworkTime(self.startTime, bits=32)
Example #52
0
 def enterGame(self):
     self.markStartTime()
     self.sendUpdate(
         'setGameStart',
         [globalClockDelta.localToNetworkTime(self.getStartTime())])
 def d_setSpeedDamage(self, speedDamage, recoverRate, recoverStartTime):
     """Tell clients of the speed damage."""
     timestamp = globalClockDelta.localToNetworkTime(recoverStartTime)
     self.sendUpdate('setSpeedDamage', [speedDamage, recoverRate, timestamp])
 def markBarrelStolen(self, clientStamp, barrelIndex):
     timestamp = globalClockDelta.localToNetworkTime(
         globalClock.getFrameTime(), bits=32)
     self.sendUpdate('markBarrelStolen',
                     [timestamp, clientStamp, barrelIndex])
     self.barrelInfo[barrelIndex]['stolen'] = True
Example #55
0
 def enterFinish(self):
     self.markFinishTime()
     self.sendUpdate(
         'setGameFinish',
         [globalClockDelta.localToNetworkTime(self.getFinishTime())])