Holocaust elevator antishuffle

This commit is contained in:
John 2015-08-31 20:10:57 +03:00
parent a2ec779622
commit 84dc9372cf
27 changed files with 101 additions and 253 deletions

View file

@ -1829,19 +1829,17 @@ dclass DistributedElevator : DistributedObject {
fillSlot5(uint32, uint8) broadcast ram; fillSlot5(uint32, uint8) broadcast ram;
fillSlot6(uint32, uint8) broadcast ram; fillSlot6(uint32, uint8) broadcast ram;
fillSlot7(uint32, uint8) broadcast ram; fillSlot7(uint32, uint8) broadcast ram;
emptySlot0(uint32, int8, int16, int16) broadcast ram; emptySlot0(uint32, int16, int16) broadcast ram;
emptySlot1(uint32, int8, int16, int16) broadcast ram; emptySlot1(uint32, int16, int16) broadcast ram;
emptySlot2(uint32, int8, int16, int16) broadcast ram; emptySlot2(uint32, int16, int16) broadcast ram;
emptySlot3(uint32, int8, int16, int16) broadcast ram; emptySlot3(uint32, int16, int16) broadcast ram;
emptySlot4(uint32, int8, int16, int16) broadcast ram; emptySlot4(uint32, int16, int16) broadcast ram;
emptySlot5(uint32, int8, int16, int16) broadcast ram; emptySlot5(uint32, int16, int16) broadcast ram;
emptySlot6(uint32, int8, int16, int16) broadcast ram; emptySlot6(uint32, int16, int16) broadcast ram;
emptySlot7(uint32, int8, int16, int16) broadcast ram; emptySlot7(uint32, int16, int16) broadcast ram;
requestBoard() airecv clsend; requestBoard() airecv clsend;
rejectBoard(uint32, uint8); rejectBoard(uint32, uint8);
requestExit() airecv clsend; requestExit() airecv clsend;
setElevatorTripId(uint32) required broadcast ram;
setAntiShuffle(uint8) required broadcast ram;
}; };
dclass DistributedElevatorFSM : DistributedObject { dclass DistributedElevatorFSM : DistributedObject {
@ -1855,19 +1853,17 @@ dclass DistributedElevatorFSM : DistributedObject {
fillSlot5(uint32) broadcast ram; fillSlot5(uint32) broadcast ram;
fillSlot6(uint32) broadcast ram; fillSlot6(uint32) broadcast ram;
fillSlot7(uint32) broadcast ram; fillSlot7(uint32) broadcast ram;
emptySlot0(uint32, int8, int16) broadcast ram; emptySlot0(uint32, int16) broadcast ram;
emptySlot1(uint32, int8, int16) broadcast ram; emptySlot1(uint32, int16) broadcast ram;
emptySlot2(uint32, int8, int16) broadcast ram; emptySlot2(uint32, int16) broadcast ram;
emptySlot3(uint32, int8, int16) broadcast ram; emptySlot3(uint32, int16) broadcast ram;
emptySlot4(uint32, int8, int16) broadcast ram; emptySlot4(uint32, int16) broadcast ram;
emptySlot5(uint32, int8, int16) broadcast ram; emptySlot5(uint32, int16) broadcast ram;
emptySlot6(uint32, int8, int16) broadcast ram; emptySlot6(uint32, int16) broadcast ram;
emptySlot7(uint32, int8, int16) broadcast ram; emptySlot7(uint32, int16) broadcast ram;
requestBoard() airecv clsend; requestBoard() airecv clsend;
rejectBoard(uint32, uint8); rejectBoard(uint32, uint8);
requestExit() airecv clsend; requestExit() airecv clsend;
setElevatorTripId(uint32) required broadcast ram;
setAntiShuffle(uint8) required broadcast ram;
}; };
dclass DistributedElevatorFloor : DistributedElevatorFSM { dclass DistributedElevatorFloor : DistributedElevatorFSM {

View file

@ -3,7 +3,7 @@ import DistributedBossElevatorAI
class DistributedBBElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedBBElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):
def __init__(self, air, bldg, zone, antiShuffle = 0): def __init__(self, air, bldg, zone):
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle) DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone)
self.type = ELEVATOR_BB self.type = ELEVATOR_BB
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -12,8 +12,8 @@ from toontown.suit import DistributedSellbotBossAI
class DistributedBossElevatorAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedBossElevatorAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
def __init__(self, air, bldg, zone, antiShuffle = 0): def __init__(self, air, bldg, zone):
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, numSeats=8, antiShuffle=antiShuffle) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, numSeats=8)
self.zone = zone self.zone = zone
self.type = ELEVATOR_VP self.type = ELEVATOR_VP
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -3,7 +3,7 @@ import DistributedBossElevatorAI
class DistributedCFOElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedCFOElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):
def __init__(self, air, bldg, zone, antiShuffle = 0): def __init__(self, air, bldg, zone):
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle) DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone)
self.type = ELEVATOR_CFO self.type = ELEVATOR_CFO
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -3,7 +3,7 @@ import DistributedBossElevatorAI
class DistributedCJElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedCJElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):
def __init__(self, air, bldg, zone, antiShuffle = 0): def __init__(self, air, bldg, zone):
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle) DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone)
self.type = ELEVATOR_CJ self.type = ELEVATOR_CJ
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -306,9 +306,8 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM):
return self.elevatorModel return self.elevatorModel
def kickEveryoneOut(self): def kickEveryoneOut(self):
bailFlag = 0
for avId, slot in self.boardedAvIds.items(): for avId, slot in self.boardedAvIds.items():
self.emptySlot(slot, avId, bailFlag, globalClockDelta.getRealNetworkTime()) self.emptySlot(slot, avId, globalClockDelta.getRealNetworkTime())
if avId == base.localAvatar.doId: if avId == base.localAvatar.doId:
pass pass
@ -450,7 +449,7 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM):
jumpTrack = Sequence(Parallel(toonJumpTrack, Sequence(Wait(1), toonSitTrack)), Func(av.wrtReparentTo, self.golfKart)) jumpTrack = Sequence(Parallel(toonJumpTrack, Sequence(Wait(1), toonSitTrack)), Func(av.wrtReparentTo, self.golfKart))
return jumpTrack return jumpTrack
def emptySlot(self, index, avId, bailFlag, timestamp): def emptySlot(self, index, avId, timestamp, timeSent=0):
if avId == 0: if avId == 0:
pass pass
elif not self.isSetup: elif not self.isSetup:
@ -461,7 +460,7 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM):
self.deferredSlots = newSlots self.deferredSlots = newSlots
elif avId in self.cr.doId2do: elif avId in self.cr.doId2do:
if bailFlag == 1 and hasattr(self, 'clockNode'): if hasattr(self, 'clockNode'):
if timestamp < self.countdownTime and timestamp >= 0: if timestamp < self.countdownTime and timestamp >= 0:
self.countdown(self.countdownTime - timestamp) self.countdown(self.countdownTime - timestamp)
else: else:

