X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomrogue-server.py;h=b96794611a06dac718763e61b983400a199bcb97;hb=2abda4a2cf9ab42970b5fda00a433c7bcdb0f16e;hp=b6f9d8f15a4d6d87871a28e5bdddf4235e46ac02;hpb=8005ebbc6fde2ddb916d591a2f6130f83208640e;p=plomrogue diff --git a/plomrogue-server.py b/plomrogue-server.py index b6f9d8f..b967946 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -164,7 +164,7 @@ def save_world(): string = "" for key in world_db: - if dict != type(world_db[key]): + if dict != type(world_db[key]) and key != "MAP": string = string + key + " " + str(world_db[key]) + "\n" string = string + helper("ThingActions", "TA_ID") string = string + helper("ThingTypes", "TT_ID", {"TT_CORPSE_ID": False}) @@ -486,15 +486,20 @@ def command_makeworld(seed_string): def command_maplength(maplength_string): - # DUMMY. + """Redefine map length. Invalidate map, therefore lose all things on it.""" set_world_inactive() - # TODO: remove map (is this necessary? no memory management trouble …) world_db["Things"] = {} setter(None, "MAP_LENGTH", 1, 256)(maplength_string) def command_worldactive(worldactive_string): - # DUMMY. + """Toggle world_db["WORLD_ACTIVE"] if possible. + + An active world can always be set inactive. An inactive world can only be + set active with a "wait" ThingAction, and a player Thing (of ID 0). On + activation, rebuild all Things' FOVs and map memories. + """ + # In original version, map existence was also tested (unnecessarily?). val = integer_test(worldactive_string, 0, 1) if val: if 0 != world_db["WORLD_ACTIVE"]: @@ -513,8 +518,7 @@ def command_worldactive(worldactive_string): if 0 == Thing: player_exists = True break - map_exists = "MAP" in world_db - if wait_exists and player_exists and map_exists: + if wait_exists and player_exists: # TODO: rebuild all things' FOVs, map memories world_db["WORLD_ACTIVE"] = 1 @@ -800,7 +804,7 @@ commands_db = { """World state database. With sane default values.""" world_db = { - "TURN": 1, + "TURN": 0, "SEED_MAP": 0, "SEED_RANDOMNESS": 0, "PLAYER_TYPE": 0,