summaryrefslogtreecommitdiffstats
path: root/test_tile.py
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-01-07 20:50:07 +0000
committerThomas Kluyver <takowl@gmail.com>2013-01-07 20:50:07 +0000
commit3400844980917bb3d59da322a3e33f55f81afe12 (patch)
tree898ff62681401e2c0a4b4a66c11f626d7b784a25 /test_tile.py
parent87e6fd0a9d0ec7869dc9e6e404638cc1e090e3a7 (diff)
Add a simple way to test tiles
Diffstat (limited to 'test_tile.py')
-rwxr-xr-xtest_tile.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test_tile.py b/test_tile.py
new file mode 100755
index 0000000..e6ab9e6
--- /dev/null
+++ b/test_tile.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+import sys
+from importlib import import_module
+from weatbag import Player, interact, name_to_coords
+
+if len(sys.argv) != 2:
+ print("Usage: ./test_tile.py <tile module>")
+ print("E.g. : ./test_tile.py n2")
+ sys.exit()
+
+player = Player('Test player')
+player.position = name_to_coords(sys.argv[1])
+
+mod = import_module('weatbag.tiles.' + sys.argv[1])
+if hasattr(mod, 'test_items'):
+ player.inventory.update(mod.test_items)
+ print("You have test items:")
+ for item, n in player.inventory.most_common():
+ if n < 1:
+ break
+ print(item, '(%d)' % n)
+ print()
+
+interact(player)
+