mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
more robust visibility locking for factory battles
This commit is contained in:
parent
0f2c0a09c1
commit
cda3c72e07
@ -405,6 +405,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
|
|||||||
# listen for camera-ray/floor collision events
|
# listen for camera-ray/floor collision events
|
||||||
def handleCameraRayFloorCollision(collEntry, self=self):
|
def handleCameraRayFloorCollision(collEntry, self=self):
|
||||||
name = collEntry.getIntoNode().getName()
|
name = collEntry.getIntoNode().getName()
|
||||||
|
print 'camera floor ray collided with: %s' % name
|
||||||
prefixLen = len(DistributedLevel.FloorCollPrefix)
|
prefixLen = len(DistributedLevel.FloorCollPrefix)
|
||||||
if (name[:prefixLen] == DistributedLevel.FloorCollPrefix):
|
if (name[:prefixLen] == DistributedLevel.FloorCollPrefix):
|
||||||
try:
|
try:
|
||||||
@ -455,7 +456,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
|
|||||||
self.notify.warning('got setZoneComplete for unknown zone %s' %
|
self.notify.warning('got setZoneComplete for unknown zone %s' %
|
||||||
zone)
|
zone)
|
||||||
else:
|
else:
|
||||||
print 'setZone %s complete' % self.setZonesReceived
|
self.notify.info('setZone #%s complete' % self.setZonesReceived)
|
||||||
messenger.send(self.getSetZoneCompleteEvent(
|
messenger.send(self.getSetZoneCompleteEvent(
|
||||||
self.setZonesReceived))
|
self.setZonesReceived))
|
||||||
self.setZonesReceived += 1
|
self.setZonesReceived += 1
|
||||||
@ -500,6 +501,12 @@ class DistributedLevel(DistributedObject.DistributedObject,
|
|||||||
def lockVisibility(self, zoneNum=None, zoneId=None):
|
def lockVisibility(self, zoneNum=None, zoneId=None):
|
||||||
"""call this to lock the visibility to a particular zone
|
"""call this to lock the visibility to a particular zone
|
||||||
pass in either network zoneId or model zoneNum
|
pass in either network zoneId or model zoneNum
|
||||||
|
|
||||||
|
this was added for battles in the HQ factories; if you engage a suit
|
||||||
|
in zone A with your camera in zone B, and you don't call this func,
|
||||||
|
your client will remain in zone B. If there's a door between A and B,
|
||||||
|
and it closes, zone B might disappear, along with the suit and the
|
||||||
|
battle objects.
|
||||||
"""
|
"""
|
||||||
assert (zoneNum is None) or (zoneId is None)
|
assert (zoneNum is None) or (zoneId is None)
|
||||||
assert not ((zoneNum is None) and (zoneId is None))
|
assert not ((zoneNum is None) and (zoneId is None))
|
||||||
@ -513,10 +520,13 @@ class DistributedLevel(DistributedObject.DistributedObject,
|
|||||||
def unlockVisibility(self):
|
def unlockVisibility(self):
|
||||||
"""release the visibility lock"""
|
"""release the visibility lock"""
|
||||||
self.notify.info('unlockVisibility')
|
self.notify.info('unlockVisibility')
|
||||||
if hasattr(self, 'lockVizZone'):
|
if not hasattr(self, 'lockVizZone'):
|
||||||
|
self.notify.warning('visibility already unlocked')
|
||||||
|
else:
|
||||||
del self.lockVizZone
|
del self.lockVizZone
|
||||||
self.updateVisibility()
|
self.updateVisibility()
|
||||||
|
|
||||||
|
|
||||||
def enterZone(self, zoneNum):
|
def enterZone(self, zoneNum):
|
||||||
DistributedLevel.notify.info("entering zone %s" % zoneNum)
|
DistributedLevel.notify.info("entering zone %s" % zoneNum)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user