2 """Skeletal executable for the mudpy engine."""
4 # Copyright (c) 2006 mudpy, Jeremy Stanley <fungi@yuggoth.org>, all rights reserved.
5 # Licensed per terms in the LICENSE file distributed with this software.
7 # core objects for the mudpy engine
10 # a consistent list so we can reimport these on reload
20 for item in importlist: exec("from mudpy import " + item)
22 # log an initial message
24 log("Started mudpy with command line: " + " ".join(argv))
26 # fork and disassociate
30 create_pidfile(universe)
32 # loop indefinitely while the world is not flagged for termination or
33 # there are connected users
34 while not universe.terminate_world or universe.userlist:
36 # the world was flagged for a reload of all code/data
37 if universe.reload_modules:
39 # reload the mudpy module
41 for item in importlist: exec("from mudpy import " + item)
43 # move data into new persistent objects
46 # reset the reload flag
47 universe.reload_modules = False
49 # do what needs to be done on each pulse
52 # the loop has terminated, so save persistent data
56 log("Shutting down now.")
58 # get rid of the pidfile
59 remove_pidfile(universe)