View file

@ -41,13 +41,12 @@ class DistributedClubElevatorAI(DistributedElevatorFSMAI.DistributedElevatorFSMA
id = 0 id = 0
DoBlockedRoomCheck = simbase.config.GetBool('elevator-blocked-rooms-check', 1) DoBlockedRoomCheck = simbase.config.GetBool('elevator-blocked-rooms-check', 1)
def __init__(self, air, lawOfficeId, bldg, avIds, markerId = None, numSeats = 4, antiShuffle = 0): def __init__(self, air, lawOfficeId, bldg, avIds, markerId = None, numSeats = 4):
DistributedElevatorFSMAI.DistributedElevatorFSMAI.__init__(self, air, bldg, numSeats, antiShuffle = antiShuffle) DistributedElevatorFSMAI.DistributedElevatorFSMAI.__init__(self, air, bldg, numSeats)
FSM.__init__(self, 'ElevatorFloor_%s_FSM' % self.id) FSM.__init__(self, 'ElevatorFloor_%s_FSM' % self.id)
self.type = ElevatorConstants.ELEVATOR_COUNTRY_CLUB self.type = ElevatorConstants.ELEVATOR_COUNTRY_CLUB
self.countdownTime = ElevatorConstants.ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorConstants.ElevatorData[self.type]['countdown']
self.lawOfficeId = lawOfficeId self.lawOfficeId = lawOfficeId
self.anyToonsBailed = 0
self.avIds = avIds self.avIds = avIds
self.isEntering = 0 self.isEntering = 0
self.isLocked = 0 self.isLocked = 0
@ -121,12 +120,8 @@ class DistributedClubElevatorAI(DistributedElevatorFSMAI.DistributedElevatorFSMA
if seatIndex == None: if seatIndex == None:
pass pass
self.clearFullNow(seatIndex) self.clearFullNow(seatIndex)
bailFlag = 0 self.resetCountdown()
if self.anyToonsBailed == 0: self.sendUpdate('emptySlot' + str(seatIndex), [avId, globalClockDelta.getRealNetworkTime()])
bailFlag = 1
self.resetCountdown()
self.anyToonsBailed = 1
self.sendUpdate('emptySlot' + str(seatIndex), [avId, bailFlag, globalClockDelta.getRealNetworkTime()])
if self.countFullSeats() == 0: if self.countFullSeats() == 0:
self.request('WaitEmpty') self.request('WaitEmpty')
taskMgr.doMethodLater(ElevatorConstants.TOON_EXIT_ELEVATOR_TIME, self.clearEmptyNow, self.uniqueName('clearEmpty-%s' % seatIndex), extraArgs = (seatIndex,)) taskMgr.doMethodLater(ElevatorConstants.TOON_EXIT_ELEVATOR_TIME, self.clearEmptyNow, self.uniqueName('clearEmpty-%s' % seatIndex), extraArgs = (seatIndex,))

View file

@ -250,29 +250,29 @@ class DistributedElevator(DistributedObject.DistributedObject):
self.boardedAvIds[avId] = None self.boardedAvIds[avId] = None
return return
def emptySlot0(self, avId, bailFlag, timestamp, time): def emptySlot0(self, avId, timestamp, time):
self.emptySlot(0, avId, bailFlag, timestamp, time) self.emptySlot(0, avId, timestamp, time)
def emptySlot1(self, avId, bailFlag, timestamp, time): def emptySlot1(self, avId, timestamp, time):
self.emptySlot(1, avId, bailFlag, timestamp, time) self.emptySlot(1, avId, timestamp, time)
def emptySlot2(self, avId, bailFlag, timestamp, time): def emptySlot2(self, avId, timestamp, time):
self.emptySlot(2, avId, bailFlag, timestamp, time) self.emptySlot(2, avId, timestamp, time)
def emptySlot3(self, avId, bailFlag, timestamp, time): def emptySlot3(self, avId, timestamp, time):
self.emptySlot(3, avId, bailFlag, timestamp, time) self.emptySlot(3, avId, timestamp, time)
def emptySlot4(self, avId, bailFlag, timestamp, time): def emptySlot4(self, avId, timestamp, time):
self.emptySlot(4, avId, bailFlag, timestamp, time) self.emptySlot(4, avId, timestamp, time)
def emptySlot5(self, avId, bailFlag, timestamp, time): def emptySlot5(self, avId, timestamp, time):
self.emptySlot(5, avId, bailFlag, timestamp) self.emptySlot(5, avId, timestamp)
def emptySlot6(self, avId, bailFlag, timestamp, time): def emptySlot6(self, avId, timestamp, time):
self.emptySlot(6, avId, bailFlag, timestamp, time) self.emptySlot(6, avId, timestamp, time)
def emptySlot7(self, avId, bailFlag, timestamp, time): def emptySlot7(self, avId, timestamp, time):
self.emptySlot(7, avId, bailFlag, timestamp, time) self.emptySlot(7, avId, timestamp, time)
def notifyToonOffElevator(self, toon): def notifyToonOffElevator(self, toon):
toon.setAnimState('neutral', 1.0) toon.setAnimState('neutral', 1.0)
@ -285,7 +285,7 @@ class DistributedElevator(DistributedObject.DistributedObject):
else: else:
toon.startSmooth() toon.startSmooth()
def emptySlot(self, index, avId, bailFlag, timestamp, timeSent = 0): def emptySlot(self, index, avId, timestamp, timeSent = 0):
if self.fillSlotTrack: if self.fillSlotTrack:
self.fillSlotTrack.finish() self.fillSlotTrack.finish()
self.fillSlotTrack = None self.fillSlotTrack = None
@ -303,7 +303,7 @@ class DistributedElevator(DistributedObject.DistributedObject):
if timeSent > 0: if timeSent > 0:
timeToSet = timeSent timeToSet = timeSent
if avId in self.cr.doId2do: if avId in self.cr.doId2do:
if bailFlag == 1 and hasattr(self, 'clockNode'): if hasattr(self, 'clockNode'):
if timestamp < timeToSet and timestamp >= 0: if timestamp < timeToSet and timestamp >= 0:
self.countdown(timeToSet - timestamp) self.countdown(timeToSet - timestamp)
else: else:
@ -333,18 +333,14 @@ class DistributedElevator(DistributedObject.DistributedObject):
def handleEnterSphere(self, collEntry): def handleEnterSphere(self, collEntry):
self.notify.debug('Entering Elevator Sphere....') self.notify.debug('Entering Elevator Sphere....')
if self.elevatorTripId and localAvatar.lastElevatorLeft == self.elevatorTripId: if base.localAvatar.hp > 0:
self.rejectBoard(base.localAvatar.doId, REJECT_SHUFFLE)
elif base.localAvatar.hp > 0:
self.cr.playGame.getPlace().detectedElevatorCollision(self) self.cr.playGame.getPlace().detectedElevatorCollision(self)
toon = base.localAvatar toon = base.localAvatar
self.sendUpdate('requestBoard', []) self.sendUpdate('requestBoard', [])
def rejectBoard(self, avId, reason = 0): def rejectBoard(self, avId, reason = 0):
if hasattr(base.localAvatar, 'elevatorNotifier'): if hasattr(base.localAvatar, 'elevatorNotifier'):
if reason == REJECT_SHUFFLE: if reason == REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff)
elif reason == REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage)
doneStatus = {'where': 'reject'} doneStatus = {'where': 'reject'}
elevator = self.getPlaceElevator() elevator = self.getPlaceElevator()
@ -368,7 +364,6 @@ class DistributedElevator(DistributedObject.DistributedObject):
return taskMgr.add(countdownTask, self.uniqueName('elevatorTimerTask')) return taskMgr.add(countdownTask, self.uniqueName('elevatorTimerTask'))
def handleExitButton(self): def handleExitButton(self):
localAvatar.lastElevatorLeft = self.elevatorTripId
self.sendUpdate('requestExit') self.sendUpdate('requestExit')
def enterWaitCountdown(self, ts): def enterWaitCountdown(self, ts):
@ -481,18 +476,6 @@ class DistributedElevator(DistributedObject.DistributedObject):
self.notify.warning("Place didn't exist") self.notify.warning("Place didn't exist")
return None return None
def setElevatorTripId(self, id):
self.elevatorTripId = id
def getElevatorTripId(self):
return self.elevatorTripId
def setAntiShuffle(self, antiShuffle):
self.antiShuffle = antiShuffle
def getAntiShuffle(self):
return self.antiShuffle
def storeToonTrack(self, avId, track): def storeToonTrack(self, avId, track):
self.clearToonTrack(avId) self.clearToonTrack(avId)
self.__toonTracks[avId] = track self.__toonTracks[avId] = track

