mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -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):
|
def getCenterPos(self):
|
||||||
return self.centerPos
|
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):
|
def startProcessVisibility(self, avatar):
|
||||||
if not self._onOffState:
|
if not self._onOffState:
|
||||||
# if we've been told that we're OFF, don't try
|
# 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'
|
'startProcessVisibility(%s): tried to open a new interest during logout'
|
||||||
% self.doId)
|
% self.doId)
|
||||||
return
|
return
|
||||||
self.stopProcessVisibility()
|
taskMgr.remove(self.taskName("processVisibility"))
|
||||||
|
# self.stopProcessVisibility()
|
||||||
self.acceptOnce(self.cr.StopVisibilityEvent, self.stopProcessVisibility)
|
self.acceptOnce(self.cr.StopVisibilityEvent, self.stopProcessVisibility)
|
||||||
self.visAvatar = avatar
|
self.visAvatar = avatar
|
||||||
self.visZone = None
|
self.visZone = None
|
||||||
self.gridVisContext = self.cr.addInterest(
|
self.visDirty = True
|
||||||
self.getDoId(), 0, self.uniqueName("visibility"))
|
if not self.gridVisContext:
|
||||||
|
self.gridVisContext = self.cr.addInterest(
|
||||||
|
self.getDoId(), 0, self.uniqueName("visibility"))
|
||||||
taskMgr.add(
|
taskMgr.add(
|
||||||
self.processVisibility, self.taskName("processVisibility"))
|
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):
|
def stopProcessVisibility(self, clearAll=False, event=None):
|
||||||
self.ignore(self.cr.StopVisibilityEvent)
|
self.ignore(self.cr.StopVisibilityEvent)
|
||||||
taskMgr.remove(self.taskName("processVisibility"))
|
taskMgr.remove(self.taskName("processVisibility"))
|
||||||
@ -164,6 +167,9 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
if (zoneId == self.visZone):
|
if (zoneId == self.visZone):
|
||||||
assert self.notify.debug(
|
assert self.notify.debug(
|
||||||
"processVisibility: %s: interest did not change" % (self.doId))
|
"processVisibility: %s: interest did not change" % (self.doId))
|
||||||
|
if self.visDirty:
|
||||||
|
messenger.send(self.uniqueName("visibility"))
|
||||||
|
self.visDirty = False
|
||||||
return Task.cont
|
return Task.cont
|
||||||
else:
|
else:
|
||||||
assert self.notify.debug(
|
assert self.notify.debug(
|
||||||
@ -172,13 +178,20 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
if not self.gridVisContext:
|
if not self.gridVisContext:
|
||||||
self.gridVisContext = self.cr.addInterest(
|
self.gridVisContext = self.cr.addInterest(
|
||||||
self.getDoId(), self.visZone,
|
self.getDoId(), self.visZone,
|
||||||
self.uniqueName("visibility"))
|
self.uniqueName("visibility"),
|
||||||
|
event = self.uniqueName("visibility"))
|
||||||
else:
|
else:
|
||||||
assert self.notify.debug(
|
assert self.notify.debug(
|
||||||
"processVisibility: %s: altering interest to zoneId: %s" %
|
"processVisibility: %s: altering interest to zoneId: %s" %
|
||||||
(self.doId, zoneId))
|
(self.doId, zoneId))
|
||||||
|
|
||||||
|
event = None
|
||||||
|
if self.visDirty:
|
||||||
|
event = self.uniqueName("visibility")
|
||||||
self.cr.alterInterest(
|
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
|
# If the visAvatar is parented to this grid, also do a
|
||||||
# setLocation
|
# setLocation
|
||||||
parentId = self.visAvatar.parentId
|
parentId = self.visAvatar.parentId
|
||||||
@ -191,6 +204,7 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
"processVisibility: %s: changing location" %
|
"processVisibility: %s: changing location" %
|
||||||
(self.doId))
|
(self.doId))
|
||||||
self.handleAvatarZoneChange(self.visAvatar, zoneId)
|
self.handleAvatarZoneChange(self.visAvatar, zoneId)
|
||||||
|
self.visDirty = False
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
# Update our location based on our avatar's position on the grid
|
# 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
|
# Set the location on the server
|
||||||
av.b_setLocation(self.doId, zoneId)
|
av.b_setLocation(self.doId, zoneId)
|
||||||
|
|
||||||
|
|
||||||
def turnOff(self):
|
def turnOff(self):
|
||||||
self._onOffState = False
|
self._onOffState = False
|
||||||
self.stopProcessVisibility()
|
self.stopProcessVisibility()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user