瀏覽代碼

more robust visibility locking for factory battles

Darren Ranalli 22 年之前
父節點
當前提交
cda3c72e07
共有 1 個文件被更改,包括 12 次插入2 次删除
  1. 12 2
      direct/src/level/DistributedLevel.py

+ 12 - 2
direct/src/level/DistributedLevel.py

@@ -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,9 +520,12 @@ 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)