forked from pyanodon/pypostprocessing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol.lua
53 lines (48 loc) · 1.58 KB
/
control.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
script.on_configuration_changed(function()
game.reload_script()
for _, force in pairs(game.forces) do
force.reset_recipes()
force.reset_technologies()
force.reset_technology_effects()
end
if remote.interfaces['pywiki_turd_page'] then
for _, force in pairs(game.forces) do remote.call('pywiki_turd_page', 'reapply_turd_bonuses', force) end
end
end)
-- We risk more problems than solutions if we expand further
-- This will need changes if TURD works off locking techs!
local checked_mods = {
base = true,
pyalienlife = true,
pyalternativeenergy = true,
pycoalprocessing = true,
pyfusionenergy = true,
pyhightech = true,
pyindustry = true,
pypetroleumhandling = true,
pypostprocessing = true,
pyrawores = true
}
commands.add_command('check-technology-consistency', {'command-help.check-technology-consistency'}, function()
local prototypes = {}
-- Build a list of base-game techs
for name, prototype in pairs(game.technology_prototypes) do
local history = script.get_prototype_history('technology', name)
if checked_mods[history.created] then
prototypes[name] = prototype
end
end
-- Iterate and verify
for _, force in pairs(game.forces) do
local force_techs = force.technologies
for name, prototype in pairs(prototypes) do
local tech = force_techs[name]
if tech.enabled ~= prototype.enabled then
tech.enabled = prototype.enabled
local localised_name = tech.localised_name or ('technology-name.' .. name)
game.print({'command-output.fixed-technology', localised_name})
end
end
end
game.print({'command-output.consistency-check-complete'})
end)