1 """Main loop for the MUFF Engine"""
3 # Copyright (c) 2005 MUDpy, The Fungi <fungi@yuggoth.org>, all rights reserved.
4 # Licensed per terms in the LICENSE file distributed with this software.
6 # string.strip is used to clean up leading/trailing whitespace in user input
9 # time.sleep is used in the loop to save cpu and provide crude pulse timing
12 # hack to load all modules in the muff package
14 for module in muff.__all__:
15 exec("import " + module)
20 # loop indefinitely while the world is not flagged for termination or
21 # there are connected users
22 while not muffvars.terminate_world or muffvars.userlist:
24 # the world was flagged for a reload of all code/data
25 if muffvars.reload_modules:
27 # reload the muff package
30 # reload all modules listed in the muff package
31 for module in muff.__all__:
32 exec("reload(muff." + module + ")")
34 # move data into new persistent objects
35 muffmisc.reload_data()
37 # reset the reload flag
38 muffvars.reload_modules = False
40 # do what needs to be done on each pulse
43 # the loop has terminated, so save persistent variables
47 muffmisc.log("Shutting down now.")