changeset 292:93352ab52f2e

Fix up possible inconsistencies in guard state machine fox shape handling by making liberal use of auto_next and splitting a state in two (one for the fox, one for the human).
author Simon Cross <hodgestar@gmail.com>
date Fri, 08 Apr 2011 21:59:42 +0200
parents 04be4219742b
children e22b0e4d52ae
files data/npcs/guard.json
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/data/npcs/guard.json	Fri Apr 08 21:58:35 2011 +0200
+++ b/data/npcs/guard.json	Fri Apr 08 21:59:42 2011 +0200
@@ -11,7 +11,7 @@
         "choices" : [
             { "text": "Why is that?", "next": "state.monks" },
             { "text": "Let me out now!", "next": "state.staycalm" },
-            { "text": "Sayonara.", "next": "state.secondtry" }
+            { "text": "Sayonara.", "next": "state.secondtry_human" }
         ],
         "events" : [
             { "matches" : "world.fox.shape == 'human_with_fan'", "next": "state.disguised" },
@@ -20,22 +20,29 @@
     },
     "monks" : {
         "text" : "The monks have asked us not to let anybody out.",
-        "choices" : [
-            { "text": "Pretty please?", "next": "state.noexceptions" }
-        ]
+        "auto_next" : "state.noexceptions",
+        "auto_next_text" : "Pretty please?"
     },
     "noexceptions" : {
         "text" : "Sorry, no exceptions.",
-        "auto_next": "state.secondtry"
+        "auto_next": "state.secondtry_human"
     },
     "staycalm" : {
         "text" : "Please stay calm. Perhaps you should go meditate?",
-        "auto_next": "state.secondtry"
+        "auto_next": "state.secondtry_human"
     },
-    "secondtry" : {
+    "secondtry_fox" : {
+        "text" : "Shoo!",
+        "events" : [
+            { "matches" : "world.fox.shape == 'human_with_fan'", "next": "state.disguised" },
+            { "matches" : "world.fox.shape == 'human'", "next": "state.secondtry_human" }
+        ]
+    },
+    "secondtry_human" : {
         "text" : "The gate is locked, and it’s staying locked.",
         "events" : [
-            { "matches" : "world.fox.shape == 'human_with_fan'", "next": "state.disguised" }
+            { "matches" : "world.fox.shape == 'human_with_fan'", "next": "state.disguised" },
+            { "matches" : "world.fox.shape == 'fox'", "next": "state.secondtry_fox" }
         ]
     },
     "disguised" : {