astron: astronSupport -> __astron__

This commit is contained in:
John Cote 2021-06-29 13:57:22 -04:00
parent 7195618d93
commit 092f6611cc
15 changed files with 56 additions and 55 deletions

View file

@ -22,7 +22,7 @@ class AIBase:
def __init__(self):
self.config = getConfigShowbase()
__builtins__['__dev__'] = self.config.GetBool('want-dev', 0)
__builtins__['astronSupport'] = self.config.GetBool('astron-support', True)
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
logStackDump = (self.config.GetBool('log-stack-dump', (not __dev__)) or self.config.GetBool('ai-log-stack-dump', (not __dev__)))
uploadStackDump = self.config.GetBool('upload-stack-dump', 0)
if logStackDump or uploadStackDump:
@ -57,6 +57,7 @@ class AIBase:
__builtins__['vfs'] = vfs
__builtins__['hidden'] = self.hidden
AIBase.notify.info('__dev__ == %s' % __dev__)
AIBase.notify.info('__astron__ == %s' % __astron__)
PythonUtil.recordFunctorCreationStacks()
__builtins__['wantTestObject'] = self.config.GetBool('want-test-object', 0)
self.wantStats = self.config.GetBool('want-pstats', 0)

View file

@ -175,8 +175,7 @@ class OTPClientRepository(ClientRepositoryBase):
self.accountOldAuth = config.GetBool('%s-account-old-auth' % game.name,
self.accountOldAuth)
self.useNewTTDevLogin = base.config.GetBool('use-tt-specific-dev-login', False)
astronSupport = config.GetBool('astron-support', True)
if astronSupport:
if __astron__:
self.loginInterface = LoginAstronAccount.LoginAstronAccount(self)
self.notify.info('loginInterface: LoginAstronAccount')
elif self.useNewTTDevLogin:
@ -426,7 +425,7 @@ class OTPClientRepository(ClientRepositoryBase):
self.__pendingMessages = {}
self.__doId2pendingInterest = {}
self.centralLogger = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_CENTRAL_LOGGER, 'CentralLogger')
if astronSupport:
if __astron__:
self.astronLoginManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_ASTRON_LOGIN_MANAGER, 'AstronLoginManager')
def startLeakDetector(self):
@ -524,7 +523,7 @@ class OTPClientRepository(ClientRepositoryBase):
return
self.startReaderPollTask()
if not astronSupport:
if not __astron__:
self.startHeartbeat()
newInstall = launcher.getIsNewInstallation()
newInstall = base.config.GetBool('new-installation', newInstall)
@ -946,7 +945,7 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterWaitForAvatarList(self):
if not astronSupport:
if not __astron__:
self.handler = self.handleWaitForAvatarList
self._requestAvatarList()
@ -958,7 +957,7 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def sendGetAvatarsMsg(self):
if astronSupport:
if __astron__:
self.astronLoginManager.sendRequestAvatarList()
else:
datagram = PyDatagram()
@ -1035,7 +1034,7 @@ class OTPClientRepository(ClientRepositoryBase):
self.loginFSM.request('shutdown')
return
if config.GetBool('astron-support', True):
if __astron__:
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def handleAvatarListResponse(self, avatarList):
avList = []
@ -1077,7 +1076,7 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def sendCreateAvatarMsg(self, avDNA, avName, avPosition):
if astronSupport:
if __astron__:
self.astronLoginManager.sendCreateAvatar(avDNA, avName, avPosition)
else:
datagram = PyDatagram()
@ -1106,14 +1105,14 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterWaitForDeleteAvatarResponse(self, potAv):
if not astronSupport:
if not __astron__:
self.handler = self.handleWaitForDeleteAvatarResponse
self.sendDeleteAvatarMsg(potAv.id)
self.waitForDatabaseTimeout(requestName='WaitForDeleteAvatarResponse')
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def sendDeleteAvatarMsg(self, avId):
if astronSupport:
if __astron__:
self.astronLoginManager.sendRequestRemoveAvatar(avId)
else:
datagram = PyDatagram()
@ -1157,7 +1156,7 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterWaitForSetAvatarResponse(self, potAv):
if not astronSupport:
if not __astron__:
self.handler = self.handleWaitForSetAvatarResponse
self.sendSetAvatarMsg(potAv)
self.waitForDatabaseTimeout(requestName='WaitForSetAvatarResponse')
@ -1177,7 +1176,7 @@ class OTPClientRepository(ClientRepositoryBase):
def sendSetAvatarIdMsg(self, avId):
if avId != self.__currentAvId:
self.__currentAvId = avId
if astronSupport:
if __astron__:
self.astronLoginManager.sendRequestPlayAvatar(avId)
else:
datagram = PyDatagram()
@ -1189,7 +1188,7 @@ class OTPClientRepository(ClientRepositoryBase):
else:
self.startPeriodTimer()
if not config.GetBool('astron-support', True):
if not __astron__:
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def handleAvatarResponseMsg(self, di):
pass
@ -1446,7 +1445,7 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def enterWaitOnEnterResponses(self, shardId, hoodId, zoneId, avId):
self.cleanGameExit = False
if not astronSupport:
if not __astron__:
self.handler = self.handleWaitOnEnterResponses
self.handlerArgs = {'hoodId': hoodId,
'zoneId': zoneId,
@ -1669,7 +1668,7 @@ class OTPClientRepository(ClientRepositoryBase):
else:
self.gameFSM.request('playGame', [hoodId, zoneId, avId])
if not config.GetBool('astron-support', True):
if not __astron__:
def handlePlayGame(self, msgType, di):
if self.notify.getDebug():
self.notify.debug('handle play game got message type: ' + repr(msgType))
@ -1993,7 +1992,7 @@ class OTPClientRepository(ClientRepositoryBase):
messenger.send('periodTimerExpired')
return Task.done
if not config.GetBool('astron-support', True):
if not __astron__:
def handleMessageType(self, msgType, di):
if msgType == CLIENT_GO_GET_LOST:
self.handleGoGetLost(di)
@ -2078,7 +2077,7 @@ class OTPClientRepository(ClientRepositoryBase):
di = DatagramIterator(dg, di.getCurrentIndex())
self.deferredGenerates.append((CLIENT_DONE_INTEREST_RESP, (dg, di)))
else:
if astronSupport:
if __astron__:
# Play back generates, if necessary.
# First, create a new DatagramIterator using
# the Datagram from DatagramIterator di, and
@ -2232,7 +2231,7 @@ class OTPClientRepository(ClientRepositoryBase):
return True
return False
if not config.GetBool('astron-support', True):
if not __astron__:
def handleGenerateWithRequired(self, di):
parentId = di.getUint32()
zoneId = di.getUint32()

View file

@ -234,7 +234,7 @@ class LoginScreen(StateData.StateData, GuiScreen.GuiScreen):
def exitShowConnectionProblemDialog(self):
pass
if not config.GetBool('astron-support', True):
if not __astron__:
def handleWaitForLoginResponse(self, msgType, di):
if msgType == CLIENT_LOGIN_2_RESP:
self.handleLoginResponseMsg2(di)
@ -495,7 +495,7 @@ class LoginScreen(StateData.StateData, GuiScreen.GuiScreen):
self.notify.debug('result=%s' % result)
return result
if not config.GetBool('astron-support', True):
if not __astron__:
def handleLoginToontownResponse(self, di):
self.notify.debug("handleLoginToontownResponse")
if 1:

View file

@ -96,7 +96,7 @@ class BattlePlace(Place.Place):
def doEnterZone(self, newZoneId):
if newZoneId != self.zoneId:
if newZoneId != None:
if astronSupport:
if __astron__:
if hasattr(self, 'zoneVisDict'):
visList = self.zoneVisDict[newZoneId]
else:
@ -112,7 +112,7 @@ class BattlePlace(Place.Place):
self.zoneId = newZoneId
return
if config.GetBool('astron-support', True):
if __astron__:
def genDNAFileName(self, zoneId):
zoneId = ZoneUtil.getCanonicalZoneId(zoneId)
hoodId = ZoneUtil.getCanonicalHoodId(zoneId)

View file

@ -76,7 +76,7 @@ class CogHQExterior(BattlePlace.BattlePlace):
self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.nodeList, self.zoneId)
how = requestStatus['how']
self.fsm.request(how, [requestStatus])
if base.cr.astronSupport and self.zoneId != ToontownGlobals.BossbotHQ:
if __astron__ and self.zoneId != ToontownGlobals.BossbotHQ:
self.handleInterests()
def exit(self):
@ -139,7 +139,7 @@ class CogHQExterior(BattlePlace.BattlePlace):
taskMgr.remove(base.localAvatar.uniqueName('finishSquishTask'))
base.localAvatar.laffMeter.stop()
if config.GetBool('astron-support', True):
if __astron__:
def handleInterests(self):
# First, we need to load the DNA file for this Cog HQ.
dnaStore = DNAStorage()

