doomsday: Add an "AskAgain" state to suits in case they run out of orders

This commit is contained in:
Joey Z 2014-03-06 23:57:51 -05:00
parent 7b0ff91bdf
commit 25b2aa94ba
2 changed files with 13 additions and 1 deletions

View file

@ -37,7 +37,8 @@ class InvasionMasterAI:
toonId = random.choice(attackables).doId
brain.demand('Attack', toonId)
else:
pass # Below state not implemented yet.
brain.demand('AskAgain')
# Below state not implemented yet.
#brain.demand('Wander')
def toonUnreachable(self, toonId):

View file

@ -278,6 +278,17 @@ class InvasionSuitBrainAI(FSM):
self.suit.idle()
self.master.requestOrders(self)
def enterAskAgain(self):
# Brain has absolutely nothing to do. Let's ask the master again in a few seconds in case any toons become available.
self.suit.idle()
self._askDelay = \
taskMgr.doMethodLater(10.0, self.demand,
self.suit.uniqueName('askingAgain'),
extraArgs=['Idle'])
def exitAskAgain(self):
self._askDelay.remove()
def enterAttack(self, toonId):
self.behavior = AttackBehavior(self, toonId)
self.behavior.start()