Add supply auto-purchase and preserve save recovery state
This commit is contained in:
@@ -1542,6 +1542,8 @@ func _raid_from_snapshot(raw: Dictionary) -> Dictionary:
|
||||
var state_index := RaidState.keys().find(String(_value(raw, &"state", &"")))
|
||||
if raid_id.is_empty() or state_index < 0:
|
||||
return {&"ok": false, &"error": "Raid snapshot ID or state is invalid."}
|
||||
# Normal creation owns Array[Dictionary]; restores keep the same container type.
|
||||
var parsed_waves: Array[Dictionary] = []
|
||||
var raid := {
|
||||
&"raid_id": raid_id,
|
||||
&"source_id": StringName(_value(raw, &"source_id", &"")),
|
||||
@@ -1564,7 +1566,7 @@ func _raid_from_snapshot(raw: Dictionary) -> Dictionary:
|
||||
&"multiple_entry_penalty": int(_value(raw, &"multiple_entry_penalty", -1)),
|
||||
&"entry_points": _sorted_unique_names(_value(raw, &"entry_points", [])),
|
||||
&"objective_ids": _sorted_unique_names(_value(raw, &"objective_ids", [])),
|
||||
&"waves": [],
|
||||
&"waves": parsed_waves,
|
||||
&"combatants": {},
|
||||
&"assets": {},
|
||||
&"queued_skills": {},
|
||||
@@ -1588,7 +1590,7 @@ func _raid_from_snapshot(raw: Dictionary) -> Dictionary:
|
||||
wave[&"objective_ids"] = _sorted_unique_names(_value(wave, &"objective_ids", []))
|
||||
wave[&"state"] = StringName(_value(wave, &"state", &""))
|
||||
wave[&"result_reason"] = StringName(_value(wave, &"result_reason", &""))
|
||||
(raid[&"waves"] as Array).append(wave)
|
||||
parsed_waves.append(wave)
|
||||
for raw_combatant: Variant in _value(raw, &"combatants", []):
|
||||
if not raw_combatant is Dictionary:
|
||||
return {&"ok": false, &"error": "Malformed defense combatant snapshot."}
|
||||
|
||||
Reference in New Issue
Block a user