+ # TODO: Test for existence of player thing and 'wait' thing action?
+
+
+def command_maplength(maplength_string):
+ # DUMMY.
+ set_world_inactive()
+ # TODO: remove things, map
+ worlddb_value_setter("MAP_LENGTH", 1, 256)(maplength_string)
+
+
+def command_worldactive(worldactive_string):
+ # DUMMY.
+ val = integer_test(worldactive_string, 0, 1)
+ if val:
+ if 0 != world_db["WORLD_ACTIVE"] and 0 == val:
+ set_world_inactive()
+ elif 0 == world_db["WORLD_ACTIVE"]:
+ wait_exists = False
+ player_exists = False
+ map_exists = False
+ # TODO: perform tests:
+ # Is there thing action of name 'wait'?
+ # Is there a player thing?
+ # Is there a map?
+ if wait_exists and player_exists and map_exists:
+ # TODO: rebuild al things' FOVs, map memories
+ world_db["WORLD_ACTIVE"] = 1
+
+
+def command_taid(id_string):
+ """Set ID of ThingAction to manipulate. ID unused? Create new ThingAction.
+
+ The ID of the ThingAction to manipulate is stored as command_taid.id. If
+ the integer of the input value is valid (>= 0 and <= 255), but 0, a new ID
+ is calculated: The lowest unused ID >0 and <= 255. A new ThingAction's
+ "TA_EFFORT" defaults to 1, its "TA_NAME" to "wait".
+ """
+ id = integer_test(id_string, 0, 255)
+ if id:
+ if id in world_db["thing actions"]:
+ command_taid.id = id
+ else:
+ if 0 == id:
+ while 1:
+ id = id + 1
+ if id not in world_db["thing actions"]:
+ break
+ if id > 255:
+ print("Ignoring: "
+ "No unused ID available to add to ID list.")
+ return
+ world_db["thing actions"][id] = {
+ "TA_EFFORT": 1,
+ "TA_NAME": "wait"
+ }
+ command_taid.id = id
+
+
+def command_taeffort(str_int):
+ """Set to int(str_int) effort value of ThingAction of command_taid.id."""
+ if hasattr(command_taid, "id"):
+ val = integer_test(str_int, 0, 255)
+ if val:
+ world_db["thing actions"][command_taid.id]["TA_EFFORT"] = val