election: Stun invading suits when hit by pie.

This commit is contained in:
Sam Edwards 2014-02-17 02:38:03 -07:00
parent cc1b67724f
commit ef2f90a61c
3 changed files with 26 additions and 4 deletions

View file

@ -113,6 +113,13 @@ class DistributedInvasionSuit(DistributedSuitBase, InvasionSuitBase, FSM):
explosionTrack.append(Func(explosion.removeNode))
return explosionTrack
def enterStunned(self, time):
self._stunInterval = ActorInterval(self, 'pie-small-react')
self._stunInterval.start(time)
def exitStunned(self):
self._stunInterval.finish()
def enterExplode(self, time):
loseActor = self.getLoseActor()
loseActor.reparentTo(render)

View file

@ -65,8 +65,23 @@ class DistributedInvasionSuitAI(DistributedSuitBaseAI, InvasionSuitBase, FSM):
self.__stopWalkTimer()
def enterExplode(self):
def enterStunned(self):
self.brain.stop()
self._delay = taskMgr.doMethodLater(SuitTimings.suitStun, self.__unstun,
self.uniqueName('stunned'))
def __unstun(self, task):
if self.currHP < 1:
# We're dead!
self.b_setState('Explode')
else:
# Not dead, we can go back to thinking:
self.demand('Idle')
self.brain.start()
return task.done
def enterExplode(self):
self._delay = taskMgr.doMethodLater(SuitTimings.suitDeath, self.__exploded,
self.uniqueName('explode'))
@ -115,9 +130,8 @@ class DistributedInvasionSuitAI(DistributedSuitBaseAI, InvasionSuitBase, FSM):
hp = min(hp, self.currHP) # Don't take more damage than we have...
self.b_setHP(self.currHP - hp)
if self.currHP < 1:
# We're dead!
self.b_setState('Explode')
if self.state != 'Stunned':
self.b_setState('Stunned')
def d_sayFaceoffTaunt(self):
self.sendUpdate('sayFaceoffTaunt', [])

View file

@ -6,3 +6,4 @@ fromSuitBuilding = 2.0
toSuitBuilding = 2.5
toToonBuilding = 2.5
suitDeath = 7.5
suitStun = 2.5