mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
"Removed the Dockworker NPC and replaced it with the Dinghy interactive object. This required a bit of refactoring in a lot of various files. Here are some of the more substantial changes. Pirates now have three main ship references on them: their current ship(ship), their currently deployed ship(activeShip), and their current 'crew' ship(crewShip) (as opposed to an enemy ship that they've boarded). Also in this checkin - we're splitting the visibility of the players into two halves: the land half and the ocean half. This means they will only see ships when on the deck of a ship and only see land based objects when in a game area."
This commit is contained in:
parent
2623432189
commit
e4b69c22eb
@ -76,7 +76,7 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
||||
def getCenterPos(self):
|
||||
return self.centerPos
|
||||
|
||||
@report(types = ['frameCount', 'avLocation'], dConfigParam = 'want-connector-report')
|
||||
@report(types = ['deltaStamp', 'avLocation', 'args'], dConfigParam = ['want-connector-report','want-shipboard-report'])
|
||||
def startProcessVisibility(self, avatar):
|
||||
if not self._onOffState:
|
||||
# if we've been told that we're OFF, don't try
|
||||
@ -89,16 +89,19 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
||||
'startProcessVisibility(%s): tried to open a new interest during logout'
|
||||
% self.doId)
|
||||
return
|
||||
self.stopProcessVisibility()
|
||||
taskMgr.remove(self.taskName("processVisibility"))
|
||||
# self.stopProcessVisibility()
|
||||
self.acceptOnce(self.cr.StopVisibilityEvent, self.stopProcessVisibility)
|
||||
self.visAvatar = avatar
|
||||
self.visZone = None
|
||||
self.gridVisContext = self.cr.addInterest(
|
||||
self.getDoId(), 0, self.uniqueName("visibility"))
|
||||
self.visDirty = True
|
||||
if not self.gridVisContext:
|
||||
self.gridVisContext = self.cr.addInterest(
|
||||
self.getDoId(), 0, self.uniqueName("visibility"))
|
||||
taskMgr.add(
|
||||
self.processVisibility, self.taskName("processVisibility"))
|
||||
|
||||
@report(types = ['frameCount', 'avLocation'], dConfigParam = 'want-connector-report')
|
||||
@report(types = ['deltaStamp', 'avLocation', 'args'], dConfigParam = ['want-connector-report','want-shipboard-report'])
|
||||
def stopProcessVisibility(self, clearAll=False, event=None):
|
||||
self.ignore(self.cr.StopVisibilityEvent)
|
||||
taskMgr.remove(self.taskName("processVisibility"))
|
||||
@ -164,6 +167,9 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
||||
if (zoneId == self.visZone):
|
||||
assert self.notify.debug(
|
||||
"processVisibility: %s: interest did not change" % (self.doId))
|
||||
if self.visDirty:
|
||||
messenger.send(self.uniqueName("visibility"))
|
||||
self.visDirty = False
|
||||
return Task.cont
|
||||
else:
|
||||
assert self.notify.debug(
|
||||
@ -172,13 +178,20 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
||||
if not self.gridVisContext:
|
||||
self.gridVisContext = self.cr.addInterest(
|
||||
self.getDoId(), self.visZone,
|
||||
self.uniqueName("visibility"))
|
||||
self.uniqueName("visibility"),
|
||||
event = self.uniqueName("visibility"))
|
||||
else:
|
||||
assert self.notify.debug(
|
||||
"processVisibility: %s: altering interest to zoneId: %s" %
|
||||
(self.doId, zoneId))
|
||||
|
||||
event = None
|
||||
if self.visDirty:
|
||||
event = self.uniqueName("visibility")
|
||||
self.cr.alterInterest(
|
||||
self.gridVisContext, self.getDoId(), self.visZone)
|
||||
self.gridVisContext, self.getDoId(), self.visZone,
|
||||
event = event)
|
||||
|
||||
# If the visAvatar is parented to this grid, also do a
|
||||
# setLocation
|
||||
parentId = self.visAvatar.parentId
|
||||
@ -191,6 +204,7 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
||||
"processVisibility: %s: changing location" %
|
||||
(self.doId))
|
||||
self.handleAvatarZoneChange(self.visAvatar, zoneId)
|
||||
self.visDirty = False
|
||||
return Task.cont
|
||||
|
||||
# Update our location based on our avatar's position on the grid
|
||||
@ -227,7 +241,6 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
||||
# Set the location on the server
|
||||
av.b_setLocation(self.doId, zoneId)
|
||||
|
||||
|
||||
def turnOff(self):
|
||||
self._onOffState = False
|
||||
self.stopProcessVisibility()
|
||||
|
Loading…
x
Reference in New Issue
Block a user