adding getCurrentStateOrTransition()

This commit is contained in:
Josh Wilson 2010-02-19 02:01:15 +00:00
parent 1f4bc1cc1c
commit f4e55629fa
1 changed files with 12 additions and 0 deletions

View File

@ -204,6 +204,18 @@ class FSM(DirectObject):
finally:
self.fsmLock.release()
def getCurrentStateOrTransition(self):
# Returns the current state if we are in a state now, or the
# transition we are performing if we are currently within
# the enter or exit function for a state.
self.fsmLock.acquire()
try:
if self.state:
return self.state
return '%s -> %s' % (self.oldState, self.newState)
finally:
self.fsmLock.release()
def isInTransition(self):
self.fsmLock.acquire()
try: