Commit 93f92611 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

CapacityStationBuffer sorting the entities that should move first and...

CapacityStationBuffer sorting the entities that should move first and canDispose returns false if no entity should move
parent b1ec5dcb
...@@ -48,3 +48,15 @@ class CapacityStationBuffer(Queue): ...@@ -48,3 +48,15 @@ class CapacityStationBuffer(Queue):
if self.isLocked: if self.isLocked:
return False return False
return Queue.canAccept(self) return Queue.canAccept(self)
def haveToDispose(self, callerObject=None):
activeObjectQ=self.getActiveObjectQueue()
if len(activeObjectQ)==0:
return False
if not activeObjectQ[0].shouldMove:
return False
# put the entities that should move in front
def sortEntities(self):
activeObjectQ=self.getActiveObjectQueue()
activeObjectQ.sort(key=lambda x: x.shouldMove, reverse=True)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment