Merge branch 'develop' into friends

This commit is contained in:
John Cote 2021-07-09 12:35:28 -04:00
commit ae156a4b07
16 changed files with 29 additions and 23 deletions

View File

@ -23,7 +23,8 @@ class AIBase:
self.config = getConfigShowbase()
__builtins__['__dev__'] = self.config.GetBool('want-dev', 0)
__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__)))
__builtins__['__execWarnings__'] = self.config.GetBool('want-exec-warnings', 0)
logStackDump = (self.config.GetBool('log-stack-dump', (not __debug__)) or self.config.GetBool('ai-log-stack-dump', (not __debug__)))
uploadStackDump = self.config.GetBool('upload-stack-dump', 0)
if logStackDump or uploadStackDump:
ExceptionVarDump.install(logStackDump, uploadStackDump)

View File

@ -72,7 +72,7 @@ AIMsgName2Id = {'STATESERVER_OBJECT_GENERATE_WITH_REQUIRED': 2001,
'DBSERVER_SET_STORED_VALUES': 1014,
'SERVER_PING': 5002}
AIMsgId2Names = invertDictLossless(AIMsgName2Id)
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING AIMsgTypes: %s' % AIMsgName2Id)
printStack()
for name, value in list(AIMsgName2Id.items()):

View File

@ -100,16 +100,16 @@ class ChatInputNormal(DirectObject.DirectObject):
def __execMessage(self, message):
if not ChatInputNormal.ExecNamespace:
ChatInputNormal.ExecNamespace = {}
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
exec('from panda3d.core import *', globals(), self.ExecNamespace)
self.importExecNamespace()
try:
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputNormal eval: %s' % message)
printStack()
return str(eval(message, globals(), ChatInputNormal.ExecNamespace))
except SyntaxError:
try:
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputNormal exec: %s' % message)
printStack()
exec(message, globals(), ChatInputNormal.ExecNamespace)

View File

@ -130,13 +130,13 @@ class ChatInputTyped(DirectObject.DirectObject):
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
self.importExecNamespace()
try:
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputNormal eval: %s' % message)
printStack()
return str(eval(message, globals(), ChatInputTyped.ExecNamespace))
except SyntaxError:
try:
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputNormal exec: %s' % message)
printStack()
exec(message, globals(), ChatInputTyped.ExecNamespace)

View File

@ -285,16 +285,16 @@ class ChatInputWhiteListFrame(FSM.FSM, DirectFrame):
def __execMessage(self, message):
if not ChatInputTyped.ExecNamespace:
ChatInputTyped.ExecNamespace = {}
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
exec('from panda3d.core import *', globals(), self.ExecNamespace)
self.importExecNamespace()
try:
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputWhiteListFrame eval: %s' % message)
printStack()
return str(eval(message, globals(), ChatInputTyped.ExecNamespace))
except SyntaxError:
try:
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING ChatInputWhiteListFrame exec: %s' % message)
printStack()
exec(message, globals(), ChatInputTyped.ExecNamespace)

View File

@ -249,16 +249,16 @@ class TalkAssistant(DirectObject.DirectObject):
print('execMessage %s' % message)
if not TalkAssistant.ExecNamespace:
TalkAssistant.ExecNamespace = {}
exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
exec('from panda3d.core import *', globals(), self.ExecNamespace)
self.importExecNamespace()
try:
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING TalkAssistant eval: %s' % message)
printStack()
return str(eval(message, globals(), TalkAssistant.ExecNamespace))
except SyntaxError:
try:
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING TalkAssistant exec: %s' % message)
printStack()
exec(message, globals(), TalkAssistant.ExecNamespace)

View File

@ -92,7 +92,7 @@ class LevelSpec:
def getCopyOfSpec(self, spec):
specCopy = {}
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING LevelSpec exec: %s' % self.getSpecImportsModuleName())
printStack()
exec('from %s import *' % self.getSpecImportsModuleName())

View File

@ -11,6 +11,7 @@ class OTPBase(ShowBase):
self.wantEnviroDR = False
ShowBase.__init__(self, windowType=windowType)
__builtins__['__astron__'] = self.config.GetBool('astron-support', 1)
__builtins__['__execWarnings__'] = self.config.GetBool('want-exec-warnings', 0)
OTPBase.notify.info('__astron__ == %s' % __astron__)
if config.GetBool('want-phase-checker', 0):
from direct.showbase import Loader

