b1071e3417a07671bd58b3557b1d390b6f55e540
[mudpy.git] / bin / mudpy
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 """Skeletal executable for the mudpy engine."""
4
5 # Copyright (c) 2004-2011 Jeremy Stanley <fungi@yuggoth.org>. Permission
6 # to use, copy, modify, and distribute this software is granted under
7 # terms provided in the LICENSE file distributed with this software.
8
9 # core objects for the mudpy engine
10 import os.path
11 import sys
12 sys.path.append( os.path.realpath("lib") )
13 import mudpy
14
15 # start it up
16 mudpy.misc.setup()
17
18 # loop indefinitely while the world is not flagged for termination or
19 # there are still connected users
20 while not mudpy.misc.universe.terminate_flag or mudpy.misc.universe.userlist:
21
22     # the world was flagged for a reload of all code/data
23     if mudpy.misc.universe.reload_flag:
24         reload(mudpy)
25         mudpy.misc.reload_data()
26         mudpy.misc.universe.reload_flag = False
27
28     # do what needs to be done on each pulse
29     mudpy.misc.on_pulse()
30
31 # shut it all down
32 mudpy.misc.finish()