X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=server%2Fio.py;h=ce3ee1a947eca4b9109cf4e9df51c57f41248028;hb=HEAD;hp=a483e2d4e313bdd91ddd25f08aa7f700e9e55376;hpb=c3d814a6e3a1e021427e3b543290a358c43a8c9f;p=plomrogue
diff --git a/server/io.py b/server/io.py
index a483e2d..ce3ee1a 100644
--- a/server/io.py
+++ b/server/io.py
@@ -170,12 +170,10 @@ def save_world():
for _id in sorted(world_db[category].keys()):
string = string + id_string + " " + str(_id) + "\n"
for key in sorted(world_db[category][_id].keys()):
- if not key in special_keys:
+ if key.isupper() and not key in special_keys:
x = world_db[category][_id][key]
argument = quote_escape(x) if str == type(x) else str(x)
string = string + key + " " + argument + "\n"
- elif special_keys[key]:
- string = string + special_keys[key](_id)
return string
def helper_things():
@@ -187,32 +185,13 @@ def save_world():
t = world_db["Things"][tid]
for key in sorted(t.keys()):
if key not in {"T_CARRIES", "carried", "fovmap", "T_MEMMAP",
- "T_MEMTHING", "T_MEMDEPTHMAP"}:
+ "T_MEMTHING", "T_MEMDEPTHMAP", "pos"}:
argument = t[key]
string += key + " " + (quote_escape(argument) if \
str == type(argument) else str(argument)) + "\n"
string += memthing(tid) + memmap(tid) + memdepthmap(tid)
return string
- # ALTERNATIVE TO helper_things, but not more efficient despite listcomp
- # def helper4():
- # def foo(t, key):
- # argument = t[key]
- # return key + " " + (quote_escape(argument) if \
- # str == type(argument) else str(argument)) + "\n"
- # string = ""
- # memmap = mapsetter("T_MEMMAP")
- # memdepthmap = mapsetter("T_MEMDEPTHMAP")
- # for tid in sorted(world_db["Things"].keys()):
- # string += "T_ID " + str(tid) + "\n"
- # t = world_db["Things"][tid]
- # lines = [foo(t, key) for key in sorted(t.keys())
- # if key not in {"T_CARRIES", "carried", "fovmap",
- # "T_MEMMAP", "T_MEMTHING", "T_MEMDEPTHMAP"}]
- # string += "".join(lines)
- # string += memthing(tid) + memmap(tid) + memdepthmap(tid)
- # return string
-
string = ""
for plugin in world_db["PLUGIN"]:
string = string + "PLUGIN " + plugin + "\n"
@@ -307,7 +286,7 @@ def obey_lines_in_file(path, name, do_record=False):
def try_worldstate_update():
"""Write worldstate file if io_db["worldstate_updateable"] is set."""
- if io_db["worldstate_updateable"]:
+ if world_db["WORLD_ACTIVE"] and io_db["worldstate_updateable"]:
string = ""
for entry in io_db["worldstate_write_order"]:
if entry[1] == "world_int":