X-Git-Url: https://mudpy.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=mudpy;h=d0f46d8a54ec91f39f6ca5dc9ae7b383804704ad;hb=d7eec051850f0a83c191c8552703c310ae2c9959;hp=6dd58806229c5114cc41aad7292f5cb70fd14a75;hpb=fc67241160a8fa4810e80e4700e91bf5ec0b574b;p=mudpy.git diff --git a/mudpy b/mudpy index 6dd5880..d0f46d8 100755 --- a/mudpy +++ b/mudpy @@ -1,36 +1,35 @@ #!/usr/bin/python -"""Skeletal executable for the MUFF Engine""" +"""Skeletal executable for the mudpy engine.""" -# Copyright (c) 2005 MUDpy, The Fungi , all rights reserved. +# Copyright (c) 2005 mudpy, The Fungi , all rights reserved. # Licensed per terms in the LICENSE file distributed with this software. -# muff uses the ini-style configs supported by the ConfigParser module -import ConfigParser +# core objects for the mudpy engine +import mudpy +from mudpy import log, on_pulse, reload_data, universe -# need the sys module to alter the import path appropriately -import sys +# loop indefinitely while the world is not flagged for termination or +# there are connected users +while not universe.terminate_world or universe.userlist: -def get_main_loop(): - """Find and return the main loop function""" + # the world was flagged for a reload of all code/data + if universe.reload_modules: - # figure out where to find our main configuration file - config_data = ConfigParser.SafeConfigParser() - config_dirs = [".", "./etc", "/usr/local/muff", "/usr/local/muff/etc", "/etc/muff", "/etc" ] - config_name = "mudpy.conf" - config_files = [] - for each_dir in config_dirs: - config_files.append(each_dir + "/" + config_name) + # reload the mudpy module + reload(mudpy) - # load the config file, get the module path and add it to sys.path - config_data.read(config_files) - module_path = config_data.get("files", "modules") - sys.path.append(module_path) + # move data into new persistent objects + reload_data() - # import the main loop function - from muff.muffmain import main - return main + # reset the reload flag + universe.reload_modules = False -# load the main loop and run it -main = get_main_loop() -main() + # do what needs to be done on each pulse + on_pulse() + +# the loop has terminated, so save persistent data +universe.save() + +# log a final message +log("Shutting down now.")