mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
AI and client check entTypeReg hashes
This commit is contained in:
parent
509110cdc1
commit
0761ade4ae
@ -112,11 +112,16 @@ class DistributedLevel(DistributedObject.DistributedObject,
|
|||||||
# if we're in debug, give the server the opportunity to send us
|
# if we're in debug, give the server the opportunity to send us
|
||||||
# a full spec
|
# a full spec
|
||||||
self.candidateSpec = levelSpec
|
self.candidateSpec = levelSpec
|
||||||
self.sendUpdate('requestCurrentLevelSpec', [hash(levelSpec)])
|
self.sendUpdate('requestCurrentLevelSpec',
|
||||||
|
[hash(levelSpec),
|
||||||
|
hash(levelSpec.entTypeReg)])
|
||||||
else:
|
else:
|
||||||
self.privGotSpec(levelSpec)
|
self.privGotSpec(levelSpec)
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
def setSpecDeny(self, reason):
|
||||||
|
DistributedLevel.notify.error(reason)
|
||||||
|
|
||||||
def setSpecSenderDoId(self, doId):
|
def setSpecSenderDoId(self, doId):
|
||||||
DistributedLevel.notify.debug('setSpecSenderDoId: %s' % doId)
|
DistributedLevel.notify.debug('setSpecSenderDoId: %s' % doId)
|
||||||
blobSender = toonbase.tcr.doId2do[doId]
|
blobSender = toonbase.tcr.doId2do[doId]
|
||||||
|
@ -116,8 +116,20 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI,
|
|||||||
self.levelSpec.saveToDisk()
|
self.levelSpec.saveToDisk()
|
||||||
self.modified = 0
|
self.modified = 0
|
||||||
|
|
||||||
def requestCurrentLevelSpec(self, specHash):
|
def requestCurrentLevelSpec(self, specHash, entTypeRegHash):
|
||||||
senderId = self.air.msgSender
|
senderId = self.air.msgSender
|
||||||
|
|
||||||
|
# first check the typeReg hash -- if it doesn't match, the
|
||||||
|
# client should not be connecting. Their entityTypeRegistry
|
||||||
|
# is different from ours.
|
||||||
|
srvHash = hash(self.levelSpec.entTypeReg)
|
||||||
|
if srvHash != entTypeRegHash:
|
||||||
|
self.sendUpdateToAvatarId(
|
||||||
|
senderId, 'setSpecDeny',
|
||||||
|
['EntityTypeRegistry hashes do not match! '
|
||||||
|
'(server:%s, client:%s' % (srvHash, entTypeRegHash)])
|
||||||
|
return
|
||||||
|
|
||||||
spec = None
|
spec = None
|
||||||
if hash(self.levelSpec) != specHash:
|
if hash(self.levelSpec) != specHash:
|
||||||
spec = self.levelSpec
|
spec = self.levelSpec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user