diff gamelib/scenes/scene_widgets.py @ 242:12c4f87ea424

Unify doors a bit
author Neil Muller <neil@dip.sun.ac.za>
date Fri, 27 Aug 2010 11:32:49 +0200
parents
children dfc89bc64fdb
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gamelib/scenes/scene_widgets.py	Fri Aug 27 11:32:49 2010 +0200
@@ -0,0 +1,29 @@
+"""Generic, game specific widgets"""
+
+import random
+
+from gamelib.state import Thing, Result
+
+
+class Door(Thing):
+    """A door somewhere"""
+
+    DEST = "map"
+
+    def is_interactive(self):
+        return True
+
+    def interact_without(self):
+        """Go to map."""
+        self.state.set_current_scene("map")
+
+    def get_description(self):
+        return 'An open doorway leads to the rest of the ship.'
+
+    def interact_default(self, item):
+        return Result(random.choice([
+            "Sadly, this isn't that sort of game.",
+            "Your valiant efforts are foiled by the Evil Game Designer.",
+            "Waving that in the doorway does nothing. Try something else, perhaps?",
+            ]))
+