View File

@ -5,7 +5,7 @@ TTAIMsgName2Id = {'DBSERVER_GET_ESTATE': 1040,
'IN_GAME_NEWS_MANAGER_UD_TO_ALL_AI': 1043,
'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044}
TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id)
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id)
printStack()
for name, value in list(TTAIMsgName2Id.items()):

View File

@ -175,7 +175,12 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame):
def applyFilter(self, keyArgs, strict = False):
text = self.chatEntry.get(plain=True)
if len(text) > 0 and text[0] in ['~', '>']:
prefixes = []
if base.cr.magicWordManager and base.cr.wantMagicWords:
prefixes.append(base.cr.magicWordManager.chatPrefix)
if config.GetBool('exec-chat', 0):
prefixes.append('>')
if len(text) > 0 and text[0] in prefixes:
self.okayToSubmit = True
else:
words = text.split(' ')

View File

@ -41,7 +41,7 @@ BossbotCountryClubMiddleRoomIDs = (2, 5, 6)
BossbotCountryClubFinalRoomIDs = (18,)
BossbotCountryClubConnectorRooms = ('phase_12/models/bossbotHQ/Connector_Tunnel_A', 'phase_12/models/bossbotHQ/Connector_Tunnel_B')
CashbotMintSpecModules = {}
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING CountryClubRoomSpecs: %s' % BossbotCountryClubRoomName2RoomId)
printStack()
for roomName, roomId in list(BossbotCountryClubRoomName2RoomId.items()):

View File

@ -62,7 +62,7 @@ CashbotMintMiddleRoomIDs = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1
CashbotMintFinalRoomIDs = (17, 18, 19, 20, 21, 22, 23, 24, 25)
CashbotMintConnectorRooms = ('phase_10/models/cashbotHQ/connector_7cubeL2', 'phase_10/models/cashbotHQ/connector_7cubeR2')
CashbotMintSpecModules = {}
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING MintRoomSpecs: %s' % CashbotMintRoomName2RoomId)
printStack()
for roomName, roomId in list(CashbotMintRoomName2RoomId.items()):

View File

@ -48,7 +48,7 @@ CashbotStageMiddleRoomIDs = (1,)
CashbotStageFinalRoomIDs = (2,)
CashbotStageConnectorRooms = ('phase_11/models/lawbotHQ/LB_connector_7cubeL2', 'phase_11/models/lawbotHQ/LB_connector_7cubeLR')
CashbotStageSpecModules = {}
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING StageRoomSpecs: %s' % CashbotStageRoomName2RoomId)
printStack()
for roomName, roomId in list(CashbotStageRoomName2RoomId.items()):

View File

@ -785,7 +785,7 @@ class DistributedCannon(DistributedObject.DistributedObject):
if not self.toonHead:
return Task.done
flightResults = self.__calcFlightResults(avId, launchTime)
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING DistributedCannon: %s' % flightResults)
printStack()
for key in flightResults:

View File

@ -262,7 +262,7 @@ class DistributedPartyCannonActivity(DistributedPartyActivity):
if self.isLocalToonId(toonId):
self.inWater = 0
flightResults = self.__calcFlightResults(cannon, toonId, launchTime)
if not isClient():
if not __debug__ or __execWarnings__:
print('EXECWARNING DistributedPartyCannonActivity: %s' % flightResults)
printStack()
for key in flightResults:

View File

@ -49,8 +49,7 @@ class ToontownMagicWordManager(DistributedObject.DistributedObject):
DistributedObject.DistributedObject.announceGenerate(self)
# Only use a custom Magic Word activator if the index is allowed
# TODO: Uncomment after adding settings support
activatorIndex = 0 # base.settings.getInt('game', 'magic-word-activator', 0)
activatorIndex = base.settings.getSetting('magic-word-activator', 0)
if 0 <= activatorIndex <= (len(PREFIX_ALLOWED) - 1):
self.chatPrefix = PREFIX_ALLOWED[activatorIndex]