Implement apocalypse mechanics: add apocalypse queue, controller, and integrate into production logic

This commit is contained in:
Kirill
2026-10-18 00:05:53 +03:00
parent f53181b9ad
commit 3047ef5a85
12 changed files with 393 additions and 7 deletions
+9 -1
View File
@@ -250,8 +250,16 @@ static func _validate_payload(data: Variant, speed_limit: int, stages: Array, en
# Optional additions to the current format. Saves predating indicators keep
# their quantities and receive neutral defaults from Owniverse on load.
for field in saved:
if (not E.contains(required, field) and not E.contains(["world_parameters", "trends"], field)):
if (not E.contains(required, field) and not E.contains(["world_parameters", "trends", "apocalypse"], field)):
return "unsupported state structure"
if saved.has("apocalypse"):
var apocalypse: Variant = saved.apocalypse
if not apocalypse is Dictionary: return "invalid state.apocalypse"
for key in ["phase", "stage", "tick", "end_ticks"]:
if not _number(apocalypse.get(key), true): return E.add("invalid state.apocalypse.", key)
for key in ["type", "warning"]:
if not _number(apocalypse.get(key), true, false): return E.add("invalid state.apocalypse.", key)
if E.lt(apocalypse.phase, 0) or E.gt(apocalypse.phase, 2): return "invalid apocalypse phase"
if saved.has("world_parameters"):
if ((not _number_map(saved.world_parameters)) or E.ne(saved.world_parameters.size(), WorldParameters.defaults().size())):
return "invalid state.world_parameters"