-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmigrations.lua
73 lines (68 loc) · 2.35 KB
/
migrations.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
local flib_migration = require("__flib__.migration")
local infinity_accumulator = require("scripts.infinity-accumulator")
local infinity_loader = require("scripts.infinity-loader")
local inventory_filters = require("scripts.inventory-filters")
local inventory_sync = require("scripts.inventory-sync")
local linked_belt = require("scripts.linked-belt")
local version_migrations = {
["2.0.0"] = function()
-- Preserve testing lab state
local testing_lab_state = {}
for player_index, player_table in pairs(storage.players) do
local player = game.get_player(player_index)
if player and player_table.lab_state and player_table.normal_state then
testing_lab_state[player_index] = {
normal = player_table.normal_state,
lab = player_table.lab_state,
player = player,
refresh = false,
}
end
end
-- NUKE EVERYTHING
storage = { testing_lab_state = testing_lab_state, wagons = storage.wagons }
rendering.clear("EditorExtensions")
for _, player in pairs(game.players) do
for _, gui in pairs({ player.gui.top, player.gui.left, player.gui.center, player.gui.screen, player.gui.relative }) do
for _, child in pairs(gui.children) do
if child.get_mod() == "EditorExtensions" then
child.destroy()
end
end
end
end
-- Start over
infinity_accumulator.on_init()
infinity_loader.on_init()
inventory_filters.on_init()
inventory_sync.on_init()
linked_belt.on_init()
end,
["2.3.0"] = function()
storage.aggregate_filters = nil
storage.infinity_pipe_amount_type = nil
for _, gui in pairs(storage.infinity_pipe_gui or {}) do
local window = gui.elems.ee_infinity_pipe_window
if window and window.valid then
window.destroy()
end
end
storage.infinity_pipe_gui = nil
end,
["2.3.1"] = function()
for surface_name, surface in pairs(game.surfaces) do
if string.find(surface_name, "EE_TESTSURFACE_") then
for force_name, force in pairs(game.forces) do
if not string.find(force_name, "EE_TESTFORCE_") then
force.set_surface_hidden(surface, true)
end
end
end
end
end,
}
local migrations = {}
migrations.on_configuration_changed = function(e)
flib_migration.on_config_changed(e, version_migrations)
end
return migrations