View file

@ -74,7 +74,7 @@ class FactoryExterior(BattlePlace.BattlePlace):
self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.nodeList, self.zoneId)
how = requestStatus['how']
self.fsm.request(how, [requestStatus])
if base.cr.astronSupport and self.zoneId != ToontownGlobals.LawbotOfficeExt:
if __astron__ and self.zoneId != ToontownGlobals.LawbotOfficeExt:
self.handleInterests()
def exit(self):
@ -158,7 +158,7 @@ class FactoryExterior(BattlePlace.BattlePlace):
else:
self.notify.error('Unknown mode: ' + where + ' in handleElevatorDone')
if config.GetBool('astron-support', True):
if __astron__:
def handleInterests(self):
# First, we need to load the DNA file for this Cog HQ.
dnaStore = DNAStorage()

View file

@ -178,7 +178,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
del self.okButton
del self.acceptedText
del self.acceptedBanner
if not astronSupport:
if not __astron__:
datagram = PyDatagram()
datagram.addUint16(CLIENT_SET_WISHNAME_CLEAR)
datagram.addUint32(avatarChoice.id)
@ -198,7 +198,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
def __handleReject(self, avList, index):
self.rejectDialog.cleanup()
if not astronSupport:
if not __astron__:
datagram = PyDatagram()
datagram.addUint16(CLIENT_SET_WISHNAME_CLEAR)
avid = 0
@ -208,7 +208,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
if avid == 0:
self.notify.error('Avatar rejected not found in avList. Index is: ' + str(index))
if not astronSupport:
if not __astron__:
datagram.addUint32(avid)
datagram.addUint8(0)
self.send(datagram)
@ -321,7 +321,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.avCreate = MakeAToon.MakeAToon(self.loginFSM, avList, 'makeAToonComplete', index, self.isPaid())
self.avCreate.load()
self.avCreate.enter()
if not astronSupport:
if not __astron__:
self.handler = self.handleCreateAvatar
self.accept('makeAToonComplete', self.__handleMakeAToon, [avList, index])
self.accept('nameShopCreateAvatar', self.sendCreateAvatarMsg)
@ -369,7 +369,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
del self.newPotAv
return
if not config.GetBool('astron-support', True):
if not __astron__:
def handleAvatarResponseMsg(self, di):
self.cleanupWaitingForDatabase()
avatarId = di.getUint32()
@ -523,7 +523,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.handlerArgs = {'hoodId': hoodId,
'zoneId': zoneId,
'avId': avId}
if not astronSupport:
if not __astron__:
self.handler = self.handleTutorialQuestion
self.__requestSkipTutorial(hoodId, zoneId, avId)
@ -551,7 +551,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
return
def enterTutorialQuestion(self, hoodId, zoneId, avId):
if not astronSupport:
if not __astron__:
self.handler = self.handleTutorialQuestion
self.__requestTutorial(hoodId, zoneId, avId)
@ -611,7 +611,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.handler = self.handleCloseShard
self._removeLocalAvFromStateServer()
if not config.GetBool('astron-support', True):
if not __astron__:
def handleCloseShard(self, msgType, di):
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
di2 = PyDatagramIterator(di)
@ -870,7 +870,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.friendsListError = 0
def sendGetFriendsListRequest(self):
if astronSupport:
if __astron__:
print('sendGetFriendsListRequest TODO')
else:
self.friendsMapPending = 1
@ -1097,12 +1097,12 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
return True
def sendQuietZoneRequest(self):
if astronSupport:
if __astron__:
self.sendSetZoneMsg(OTPGlobals.QuietZone, [])
else:
self.sendSetZoneMsg(OTPGlobals.QuietZone)
if not config.GetBool('astron-support', True):
if not __astron__:
def handleQuietZoneGenerateWithRequired(self, di):
parentId = di.getUint32()
zoneId = di.getUint32()

