import os
from importlib import reload
import act_info
import interp
#dictionary of files to track. will be key'd by file name and the value will be modified unix timestamp
tracked_files = {}
def init_file(path, module):
#called by init_monitoring to begin tracking a file.
tracked_files[path] = (os.path.getmtime(path), module)
print("\t…Tracking %s\n" % path)
def init_monitoring():
#Called in main function to begin tracking files.
print("Monitoring files for modifications.\n")
init_file('act_info.py', act_info)
def poll_files():
#Called in game_loop of program to check if files have been modified.
for fp, pair in tracked_files.items():
mod, module = pair
if mod != os.path.getmtime(fp):
#File has been modified.
print("%s has been modified\n" % fp)
module = reload(module)
reload(interp)
tracked_files[fp] = (os.path.getmtime(fp), module)
The muds I played were original Diku, Silly, Smaug, and a couple of LPMUDs. I remember thinking Rom's character customization was pretty neat… but the one I tried took it to an extreme, so there effectively wasn't a point to classes any more, so I didn't play it long.