X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=blobdiff_plain;f=mudpy%2Fdaemon.py;fp=mudpy%2Fdaemon.py;h=24132040f54b1682a0cb2193b3b07439a2d72bb5;hp=0000000000000000000000000000000000000000;hb=e2d7115d4ec4ee451c7f8e86a4f7277a940d9036;hpb=91ddbb70b5f3916ba9c13f9cb05528285d10ad5c diff --git a/mudpy/daemon.py b/mudpy/daemon.py new file mode 100755 index 0000000..2413204 --- /dev/null +++ b/mudpy/daemon.py @@ -0,0 +1,36 @@ +# Copyright (c) 2004-2016 Jeremy Stanley . Permission +# to use, copy, modify, and distribute this software is granted under +# terms provided in the LICENSE file distributed with this software. + +# core objects for the mudpy engine +import imp +import sys + +import mudpy + + +def main(): + + # start it up + mudpy.misc.setup() + + # loop indefinitely while the world is not flagged for termination or + # there are still connected users + while (not mudpy.misc.universe.terminate_flag or + mudpy.misc.universe.userlist): + + # the world was flagged for a reload of all code/data + if mudpy.misc.universe.reload_flag: + imp.reload(mudpy) + mudpy.misc.reload_data() + mudpy.misc.universe.reload_flag = False + + # do what needs to be done on each pulse + mudpy.misc.on_pulse() + + # shut it all down + mudpy.misc.finish() + + +if __name__ == '__main__': + sys.exit(main())