X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=blobdiff_plain;f=mudpy;h=c295fd4746ae52ff84d3edd528452174537a0f50;hp=8e115bd905e6058282cb7db5c309da52306ce326;hb=e34437c01ef4ca0e2413bd08a76dd11b690c49a5;hpb=a89c4b2060bf3c93207a659d88f51a4bf0f891fa diff --git a/mudpy b/mudpy index 8e115bd..c295fd4 100755 --- a/mudpy +++ b/mudpy @@ -1,55 +1,40 @@ #!/usr/bin/python -"""Skeletal executable for the mudpy engine.""" +# -*- coding: utf-8 -*- +u"""Skeletal executable for the mudpy engine.""" -# Copyright (c) 2004-2008 Jeremy Stanley . Permission +# Copyright (c) 2004-2009 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 mudpy -# a consistent list so we can reimport these on reload -importlist = [ - "argv", - "create_pidfile", - "daemonize", - "log", - "on_pulse", - "reload_data", - "remove_pidfile", - "universe" - ] -for item in importlist: exec("from mudpy import " + item) - # log an initial message -log("Started mudpy with command line: " + " ".join(argv)) +import sys +mudpy.log(u"Started mudpy with command line: " + u" ".join(sys.argv)) # fork and disassociate -daemonize() +mudpy.daemonize() # make the pidfile -create_pidfile(universe) +mudpy.create_pidfile(mudpy.universe) # loop indefinitely while the world is not flagged for termination or -# there are connected users -while not universe.terminate_flag or universe.userlist: - - # the world was flagged for a reload of all code/data - if universe.reload_flag: +# there are still connected users +while not mudpy.universe.terminate_flag or mudpy.universe.userlist: - # reload the mudpy module - reload(mudpy) - for item in importlist: exec("from mudpy import " + item) + # the world was flagged for a reload of all code/data + if mudpy.universe.reload_flag: reload(mudpy) - # do what needs to be done on each pulse - on_pulse() + # do what needs to be done on each pulse + mudpy.on_pulse() # the loop has terminated, so save persistent data -universe.save() +mudpy.universe.save() # log a final message -log("Shutting down now.") +mudpy.log(u"Shutting down now.") # get rid of the pidfile -remove_pidfile(universe) +mudpy.remove_pidfile(mudpy.universe)