diff skaapsteker/dialogue.py @ 302:78220c989e6a

Add supporting for flicking between speaking NPCs.
author Simon Cross <hodgestar@gmail.com>
date Fri, 08 Apr 2011 23:27:43 +0200
parents 04be4219742b
children 45755c143813
line wrap: on
line diff
--- a/skaapsteker/dialogue.py	Fri Apr 08 23:16:11 2011 +0200
+++ b/skaapsteker/dialogue.py	Fri Apr 08 23:27:43 2011 +0200
@@ -1,6 +1,7 @@
 import json
 
 from . import data
+from .engine import OpenDialog
 
 
 class DSM(object):
@@ -32,11 +33,16 @@
         self.poke()
         return bool(self.states[self.state].text)
 
+    def _switch_dialogue_to(self, npc_name):
+        """Switch dialogue to another npc."""
+        OpenDialog.post(npc_name)
+
     def event(self, ev):
         my_locals = {
             "state": self.states,
             "world": self.world,
             "npcs": self.world.npcs,
+            "switch_to": self._switch_dialogue_to,
         }
         my_locals.update(ev.items)
         state = self.states[self.state]