changeset 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 9a6f53bebf2c
children 971c1726c530
files BUGS.txt skaapsteker/dialogue.py
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- 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):