View file

@ -11,21 +11,13 @@ from direct.directnotify import DirectNotifyGlobal
class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI): class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorAI') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorAI')
def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0): def __init__(self, air, bldg, numSeats = 4):
DistributedObjectAI.DistributedObjectAI.__init__(self, air) DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.type = ELEVATOR_NORMAL self.type = ELEVATOR_NORMAL
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']
self.bldg = bldg self.bldg = bldg
self.bldgDoId = bldg.getDoId() self.bldgDoId = bldg.getDoId()
self.seats = [] self.seats = []
self.setAntiShuffle(antiShuffle)
if self.antiShuffle:
if not hasattr(simbase.air, 'elevatorTripId'):
simbase.air.elevatorTripId = 1
self.elevatorTripId = simbase.air.elevatorTripId
simbase.air.elevatorTripId += 1
else:
self.elevatorTripId = 0
for seat in xrange(numSeats): for seat in xrange(numSeats):
self.seats.append(None) self.seats.append(None)
@ -237,7 +229,6 @@ class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI):
def exitWaitCountdown(self): def exitWaitCountdown(self):
self.accepting = 0 self.accepting = 0
taskMgr.remove(self.uniqueName('countdown-timer')) taskMgr.remove(self.uniqueName('countdown-timer'))
self.newTrip()
def enterAllAboard(self): def enterAllAboard(self):
self.accepting = 0 self.accepting = 0
@ -266,23 +257,3 @@ class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI):
def exitWaitEmpty(self): def exitWaitEmpty(self):
self.accepting = 0 self.accepting = 0
def setElevatorTripId(self, id):
self.elevatorTripId = id
def getElevatorTripId(self):
return self.elevatorTripId
def newTrip(self):
if self.antiShuffle:
self.elevatorTripId = simbase.air.elevatorTripId
if simbase.air.elevatorTripId > 2100000000:
simbase.air.elevatorTripId = 1
simbase.air.elevatorTripId += 1
self.sendUpdate('setElevatorTripId', [self.elevatorTripId])
def setAntiShuffle(self, antiShuffle):
self.antiShuffle = antiShuffle
def getAntiShuffle(self):
return self.antiShuffle

