-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmigrations-on-update.lua
More file actions
44 lines (44 loc) · 2.16 KB
/
migrations-on-update.lua
File metadata and controls
44 lines (44 loc) · 2.16 KB
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
return {
["1.1.8"] = function()
function old_richness_formula(level)
return (math.log(level + 1) / math.log(2)) + 0.1
end
for _, s in pairs(game.surfaces) do
local mgs = s.map_gen_settings
for control_name, data in pairs(mgs.autoplace_controls or {}) do
if prototypes.autoplace_control[control_name].category == "resource" and data.richness then
mgs.autoplace_controls[control_name].richness = data.richness / old_richness_formula(get_subsurface_depth(s))
end
end
mgs.property_expression_names["subsurface_level"] = get_subsurface_depth(s)
s.map_gen_settings = mgs
end
end,
["1.1.11"] = function()
game.print("Subsurface 1.1.11 split the setting 'Disable challenges' into 'Enable resource generation' and 'Enable challenges'. If you had resources and challenges disabled in the previous version, please check your settings!", {sound = defines.print_sound.always, color = {1, 1, 0}})
end,
["1.1.12"] = function(config)
if config.mod_changes["Subsurface"].old_version ~= "1.1.11" then
settings.global["enable-challenges"] = {value = not settings.global["generate-resources-underground"].value}
settings.global["generate-resources-underground"] = {value = not settings.global["generate-resources-underground"].value}
end
end,
["1.1.20"] = function()
for u, e in pairs(storage.pole_links) do
if e.valid then
storage.tunnel_links[u] = e
local opposite = storage.pole_links[e.unit_number]
e.get_wire_connector(defines.wire_connector_id.pole_copper, true).connect_to(opposite.get_wire_connector(defines.wire_connector_id.pole_copper, true), false, defines.wire_origin.script)
e.get_wire_connector(defines.wire_connector_id.circuit_red, true).connect_to(opposite.get_wire_connector(defines.wire_connector_id.circuit_red, true), false, defines.wire_origin.script)
e.get_wire_connector(defines.wire_connector_id.circuit_green, true).connect_to(opposite.get_wire_connector(defines.wire_connector_id.circuit_green, true), false, defines.wire_origin.script)
end
end
for u, e in pairs(storage.car_links) do
if e.valid then
storage.tunnel_links[u] = e
end
end
storage.pole_links = nil
storage.car_links = nil
end
}