mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
Restore pre-2.0 logistic slots and bound imported stats
Logistic slots saved before 2.0 are keyed by index strings, which json_to_table keeps as strings, so the migration branch never ran and the 2.0 branch failed on the missing sections. Detect the old format by the missing sections and convert the keys to numbers. The import schema now uses the minimums Factorio enforces for character stats, checks the filter value type and the quick bar comparator, and allows filters without quality or comparator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c06555c5da
commit
5ca10d579d
3 files changed
+34
-16
No files matched your search
@@ -75,7 +75,12 @@ describe("player_sync plugin", function() {
|
||||
personal_logistic_slots: {
|
||||
enabled: true,
|
||||
trash_not_requested: false,
|
||||
sections: [{ group: "", active: true, multiplier: 1, filters: [{ index: 1, min: 50 }] }],
|
||||
sections: [{
|
||||
group: "",
|
||||
active: true,
|
||||
multiplier: 1,
|
||||
filters: [{ value: { name: "iron-plate", type: "item" }, min: 3 }],
|
||||
}],
|
||||
},
|
||||
quick_bar: {
|
||||
1: "iron-plate",
|
||||
@@ -118,6 +123,9 @@ describe("player_sync plugin", function() {
|
||||
["character", { inventories: { main: { i: [{ s: 0 }] } } }],
|
||||
["shortcuts", { "toggle-personal-roboport": "yes" }],
|
||||
["character", { character_health_bonus: "100" }],
|
||||
["character", { character_inventory_slots_bonus: -1 }],
|
||||
["character", { character_crafting_speed_modifier: -5 }],
|
||||
["quick_bar", { 1: { t: "f", n: "iron-plate", q: "normal", c: "~" } }],
|
||||
["crafting_queue", {}],
|
||||
["crafting_queue", { crafting_queue: [], crafting_queue_progress: 0 }],
|
||||
["crafting_queue", {
|
||||
@@ -129,6 +137,11 @@ describe("player_sync plugin", function() {
|
||||
["personal_logistic_slots", { enabled: true, sections: [] }],
|
||||
["personal_logistic_slots", { enabled: true, trash_not_requested: false, sections: [{}] }],
|
||||
["personal_logistic_slots", { 1: { min: 50 } }],
|
||||
["personal_logistic_slots", {
|
||||
enabled: true,
|
||||
trash_not_requested: false,
|
||||
sections: [{ group: "", active: true, multiplier: 1, filters: [{ value: 5 }] }],
|
||||
}],
|
||||
]) {
|
||||
assert(!accepts({ ...exported, [field]: value }), `accepted ${field} ${JSON.stringify(value)}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user