View file

@ -99,8 +99,6 @@ class DistributedElevatorExt(DistributedElevator.DistributedElevator):
if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty and localAvatar.boardingParty.getGroupLeader(localAvatar.doId): if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty and localAvatar.boardingParty.getGroupLeader(localAvatar.doId):
if localAvatar.boardingParty.getGroupLeader(localAvatar.doId) == localAvatar.doId: if localAvatar.boardingParty.getGroupLeader(localAvatar.doId) == localAvatar.doId:
localAvatar.boardingParty.handleEnterElevator(self) localAvatar.boardingParty.handleEnterElevator(self)
elif self.elevatorTripId and localAvatar.lastElevatorLeft == self.elevatorTripId:
self.rejectBoard(base.localAvatar.doId, REJECT_SHUFFLE)
elif base.localAvatar.hp > 0: elif base.localAvatar.hp > 0:
toon = base.localAvatar toon = base.localAvatar
self.sendUpdate('requestBoard', []) self.sendUpdate('requestBoard', [])

View file

@ -11,11 +11,9 @@ from direct.directnotify import DirectNotifyGlobal
class DistributedElevatorExtAI(DistributedElevatorAI.DistributedElevatorAI): class DistributedElevatorExtAI(DistributedElevatorAI.DistributedElevatorAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorExtAI') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorExtAI')
def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0): def __init__(self, air, bldg, numSeats = 4):
DistributedElevatorAI.DistributedElevatorAI.__init__(self, air, bldg, numSeats, antiShuffle=antiShuffle) DistributedElevatorAI.DistributedElevatorAI.__init__(self, air, bldg, numSeats)
self.anyToonsBailed = 0
self.boardingParty = None self.boardingParty = None
return
def delete(self): def delete(self):
for seatIndex in xrange(len(self.seats)): for seatIndex in xrange(len(self.seats)):
@ -52,33 +50,11 @@ class DistributedElevatorExtAI(DistributedElevatorAI.DistributedElevatorAI):
pass pass
else: else:
self.clearFullNow(seatIndex) self.clearFullNow(seatIndex)
bailFlag = 0 self.s
timeToSend = self.countdownTime timeToSend = self.countdownTime
if self.antiShuffle: self.sendUpdate('emptySlot' + str(seatIndex), [avId,
myTask = taskMgr.getTasksNamed(self.uniqueName('countdown-timer'))[0]
timeLeft = myTask.wakeTime - globalClock.getFrameTime()
timeLeft = max(0, timeLeft)
timeToSet = timeLeft + 10.0
timeToSet = min(timeLeft + 10.0, self.countdownTime)
self.setCountdown(timeToSet)
timeToSend = timeToSet
self.sendUpdate('emptySlot' + str(seatIndex), [avId,
1,
globalClockDelta.getRealNetworkTime(), globalClockDelta.getRealNetworkTime(),
timeToSend]) self.countdownTime])
elif self.anyToonsBailed == 0:
bailFlag = 1
self.resetCountdown()
self.anyToonsBailed = 1
self.sendUpdate('emptySlot' + str(seatIndex), [avId,
bailFlag,
globalClockDelta.getRealNetworkTime(),
timeToSend])
else:
self.sendUpdate('emptySlot' + str(seatIndex), [avId,
bailFlag,
globalClockDelta.getRealNetworkTime(),
timeToSend])
if self.countFullSeats() == 0: if self.countFullSeats() == 0:
self.fsm.request('waitEmpty') self.fsm.request('waitEmpty')
taskMgr.doMethodLater(TOON_EXIT_ELEVATOR_TIME, self.clearEmptyNow, self.uniqueName('clearEmpty-%s' % seatIndex), extraArgs=(seatIndex,)) taskMgr.doMethodLater(TOON_EXIT_ELEVATOR_TIME, self.clearEmptyNow, self.uniqueName('clearEmpty-%s' % seatIndex), extraArgs=(seatIndex,))
@ -94,7 +70,6 @@ class DistributedElevatorExtAI(DistributedElevatorAI.DistributedElevatorAI):
def enterWaitEmpty(self): def enterWaitEmpty(self):
DistributedElevatorAI.DistributedElevatorAI.enterWaitEmpty(self) DistributedElevatorAI.DistributedElevatorAI.enterWaitEmpty(self)
self.anyToonsBailed = 0
def enterWaitCountdown(self): def enterWaitCountdown(self):
DistributedElevatorAI.DistributedElevatorAI.enterWaitCountdown(self) DistributedElevatorAI.DistributedElevatorAI.enterWaitCountdown(self)

