Source code for dork.types

# -*- coding: utf-8 -*-
"""Basic entity classes and methods for Dork.
"""

__all__ = ["Item", "Holder", "Player", "Room", "Path", "Map"]


[docs]class Item: """A obtainable/holdable item """ def __init__(self): self.holder = Holder()
[docs]class Holder: """A holder/container of items """ def __init__(self): self.items = list()
[docs]class Player(Holder): """A player or NPC in the game """ def __init__(self): super(Player, self).__init__() self.room = Room()
[docs]class Room(Holder): """A room on the map Note: can only be entered through entraces or exited through exits. """ def __init__(self): super(Room, self).__init__() self.map = Map() self.entrances = list() self.exits = list() self.players = list()
[docs]class Path: """A path between two rooms (i.e. a door or hallway) """ def __init__(self): self.entrance = Room() self.exit = Room()
[docs]class Map: """A map relating the rooms connectivity as well as the players/items within """ def __init__(self): self.rooms = list()