# HG changeset patch # User Simon Cross # Date 1302306525 -7200 # Node ID 45755c14381324dfd11a26906ecec302c176144f # Parent 9a6f53bebf2c561be982c514886e61d156e4bc38 Save npc state to world when a state transition occurs (fixes monk dialogue tree resetting bug). diff -r 9a6f53bebf2c -r 45755c143813 BUGS.txt --- a/BUGS.txt Sat Apr 09 01:38:20 2011 +0200 +++ b/BUGS.txt Sat Apr 09 01:48:45 2011 +0200 @@ -1,3 +1,6 @@ * When you bring tea to the monk you don't get rid of the item +* When you die and respawn on the temple grounds while carrying tea the tea gets dropped by the door but is still in your inventory. It actually is in your inventory, because you can walk away from the door and really drop it. The ghost tea disappears if you activate the door. + +FIXED +===== * When you re-enter the temple the monk's conversation tree restarts -* When you die and respawn on the temple grounds while carrying tea the tea gets dropped by the door but is still in your inventory. It actually is in your inventory, because you can walk away from the door and really drop it. The ghost tea disappears if you activate the door. diff -r 9a6f53bebf2c -r 45755c143813 skaapsteker/dialogue.py --- 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):