View file

@ -223,29 +223,29 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
track.start() track.start()
self.boardedAvIds[avId] = index self.boardedAvIds[avId] = index
def emptySlot0(self, avId, bailFlag, timestamp): def emptySlot0(self, avId, timestamp):
self.emptySlot(0, avId, bailFlag, timestamp) self.emptySlot(0, avId, timestamp)
def emptySlot1(self, avId, bailFlag, timestamp): def emptySlot1(self, avId, timestamp):
self.emptySlot(1, avId, bailFlag, timestamp) self.emptySlot(1, avId, timestamp)
def emptySlot2(self, avId, bailFlag, timestamp): def emptySlot2(self, avId, timestamp):
self.emptySlot(2, avId, bailFlag, timestamp) self.emptySlot(2, avId, timestamp)
def emptySlot3(self, avId, bailFlag, timestamp): def emptySlot3(self, avId, timestamp):
self.emptySlot(3, avId, bailFlag, timestamp) self.emptySlot(3, avId, timestamp)
def emptySlot4(self, avId, bailFlag, timestamp): def emptySlot4(self, avId, timestamp):
self.emptySlot(4, avId, bailFlag, timestamp) self.emptySlot(4, avId, timestamp)
def emptySlot5(self, avId, bailFlag, timestamp): def emptySlot5(self, avId, timestamp):
self.emptySlot(5, avId, bailFlag, timestamp) self.emptySlot(5, avId, timestamp)
def emptySlot6(self, avId, bailFlag, timestamp): def emptySlot6(self, avId, timestamp):
self.emptySlot(6, avId, bailFlag, timestamp) self.emptySlot(6, avId, timestamp)
def emptySlot7(self, avId, bailFlag, timestamp): def emptySlot7(self, avId, timestamp):
self.emptySlot(7, avId, bailFlag, timestamp) self.emptySlot(7, avId, timestamp)
def notifyToonOffElevator(self, toon): def notifyToonOffElevator(self, toon):
if self.cr: if self.cr:
@ -260,7 +260,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
toon.startSmooth() toon.startSmooth()
return return
def emptySlot(self, index, avId, bailFlag, timestamp): def emptySlot(self, index, avId, timestamp):
print 'Emptying slot: %d for %d' % (index, avId) print 'Emptying slot: %d for %d' % (index, avId)
if avId == 0: if avId == 0:
pass pass
@ -272,7 +272,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
self.deferredSlots = newSlots self.deferredSlots = newSlots
elif avId in self.cr.doId2do: elif avId in self.cr.doId2do:
if bailFlag == 1 and hasattr(self, 'clockNode'): if hasattr(self, 'clockNode'):
if timestamp < self.countdownTime and timestamp >= 0: if timestamp < self.countdownTime and timestamp >= 0:
self.countdown(self.countdownTime - timestamp) self.countdown(self.countdownTime - timestamp)
else: else:
@ -303,10 +303,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
def handleEnterSphere(self, collEntry): def handleEnterSphere(self, collEntry):
self.notify.debug('Entering Elevator Sphere....') self.notify.debug('Entering Elevator Sphere....')
print 'FSMhandleEnterSphere elevator%s avatar%s' % (self.elevatorTripId, localAvatar.lastElevatorLeft) if base.localAvatar.hp > 0:
if self.elevatorTripId and localAvatar.lastElevatorLeft == self.elevatorTripId:
self.rejectBoard(base.localAvatar.doId, REJECT_SHUFFLE)
elif base.localAvatar.hp > 0:
self.cr.playGame.getPlace().detectedElevatorCollision(self) self.cr.playGame.getPlace().detectedElevatorCollision(self)
toon = base.localAvatar toon = base.localAvatar
self.sendUpdate('requestBoard', []) self.sendUpdate('requestBoard', [])
@ -314,9 +311,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
def rejectBoard(self, avId, reason = 0): def rejectBoard(self, avId, reason = 0):
print 'rejectBoard %s' % reason print 'rejectBoard %s' % reason
if hasattr(base.localAvatar, 'elevatorNotifier'): if hasattr(base.localAvatar, 'elevatorNotifier'):
if reason == REJECT_SHUFFLE: if reason == REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff)
elif reason == REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage)
elif reason == REJECT_BLOCKED_ROOM: elif reason == REJECT_BLOCKED_ROOM:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorBlockedRoom) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorBlockedRoom)
@ -461,17 +456,5 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM):
point = self.elevatorPoints[index] point = self.elevatorPoints[index]
return point return point
def setElevatorTripId(self, id):
self.elevatorTripId = id
def getElevatorTripId(self):
return self.elevatorTripId
def setAntiShuffle(self, antiShuffle):
self.antiShuffle = antiShuffle
def getAntiShuffle(self):
return self.antiShuffle
def getDestName(self): def getDestName(self):
return None return None

