Correct filesystem permissions on daemon module
[mudpy.git] / mudpy / daemon.py
1 # Copyright (c) 2004-2016 Jeremy Stanley <fungi@yuggoth.org>. Permission
2 # to use, copy, modify, and distribute this software is granted under
3 # terms provided in the LICENSE file distributed with this software.
4
5 # core objects for the mudpy engine
6 import imp
7 import sys
8
9 import mudpy
10
11
12 def main():
13
14     # start it up
15     mudpy.misc.setup()
16
17     # loop indefinitely while the world is not flagged for termination or
18     # there are still connected users
19     while (not mudpy.misc.universe.terminate_flag or
20            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             imp.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()
33
34
35 if __name__ == '__main__':
36     sys.exit(main())