View file

@ -138,7 +138,7 @@ class QuietZoneState(StateData.StateData):
self._setZoneCompleteCallbacks.remove(token)
return
if not config.GetBool('astron-support', True):
if not __astron__:
def handleWaitForQuietZoneResponse(self, msgType, di):
# self.notify.debug('handleWaitForQuietZoneResponse(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
@ -165,7 +165,7 @@ class QuietZoneState(StateData.StateData):
else:
base.cr.handlePlayGame(msgType, di)
if not config.GetBool('astron-support', True):
if not __astron__:
def handleWaitForZoneRedirect(self, msgType, di):
# self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:

View file

@ -865,7 +865,7 @@ class NameShop(StateData.StateData):
def checkNamePattern(self):
self.notify.debug('checkNamePattern')
if astronSupport:
if __astron__:
base.cr.astronLoginManager.sendSetNamePattern(self.avId,
self.nameIndices[0], self.nameFlags[0],
self.nameIndices[1], self.nameFlags[1],
@ -887,7 +887,7 @@ class NameShop(StateData.StateData):
messenger.send('nameShopPost', [datagram])
self.waitForServer()
if not config.GetBool('astron-support', True):
if not __astron__:
def handleSetNamePatternAnswerMsg(self, di):
self.notify.debug('handleSetNamePatternAnswerMsg')
self.cleanupWaitForServer()
@ -953,14 +953,14 @@ class NameShop(StateData.StateData):
self.notify.debug('checkNameTyped')
if self._submitTypeANameAsPickAName():
return
if not astronSupport:
if not __astron__:
datagram = PyDatagram()
datagram.addUint16(CLIENT_SET_WISHNAME)
if justCheck:
avId = 0
else:
avId = self.avId
if not astronSupport:
if not __astron__:
datagram.addUint32(avId)
datagram.addString(self.nameEntry.get())
messenger.send('nameShopPost', [datagram])
@ -968,7 +968,7 @@ class NameShop(StateData.StateData):
base.cr.astronLoginManager.sendSetNameTyped(avId, self.nameEntry.get(), self.handleSetNameTypedAnswerMsg)
self.waitForServer()
if not config.GetBool('astron-support', True):
if not __astron__:
def handleSetNameTypedAnswerMsg(self, di):
self.notify.debug('handleSetNameTypedAnswerMsg')
self.cleanupWaitForServer()
@ -1082,14 +1082,14 @@ class NameShop(StateData.StateData):
self.requestingSkipTutorial = False
if not self.avExists or self.avExists and self.avId == 'deleteMe':
messenger.send('nameShopCreateAvatar', [style, '', self.index])
if astronSupport:
if __astron__:
self.accept('nameShopCreateAvatarDone', self.handleCreateAvatarResponseMsg)
else:
self.checkNameTyped()
self.notify.debug('Ending Make A Toon: %s' % self.toon.style)
base.cr.centralLogger.writeClientEvent('MAT - endingMakeAToon: %s' % self.toon.style)
if not config.GetBool('astron-support', True):
if not __astron__:
def handleCreateAvatarResponseMsg(self, di):
self.notify.debug('handleCreateAvatarResponseMsg')
echoContext = di.getUint16()

View file

@ -229,7 +229,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
if self.WantOldGMNameBan:
self._checkOldGMName()
messenger.send('avatarEntered', [self])
if config.GetBool('astron-support', True):
if __astron__:
self.sendUpdate('setDefaultShard', [self.air.districtId])
if hasattr(self, 'gameAccess') and self.gameAccess != 2:
if self.hat[0] != 0:
@ -250,7 +250,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.b_setShoes(0, 0, 0)
self.startPing()
if config.GetBool('astron-support', True):
if __astron__:
def setLocation(self, parentId, zoneId):
DistributedPlayerAI.DistributedPlayerAI.setLocation(self, parentId, zoneId)
if self.isPlayerControlled():

View file

@ -52,6 +52,8 @@ class ToonBase(OTPBase.OTPBase):
sys.exit(1)
self.disableShowbaseMouse()
base.debugRunningMultiplier /= OTPGlobals.ToonSpeedFactor
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
ToonBase.notify.info('__astron__ == %s' % __astron__)
self.toonChatSounds = self.config.GetBool('toon-chat-sounds', 1)
self.placeBeforeObjects = config.GetBool('place-before-objects', 1)
self.endlessQuietZone = False

View file

@ -82,7 +82,6 @@ version = OnscreenText(serverVersion, pos=(-1.3, -0.975), scale=0.06, fg=Vec4(0,
loader.beginBulkLoad('init', TTLocalizer.LoaderLabel, 138, 0, TTLocalizer.TIP_NONE)
from .ToonBaseGlobal import *
from direct.showbase.MessengerGlobal import *
builtins.astronSupport = base.config.GetBool('astron-support', True)
from toontown.distributed import ToontownClientRepository
cr = ToontownClientRepository.ToontownClientRepository(serverVersion, launcher)
cr.music = music

View file

@ -355,7 +355,7 @@ class Street(BattlePlace.BattlePlace):
if newZoneId != None:
self.loader.zoneDict[newZoneId].setColor(0, 0, 1, 1, 100)
if newZoneId != None:
if not astronSupport:
if not __astron__:
base.cr.sendSetZoneMsg(newZoneId)
else:
visZones = [self.loader.node2zone[x] for x in self.loader.nodeDict[newZoneId]]

View file

@ -73,7 +73,7 @@ class TownLoader(StateData.StateData):
del self.hood
del self.nodeDict
del self.zoneDict
if astronSupport:
if __astron__:
del self.node2zone
del self.fadeInDict
del self.fadeOutDict
@ -229,7 +229,7 @@ class TownLoader(StateData.StateData):
def makeDictionaries(self, dnaStore):
self.nodeDict = {}
self.zoneDict = {}
if astronSupport:
if __astron__:
self.node2zone = {}
self.nodeList = []
self.fadeInDict = {}
@ -254,7 +254,7 @@ class TownLoader(StateData.StateData):
self.nodeDict[zoneId] = []
self.nodeList.append(groupNode)
self.zoneDict[zoneId] = groupNode
if astronSupport:
if __astron__:
self.node2zone[groupNode] = zoneId
fadeDuration = 0.5
self.fadeOutDict[groupNode] = Sequence(Func(groupNode.setTransparency, 1), LerpColorScaleInterval(groupNode, fadeDuration, a0, startColorScale=a1), Func(groupNode.clearColorScale), Func(groupNode.clearTransparency), Func(groupNode.stash), name='fadeZone-' + str(zoneId), autoPause=1)

View file

@ -42,6 +42,6 @@ class ToontownUDRepository(ToontownInternalRepository):
globalClockRealTimeUponLogin=globalClock.getRealTime())
def createGlobals(self):
if astronSupport:
if __astron__:
# Create our Astron login manager...
self.astronLoginManager = self.generateGlobalObject(OTP_DO_ID_ASTRON_LOGIN_MANAGER, 'AstronLoginManager')