str(tt["TT_CONSUMABLE"]) + "\n" + \
"TT_LIFEPOINTS " + \
str(tt["TT_LIFEPOINTS"]) + "\n" + \
- "TT_CORPSE_ID " + \
- str(tt["TT_CORPSE_ID"]) + "\n" + \
"TT_PROLIFERATE " + \
str(tt["TT_PROLIFERATE"]) + "\n" + \
"TT_START_NUMBER " + \
str(tt["TT_START_NUMBER"]) + "\n" + \
"TT_NAME '" + tt["TT_NAME"] + "'\n" + \
"TT_SYMBOL '" + tt["TT_SYMBOL"] + "'\n"
+ for id in world_db["ThingTypes"]:
+ tt = world_db["ThingTypes"][id]
+ tt_string = tt_string + "TT_ID " + str(id) + "\n" + \
+ "TT_CORPSE_ID " + \
+ str(tt["TT_CORPSE_ID"]) + "\n"
atomic_write(io_db["path_save"],
"WORLD_ACTIVE " + str(world_db["WORLD_ACTIVE"]) + "\n" +
"MAP_LENGTH " + str(world_db["MAP_LENGTH"]) + "\n" +
def integer_test(val_string, min, max):
- """Return val_string if possible integer >= min and <= max, else False."""
+ """Return val_string if possible integer >= min and <= max, else None."""
try:
val = int(val_string)
if val < min or val > max:
except ValueError:
print("Ignoring: Please use integer >= " + str(min) + " and <= " +
str(max) + ".")
- return False
+ return None
def worlddb_value_setter(key, min, max):
>255, a new ID is calculated: the lowest unused ID >=0 and <= 255.
"""
id = integer_test(id_string, -32768, 32767)
- if id:
+ if None != id:
if id in world_db["ThingTypes"]:
command_ttid.id = id
else:
@test_ThingType_id
def f(val_string):
val = integer_test(val_string, min, max)
- if val:
+ if None != val:
world_db["ThingTypes"][command_ttid.id][key] = val
return f
def command_ttcorpseid(str_int):
"""Set to int(str_int) TT_CORPSE_ID of selected ThingType."""
val = integer_test(str_int, 0, 255)
- if val:
+ if None != val:
if val in world_db["ThingTypes"]:
world_db["ThingTypes"][command_ttid.id]["TT_CORPSE_ID"] = val
else:
is calculated: The lowest unused ID >0 and <= 255.
"""
id = integer_test(id_string, 0, 255)
- if id:
+ if None != id:
if id in world_db["ThingActions"]:
command_taid.id = id
else:
def command_taeffort(str_int):
"""Set to int(str_int) TA_EFFORT of selected ThingAction."""
val = integer_test(str_int, 0, 255)
- if val:
+ if None != val:
world_db["ThingActions"][command_taid.id]["TA_EFFORT"] = val