Mercurial > skaapsteker
diff skaapsteker/dialogue.py @ 331:45755c143813
Save npc state to world when a state transition occurs (fixes monk dialogue tree resetting bug).
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 09 Apr 2011 01:48:45 +0200 |
parents | 78220c989e6a |
children | 1c05b6c2b971 |
line wrap: on
line diff
--- a/skaapsteker/dialogue.py Sat Apr 09 01:38:20 2011 +0200 +++ b/skaapsteker/dialogue.py Sat Apr 09 01:48:45 2011 +0200 @@ -17,8 +17,10 @@ """ def __init__(self, name, world, json_filename, state): + self.name = name self.state = state self.world = world + self._me = getattr(self.world.npcs, name) self.states = AttrDict() src = json.loads(data.load(json_filename).read()) for state, state_src in src.iteritems(): @@ -50,7 +52,7 @@ if next_state is not None and next_state.name in self.states: self.states[self.state].leave(my_locals) self.state = next_state.name - # TODO: update self.world to reflect new state? + self._me.state = self.state self.states[self.state].enter(my_locals) def choice(self, i):