Engine should be consistent now, UI still broken.
[realism.git] / realism.py
blob388cb1fcc9348284ea9af0ee85fbd375b08ba1fd
1 #!/usr/bin/env python
3 # We allow mods to exist in the user's home directory, path:
4 # ~/.realism-rpg/mods/<modname>/
5 # On Windows XP, this translates to:
6 # <drive>:\Documents and Settings\<user>\.realism-rpg\mods\<modname>\
7 import sys
8 from os import makedirs
9 from os.path import join, expanduser, isdir
10 user_dir = join(expanduser('~'),'.realism-rpg')
11 if not isdir(user_dir):
12 makedirs(user_dir)
13 sys.path.append(user_dir)
15 # Game is just an empty class that holds the party, ui, and anything else we
16 # need to be able to use from anywhere.
17 class Game(object):
18 pass
20 game = Game()
22 from engine.party import HeroParty
23 game.party = HeroParty(game)
25 from ui.zork_ui import ZorkUI
26 ui = ZorkUI(game)
27 game.ui = ui
29 # Import the maps, register the game object with them, and validate them.
30 from engine.maps import maps
31 for game_map in maps.values():
32 game_map.game = game
33 game_map.validate(maps)
35 try:
36 from engine.maps import start_map
37 except ImportError:
38 if "start" not in maps.keys():
39 print "No start map found. Realism will exit."
40 sys.exit()
42 # maps["start"] guaranteed to exist.
43 start_map = maps["start"]
45 # start_map guaranteed to exist
46 ui.map_mode(start_map)
49 ui.main_loop()