view gamelib/scenes/scene_widgets.py @ 262:5f58da9eeb52

Replace text interacts with doors.
author Simon Cross <hodgestar+bzr@gmail.com>
date Fri, 27 Aug 2010 19:22:47 +0200
parents dfc89bc64fdb
children 3b4a78422201
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"
    SCENE = None

    def __init__(self):
        self.NAME = self.SCENE + '.door'
        Thing.__init__(self)

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