view gamelib/scenes/scene_widgets.py @ 247:0bad554d0926

More tests, some cryo room fixes and docs in the build.
author Jeremy Thurgood <firxen@gmail.com>
date Fri, 27 Aug 2010 13:32:27 +0200
parents 12c4f87ea424
children dfc89bc64fdb
line wrap: on
line source

"""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?",
            ]))