Changeset 286:0dbb50d07764


Ignore:
Timestamp:
04/08/11 18:58:12 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Message:

Poke the current state before checking to see if there is text in case the world has changed and it is time for the state machine to move on.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/dialogue.py

    r285 r286  
    3030
    3131    def has_text(self):
     32        self.poke()
    3233        return bool(self.states[self.state].text)
    3334
     
    5354        self.event(DsmEvent(auto_next=True))
    5455
     56    def poke(self):
     57        # poke the current state to see if it feels like making
     58        # a transition.
     59        self.event(DsmEvent(poke=True))
     60
    5561
    5662class AttrDict(dict):
     
    6470class DsmEvent(object):
    6571
    66     def __init__(self, choice=None, auto_next=False):
     72    def __init__(self, choice=None, auto_next=False, poke=False):
    6773        self.items = {
    6874            "choice": choice,
    6975            "auto_next": auto_next,
     76            "poke": poke,
    7077        }
    7178
Note: See TracChangeset for help on using the changeset viewer.