View file

@ -38,7 +38,7 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
'Opening'] } 'Opening'] }
id = 0 id = 0
def __init__(self, air, bldg, numSeats = 4, antiShuffle = 0): def __init__(self, air, bldg, numSeats = 4):
DistributedObjectAI.DistributedObjectAI.__init__(self, air) DistributedObjectAI.DistributedObjectAI.__init__(self, air)
FSM.__init__(self, 'Elevator_%s_FSM' % self.id) FSM.__init__(self, 'Elevator_%s_FSM' % self.id)
self.type = ELEVATOR_NORMAL self.type = ELEVATOR_NORMAL
@ -49,15 +49,6 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
for seat in xrange(numSeats): for seat in xrange(numSeats):
self.seats.append(None) self.seats.append(None)
self.accepting = 0 self.accepting = 0
self.setAntiShuffle(antiShuffle)
if self.antiShuffle:
if not hasattr(simbase.air, 'elevatorTripId'):
simbase.air.elevatorTripId = 1
self.elevatorTripId = simbase.air.elevatorTripId
simbase.air.elevatorTripId += 1
else:
self.elevatorTripId = 0
def delete(self): def delete(self):
del self.bldg del self.bldg
@ -216,7 +207,6 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
def exitWaitCountdown(self): def exitWaitCountdown(self):
self.accepting = 0 self.accepting = 0
taskMgr.remove(self.uniqueName('countdown-timer')) taskMgr.remove(self.uniqueName('countdown-timer'))
self.newTrip()
def enterAllAboard(self): def enterAllAboard(self):
self.accepting = 0 self.accepting = 0
@ -250,23 +240,3 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM):
def exitWaitEmpty(self): def exitWaitEmpty(self):
self.accepting = 0 self.accepting = 0
def setElevatorTripId(self, id):
self.elevatorTripId = id
def getElevatorTripId(self):
return self.elevatorTripId
def newTrip(self):
if self.antiShuffle:
self.elevatorTripId = simbase.air.elevatorTripId
if simbase.air.elevatorTripId > 2100000000:
simbase.air.elevatorTripId = 1
simbase.air.elevatorTripId += 1
self.sendUpdate('setElevatorTripId', [self.elevatorTripId])
def setAntiShuffle(self, antiShuffle):
self.antiShuffle = antiShuffle
def getAntiShuffle(self):
return self.antiShuffle

View file

@ -264,9 +264,8 @@ class DistributedElevatorFloor(DistributedElevatorFSM.DistributedElevatorFSM):
return self.elevatorModel return self.elevatorModel
def kickEveryoneOut(self): def kickEveryoneOut(self):
bailFlag = 0
for avId, slot in self.boardedAvIds.items(): for avId, slot in self.boardedAvIds.items():
self.emptySlot(slot, avId, bailFlag, globalClockDelta.getRealNetworkTime()) self.emptySlot(slot, avId, globalClockDelta.getRealNetworkTime())
if avId == base.localAvatar.doId: if avId == base.localAvatar.doId:
pass pass

View file

