forked from kingarthur91/PyCoalTBaA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata-final-fixes.lua
93 lines (88 loc) · 3.71 KB
/
data-final-fixes.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--angel mods
require('prototypes/angels-mods/Data-Final-Fixes')
--recipe ingredients deduper
for i, ings in pairs(data.raw.recipe) do
--log(serpent.block(ings))
local inglist = {}
if ings.ingredients ~= nil then
for a, ing in pairs(ings.ingredients) do
if ing.name ~= nil then
if data.raw.item[ing.name] or data.raw.fluid[ing.name] or data.raw.module[ing.name] or data.raw.tool[ing.name] or data.raw.ammo[ing.name] then
if not inglist[ing.name] then
--log(serpent.block(ing))
--log(ing.name)
inglist[ing.name] = true
else
data.raw.recipe[ings.name].ingredients[a] = nil
end
else
data.raw.recipe[ings.name].ingredients[a] = nil
end
elseif type(ing[1]) == 'string' then
--log(serpent.block(ing))
if not inglist[ing[1]] then
inglist[ing[1]] = true
else
data.raw.recipe[ings.name].ingredients[a] = nil
end
end
end
end
if ings.normal ~= nil then
--log(serpent.block(ings))
for a, ing in pairs(ings.normal.ingredients) do
if ing.name ~= nil then
if data.raw.item[ing.name] or data.raw.fluid[ing.name] or data.raw.module[ing.name] or data.raw.tool[ing.name] or data.raw.ammo[ing.name] then
if not inglist[ing.name] then
--log(serpent.block(ing))
--log(ing.name)
inglist[ing.name] = true
else
data.raw.recipe[ings.name].normal.ingredients[a] = nil
end
else
data.raw.recipe[ings.name].normal.ingredients[a] = nil
end
elseif type(ing[1]) == 'string' then
--log(serpent.block(ing))
if not inglist[ing[1]] then
inglist[ing[1]] = true
else
data.raw.recipe[ings.name].normal.ingredients[a] = nil
end
end
end
end
--reset inglist for expensive ingredients
inglist = {}
if ings.expensive ~= nil then
--log(serpent.block(ings))
--log(serpent.block(ings.expensive))
if ings.expensive ~= false then
if ings.expensive.ingredients ~= nil then
for a, ing in pairs(ings.expensive.ingredients) do
if ing.name ~= nil then
if data.raw.item[ing.name] or data.raw.fluid[ing.name] or data.raw.module[ing.name] or data.raw.tool[ing.name] or data.raw.ammo[ing.name] then
if not inglist[ing.name] then
--log(serpent.block(ing))
--log(ing.name)
inglist[ing.name] = true
else
data.raw.recipe[ings.name].expensive.ingredients[a] = nil
end
else
data.raw.recipe[ings.name].expensive.ingredients[a] = nil
end
elseif type(ing[1]) == 'string' then
--log(serpent.block(ing))
if not inglist[ing[1]] then
inglist[ing[1]] = true
else
data.raw.recipe[ings.name].expensive.ingredients[a] = nil
end
end
end
end
end
end
end