P4 hazards: food spoilage with rot speed setting, smoking rack and salt, food poisoning, harsher blizzards, hard winters with lake ice, lightning on trees, snow on roofs (protocol 11)
This commit is contained in:
@@ -40,7 +40,9 @@ func list_worlds() -> Array:
|
||||
out.sort_custom(func(a, b): return float(a.get("last_played", 0)) > float(b.get("last_played", 0)))
|
||||
return out
|
||||
|
||||
func create_world(world_name: String, seed: int) -> String:
|
||||
## `options` are the world's own settings, kept in meta.json (P4: "rot",
|
||||
## how fast food spoils: "normal", "slow" or "off").
|
||||
func create_world(world_name: String, seed: int, options: Dictionary = {}) -> String:
|
||||
DirAccess.make_dir_recursive_absolute(root_dir)
|
||||
var base := world_name.to_lower().replace(" ", "_").validate_filename()
|
||||
if base.is_empty():
|
||||
@@ -52,10 +54,13 @@ func create_world(world_name: String, seed: int) -> String:
|
||||
n += 1
|
||||
DirAccess.make_dir_recursive_absolute(_dir(id))
|
||||
var now := Time.get_unix_time_from_system()
|
||||
_write_json(_dir(id).path_join("meta.json"), {
|
||||
var meta := {
|
||||
"name": world_name, "seed": seed, "created": now, "last_played": now,
|
||||
"play_time": 0.0, "version": VERSION,
|
||||
})
|
||||
}
|
||||
for k in options:
|
||||
meta[k] = options[k]
|
||||
_write_json(_dir(id).path_join("meta.json"), meta)
|
||||
return id
|
||||
|
||||
## The world slot called exactly `id` (a server's world), made with `seed` if
|
||||
|
||||
Reference in New Issue
Block a user