1 """Global variable objects for the MUFF Engine"""
3 # Copyright (c) 2005 mudpy, Jeremy Stanley <fungi@yuggoth.org>, all rights reserved.
4 # Licensed per terms in the LICENSE file distributed with this software.
6 # persistent variables are stored in ini-style files supported by ConfigParser
9 # hack to load all modules in the muff package
11 for module in muff.__all__:
12 exec("import " + module)
14 # does the files:variable setting exist yet?
16 if muffconf.get("files", "variable"): pass
18 # if not, reload the muffconf module
19 except AttributeError:
22 # now we can safely load persistent variables from file
23 variable_file = muffconf.get("files", "variable")
24 variable_data = ConfigParser.SafeConfigParser()
25 variable_data.read(variable_file)
27 # if there is no userlist, create an empty one
33 # if there is no listening socket, create an empty one
39 # flag to raise when the world should be shut down
40 terminate_world = False
42 # flag to raise when all code modules, config and data should be reloaded
43 reload_modules = False
45 # a dict of replacement macros
48 "$(bld)": chr(27) + "[1m",
49 "$(nrm)": chr(27) + "[0m",
50 "$(blk)": chr(27) + "[30m",
51 "$(grn)": chr(27) + "[32m",
52 "$(red)": chr(27) + "[31m"
55 # function to save persistent variables to file
57 file_descriptor = open(variable_file, "w")
58 variable_data.write(file_descriptor)
59 file_descriptor.flush()
60 file_descriptor.close()