comparison scripts/npc-test @ 476:1c05b6c2b971

Start of drop item support.
author Simon Cross <hodgestar@gmail.com>
date Sat, 09 Apr 2011 21:55:45 +0200
parents fbae2da0c3c0
children b48c194c4af9
comparison
equal deleted inserted replaced
475:18427edff33a 476:1c05b6c2b971
57 npc = getattr(game.world.npcs, npc_name) 57 npc = getattr(game.world.npcs, npc_name)
58 dsm = DSM(npc_name, game.world, npc.dsm, npc.state) 58 dsm = DSM(npc_name, game.world, npc.dsm, npc.state)
59 print " Loaded %s." % (npc.dsm) 59 print " Loaded %s." % (npc.dsm)
60 60
61 def test_switch_to(npc_name): 61 def test_switch_to(npc_name):
62 assert npc_name in game.world.npcs 62 assert npc_name in game.world.npcs, "Unknown NPC %r" % (npc_name,)
63
64 def test_drop_item(item_name):
65 assert item_name in game.world.items, "Unknown item %r" % (item_name,)
63 66
64 my_locals = { 67 my_locals = {
65 "world": dsm.world, 68 "world": dsm.world,
66 "state": dsm.states, 69 "state": dsm.states,
67 "npcs": dsm.world.npcs, 70 "npcs": dsm.world.npcs,
68 "switch_to": test_switch_to, 71 "switch_to": test_switch_to,
72 "drop_item": test_drop_item,
69 } 73 }
70 my_locals.update(DsmEvent().items) 74 my_locals.update(DsmEvent().items)
71 75
72 for state_name, state in dsm.states.items(): 76 for state_name, state in dsm.states.items():
73 print " Testing triggers for state %s" % state_name 77 print " Testing triggers for state %s" % state_name