summaryrefslogtreecommitdiffstats
path: root/weatbag/items
diff options
context:
space:
mode:
authorJulian Irwin <julian.irwin@gmail.com>2013-01-26 13:03:36 -0500
committerJulian Irwin <julian.irwin@gmail.com>2013-01-26 13:03:36 -0500
commit96ec51791405fd8982fdda3ee430a0520f0a822c (patch)
tree337afbc8831baddd574700b0a0150102d5120e69 /weatbag/items
parent7f6cb008d54bb650662605ecd702089f87eea70d (diff)
parentf19f86792b33beaf2e1e12989a85557ae7fbc29c (diff)
Merge branch 'master' of git://github.com/takluyver/weatbag into southern-tiles-1
Getting everything up to date before I continue. Also see if anyone has added cool new features.
Diffstat (limited to 'weatbag/items')
-rw-r--r--weatbag/items/__init__.py26
-rw-r--r--weatbag/items/unlit_torch.py6
2 files changed, 32 insertions, 0 deletions
diff --git a/weatbag/items/__init__.py b/weatbag/items/__init__.py
new file mode 100644
index 0000000..3d0922f
--- /dev/null
+++ b/weatbag/items/__init__.py
@@ -0,0 +1,26 @@
+from importlib import import_module
+from types import ModuleType
+
+def get_item_module(name):
+ """Returns the module for that item, or a blank module if no module exists.
+ """
+ name = name.replace(' ','_')
+ try:
+ return import_module('weatbag.items.' + name)
+ except ImportError:
+ return ModuleType(name, "Dummy Module")
+
+
+def _combine(item1, item2):
+ "Try combining items one way"
+ try:
+ return get_item_module(item1).combine(item2)
+ except AttributeError:
+ pass
+
+def combine(item1, item2):
+ "Try combining items either way round."
+ results = _combine(item1, item2)
+ if results is None:
+ results = _combine(item2, item1)
+ return results
diff --git a/weatbag/items/unlit_torch.py b/weatbag/items/unlit_torch.py
new file mode 100644
index 0000000..1f313ca
--- /dev/null
+++ b/weatbag/items/unlit_torch.py
@@ -0,0 +1,6 @@
+def combine(other):
+ if other == 'match':
+ print("The torch sputters into life.")
+ return ['flaming torch']
+
+ return None