@ -40,13 +40,12 @@ class DistributedElevatorFloorAI(DistributedElevatorFSMAI.DistributedElevatorFSM
'Opening'] } 'Opening'] }
id = 0 id = 0
def __init__(self, air, lawOfficeId, bldg, avIds, markerId = None, numSeats = 4, antiShuffle = 0): def __init__(self, air, lawOfficeId, bldg, avIds, markerId = None, numSeats = 4):
DistributedElevatorFSMAI.DistributedElevatorFSMAI.__init__(self, air, bldg, numSeats, antiShuffle = antiShuffle) DistributedElevatorFSMAI.DistributedElevatorFSMAI.__init__(self, air, bldg, numSeats)
FSM.__init__(self, 'ElevatorFloor_%s_FSM' % self.id) FSM.__init__(self, 'ElevatorFloor_%s_FSM' % self.id)
self.type = ELEVATOR_STAGE self.type = ELEVATOR_STAGE
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']
self.lawOfficeId = lawOfficeId self.lawOfficeId = lawOfficeId
self.anyToonsBailed = 0
self.avIds = avIds self.avIds = avIds
self.isEntering = 0 self.isEntering = 0
self.isLocked = 0 self.isLocked = 0
@ -120,12 +119,8 @@ class DistributedElevatorFloorAI(DistributedElevatorFSMAI.DistributedElevatorFSM
if seatIndex == None: if seatIndex == None:
pass pass
self.clearFullNow(seatIndex) self.clearFullNow(seatIndex)
bailFlag = 0 self.resetCountdown()
if self.anyToonsBailed == 0: self.sendUpdate('emptySlot' + str(seatIndex), [avId, globalClockDelta.getRealNetworkTime()])
bailFlag = 1
self.resetCountdown()
self.anyToonsBailed = 1
self.sendUpdate('emptySlot' + str(seatIndex), [avId, bailFlag, globalClockDelta.getRealNetworkTime()])
if self.countFullSeats() == 0: if self.countFullSeats() == 0:
self.request('WaitEmpty') self.request('WaitEmpty')
taskMgr.doMethodLater(TOON_EXIT_ELEVATOR_TIME, self.clearEmptyNow, self.uniqueName('clearEmpty-%s' % seatIndex), extraArgs = (seatIndex,)) taskMgr.doMethodLater(TOON_EXIT_ELEVATOR_TIME, self.clearEmptyNow, self.uniqueName('clearEmpty-%s' % seatIndex), extraArgs = (seatIndex,))

View file

@ -3,7 +3,7 @@ import DistributedBossElevatorAI
class DistributedVPElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): class DistributedVPElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI):
def __init__(self, air, bldg, zone, antiShuffle = 0): def __init__(self, air, bldg, zone):
DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone, antiShuffle=antiShuffle) DistributedBossElevatorAI.DistributedBossElevatorAI.__init__(self, air, bldg, zone)
self.type = ELEVATOR_VP self.type = ELEVATOR_VP
self.countdownTime = ElevatorData[self.type]['countdown'] self.countdownTime = ElevatorData[self.type]['countdown']

View file

@ -91,16 +91,8 @@ class Elevator(StateData.StateData):
if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty and localAvatar.boardingParty.getGroupLeader(localAvatar.doId) and localAvatar.boardingParty.getGroupLeader(localAvatar.doId) != localAvatar.doId: if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty and localAvatar.boardingParty.getGroupLeader(localAvatar.doId) and localAvatar.boardingParty.getGroupLeader(localAvatar.doId) != localAvatar.doId:
self.exitButton['command'] = None self.exitButton['command'] = None
self.exitButton.hide() self.exitButton.hide()
if self.distElevator.antiShuffle:
self.hopWarning = DirectLabel(parent=self.exitButton, relief=None, pos=Vec3(0, 0, 0.0), text=TTLocalizer.ElevatorStayOff, text_fg=(0.9, 0.9, 0.9, 1), text_pos=(0, -1.1), text_scale=0.6)
self.hopWarning.reparentTo(self.exitButton.stateNodePath[2])
else:
self.hopWarning = None
return
def disableExitButton(self): def disableExitButton(self):
if self.hopWarning:
self.hopWarning.destroy()
self.exitButton.destroy() self.exitButton.destroy()
def enterRequestExit(self): def enterRequestExit(self):

View file

@ -10,11 +10,10 @@ ELEVATOR_BB = 7
ELEVATOR_COUNTRY_CLUB = 8 ELEVATOR_COUNTRY_CLUB = 8
ELEVATOR_FIELD = 9 ELEVATOR_FIELD = 9
REJECT_NOREASON = 0 REJECT_NOREASON = 0
REJECT_SHUFFLE = 1 REJECT_NOSEAT = 1
REJECT_NOSEAT = 2 REJECT_PROMOTION = 2
REJECT_PROMOTION = 3 REJECT_BLOCKED_ROOM = 3
REJECT_BLOCKED_ROOM = 4 REJECT_BOARDINGPARTY = 4
REJECT_BOARDINGPARTY = 5
MAX_GROUP_BOARDING_TIME = 6.0 MAX_GROUP_BOARDING_TIME = 6.0
ElevatorData = {ELEVATOR_NORMAL: {'openTime': 2.0, ElevatorData = {ELEVATOR_NORMAL: {'openTime': 2.0,
'closeTime': 2.0, 'closeTime': 2.0,

View file

@ -353,9 +353,7 @@ class DistributedCogKart(DistributedElevatorExt.DistributedElevatorExt):
def rejectBoard(self, avId, reason = 0): def rejectBoard(self, avId, reason = 0):
print 'rejectBoard %s' % reason print 'rejectBoard %s' % reason
if hasattr(base.localAvatar, 'elevatorNotifier'): if hasattr(base.localAvatar, 'elevatorNotifier'):
if reason == ElevatorConstants.REJECT_SHUFFLE: if reason == ElevatorConstants.REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff)
elif reason == ElevatorConstants.REJECT_PROMOTION:
base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage) base.localAvatar.elevatorNotifier.showMe(TTLocalizer.BossElevatorRejectMessage)
doneStatus = {'where': 'reject'} doneStatus = {'where': 'reject'}
elevator = self.getPlaceElevator() elevator = self.getPlaceElevator()

View file

@ -9,8 +9,8 @@ from direct.task import Task
class DistributedFactoryElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedFactoryElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
def __init__(self, air, bldg, factoryId, entranceId, antiShuffle = 0): def __init__(self, air, bldg, factoryId, entranceId):
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle=antiShuffle) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg)
self.factoryId = factoryId self.factoryId = factoryId
self.entranceId = entranceId self.entranceId = entranceId

