Mercurial > skaapsteker
comparison scripts/npc-test @ 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 | 9e6ff3eb63d6 |
children | fbae2da0c3c0 |
comparison
equal
deleted
inserted
replaced
301:922155cc0efd | 302:78220c989e6a |
---|---|
55 print "Checking", npc_name, "...", | 55 print "Checking", npc_name, "...", |
56 npc = getattr(game.world.npcs, npc_name) | 56 npc = getattr(game.world.npcs, npc_name) |
57 dsm = DSM(npc_name, game.world, npc.dsm, npc.state) | 57 dsm = DSM(npc_name, game.world, npc.dsm, npc.state) |
58 print " Loaded %s." % (npc.dsm) | 58 print " Loaded %s." % (npc.dsm) |
59 | 59 |
60 my_locals = { "world": dsm.world, "state": dsm.states, "npcs": dsm.world.npcs } | 60 def test_switch_to(npc_name): |
61 assert npc_name in game.world.npcs | |
62 | |
63 my_locals = { | |
64 "world": dsm.world, | |
65 "state": dsm.states, | |
66 "npcs": dsm.world.npcs, | |
67 "switch_to": test_switch_to, | |
68 } | |
61 my_locals.update(DsmEvent().items) | 69 my_locals.update(DsmEvent().items) |
70 | |
62 for state_name, state in dsm.states.items(): | 71 for state_name, state in dsm.states.items(): |
63 print " Testing triggers for state %s" % state_name | 72 print " Testing triggers for state %s" % state_name |
64 for trigger in state.triggers: | 73 for trigger in state.triggers: |
65 eval(trigger._matches, {}, my_locals.copy()) | 74 eval(trigger._matches, {}, my_locals.copy()) |
66 eval(trigger._next_state, {}, my_locals.copy()) | 75 eval(trigger._next_state, {}, my_locals.copy()) |