mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
gets rid of a race condition potentially on the ai
This commit is contained in:
parent
a3febca96c
commit
dbb484fff5
@ -92,19 +92,17 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
|
|||||||
def updateGridTask(self, task=None):
|
def updateGridTask(self, task=None):
|
||||||
# Run through all grid objects and update their parents if needed
|
# Run through all grid objects and update their parents if needed
|
||||||
missingObjs = []
|
missingObjs = []
|
||||||
for avId in self.gridObjects:
|
for avId in self.gridObjects.keys():
|
||||||
av = self.gridObjects[avId]
|
av = self.gridObjects[avId]
|
||||||
# handle a missing object after it is already gone?
|
# handle a missing object after it is already gone?
|
||||||
if (av.isEmpty()):
|
if (av.isEmpty()):
|
||||||
missingObjs.append(avId)
|
del self.gridObjects[avId]
|
||||||
continue
|
continue
|
||||||
pos = av.getPos()
|
pos = av.getPos()
|
||||||
if ((pos[0] < 0 or pos[1] < 0) or
|
if ((pos[0] < 0 or pos[1] < 0) or
|
||||||
(pos[0] > self.cellWidth or pos[1] > self.cellWidth)):
|
(pos[0] > self.cellWidth or pos[1] > self.cellWidth)):
|
||||||
# we are out of the bounds of this current cell
|
# we are out of the bounds of this current cell
|
||||||
self.handleAvatarZoneChange(av)
|
self.handleAvatarZoneChange(av)
|
||||||
for currMissingObj in missingObjs:
|
|
||||||
del self.gridObjects[avId]
|
|
||||||
# Do this every second, not every frame
|
# Do this every second, not every frame
|
||||||
if (task):
|
if (task):
|
||||||
task.delayTime = 1.0
|
task.delayTime = 1.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user