View file

@ -9,8 +9,8 @@ from toontown.toonbase import ToontownGlobals
class DistributedLawOfficeElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedLawOfficeElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
def __init__(self, air, bldg, lawOfficeId, entranceId, antiShuffle = 0): def __init__(self, air, bldg, lawOfficeId, entranceId):
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle = antiShuffle) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg)
self.lawOfficeId = lawOfficeId self.lawOfficeId = lawOfficeId
self.entranceId = entranceId self.entranceId = entranceId

View file

@ -10,8 +10,8 @@ import CogDisguiseGlobals
class DistributedMintElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI): class DistributedMintElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI):
def __init__(self, air, bldg, mintId, antiShuffle = 0): def __init__(self, air, bldg, mintId):
DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg, antiShuffle=antiShuffle) DistributedElevatorExtAI.DistributedElevatorExtAI.__init__(self, air, bldg)
self.mintId = mintId self.mintId = mintId
self.cogDept = ToontownGlobals.cogHQZoneId2deptIndex(self.mintId) self.cogDept = ToontownGlobals.cogHQZoneId2deptIndex(self.mintId)
self.type = ELEVATOR_MINT self.type = ELEVATOR_MINT

View file

@ -39,8 +39,7 @@ class CashbotHQAI(CogHQAI.CogHQAI):
) )
for i in xrange(len(destZones)): for i in xrange(len(destZones)):
mintElevator = DistributedMintElevatorExtAI( mintElevator = DistributedMintElevatorExtAI(
self.air, self.air.mintMgr, destZones[i], self.air, self.air.mintMgr, destZones[i])
antiShuffle=0)
mintElevator.generateWithRequired(self.zoneId) mintElevator.generateWithRequired(self.zoneId)
self.mintElevators.append(mintElevator) self.mintElevators.append(mintElevator)

View file

@ -52,7 +52,7 @@ class CogHQAI:
def createLobbyElevator(self): def createLobbyElevator(self):
self.lobbyElevator = self.lobbyElevatorCtor( self.lobbyElevator = self.lobbyElevatorCtor(
self.air, self.lobbyMgr, self.lobbyZoneId, antiShuffle=1) self.air, self.lobbyMgr, self.lobbyZoneId)
self.lobbyElevator.generateWithRequired(self.lobbyZoneId) self.lobbyElevator.generateWithRequired(self.lobbyZoneId)
def makeCogHQDoor(self, destinationZone, intDoorIndex, extDoorIndex, lock=0): def makeCogHQDoor(self, destinationZone, intDoorIndex, extDoorIndex, lock=0):

View file

@ -52,8 +52,7 @@ class LawbotHQAI(CogHQAI.CogHQAI):
) )
for i in xrange(len(destZones)): for i in xrange(len(destZones)):
lawOfficeElevator = DistributedLawOfficeElevatorExtAI( lawOfficeElevator = DistributedLawOfficeElevatorExtAI(
self.air, self.air.lawOfficeMgr, destZones[i], i, self.air, self.air.lawOfficeMgr, destZones[i], i)
antiShuffle=0)
lawOfficeElevator.generateWithRequired( lawOfficeElevator.generateWithRequired(
ToontownGlobals.LawbotOfficeExt) ToontownGlobals.LawbotOfficeExt)
self.lawOfficeElevators.append(lawOfficeElevator) self.lawOfficeElevators.append(lawOfficeElevator)

View file

@ -140,7 +140,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
self.touchingPlantList = [] self.touchingPlantList = []
self.inGardenAction = None self.inGardenAction = None
self.guiConflict = 0 self.guiConflict = 0
self.lastElevatorLeft = 0
self.elevatorNotifier = ElevatorNotifier.ElevatorNotifier() self.elevatorNotifier = ElevatorNotifier.ElevatorNotifier()
self._zoneId = None self._zoneId = None
self.accept('system message aknowledge', self.systemWarning) self.accept('system message aknowledge', self.systemWarning)

View file

@ -3056,9 +3056,7 @@ SuitAttackTaunts = {'Audit': ["I believe your books don't balance.",
WaitingForOtherToons = 'Waiting for other toons...' WaitingForOtherToons = 'Waiting for other toons...'
WaitingForOtherToonsDots = 'Waiting for other toons%s' WaitingForOtherToonsDots = 'Waiting for other toons%s'
ElevatorHopOff = 'Hop off' ElevatorHopOff = 'Hop off'
ElevatorStayOff = "If you hop off, you'll need to wait\nfor the elevator to leave or empty."
ElevatorLeaderOff = 'Only your leader can decide when to hop off.' ElevatorLeaderOff = 'Only your leader can decide when to hop off.'
ElevatorHoppedOff = 'You need to wait for the next elevator.'
ElevatorHopOK = 'Okay' ElevatorHopOK = 'Okay'
ElevatorGroupMember = 'Only your group leader can\n decide when to board.' ElevatorGroupMember = 'Only your group leader can\n decide when to board.'
CogsIncExt = ', Inc.' CogsIncExt = ', Inc.'