Tokenize command string with shlex.split(comments=True). If replay is set,
a non-meta command from the commands_db merely triggers obey() on the next
command from the records file. If not, non-meta commands set
- io_db["worldstate_updateable"] to world_db["WORLD_EXISTS"], and, if
+ io_db["worldstate_updateable"] to world_db["WORLD_ACTIVE"], and, if
do_record is set, are recorded to io_db["record_chunk"], and save_world()
is called (and io_db["record_chunk"] written) if 15 seconds have passed
since the last time it was called. The prefix string is inserted into the
print("Invalid command/argument, or bad number of tokens.")
-def atomic_write(path, text, do_append=False):
+def atomic_write(path, text, do_append=False, delete=True):
"""Atomic write of text to file at path, appended if do_append is set."""
path_tmp = path + io_db["tmp_suffix"]
mode = "w"
file = open(path_tmp, mode)
strong_write(file, text)
file.close()
- if os.access(path, os.F_OK):
+ if delete and os.access(path, os.F_OK):
os.remove(path)
os.rename(path_tmp, path)
c = world_db["ThingTypes"][mt[0]]["TT_SYMBOL"]
mem[(mt[1] * length) + mt[2]] = ord(c)
string = write_map(string, mem)
- atomic_write(io_db["path_worldstate"], string)
+ atomic_write(io_db["path_worldstate"], string, delete=False)
strong_write(io_db["file_out"], "WORLD_UPDATED\n")
io_db["worldstate_updateable"] = False
t["T_MEMDEPTHMAP"] = bytearray(b' ' * (world_db["MAP_LENGTH"] ** 2))
ord_v = ord("v")
ord_0 = ord("0")
- ord_9 = ord("9")
ord_space = ord(" ")
for pos in [pos for pos in range(world_db["MAP_LENGTH"] ** 2)
if ord_v == t["fovmap"][pos]]: