forked from kingarthur91/PyCoalTBaA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-final-fixes.lua
More file actions
348 lines (287 loc) · 12.8 KB
/
data-final-fixes.lua
File metadata and controls
348 lines (287 loc) · 12.8 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
--Angels Mods
require('prototypes/angels-mods/Data-Final-Fixes')
--Bob Mods
require('prototypes/bobs-mods/Data-Final-Fixes')
require('prototypes/aai-industries/Data-Final-Fixes')
--require("prototypes/bio-industries/Data-Final-Fixes")
--require("prototypes/dl-stacking/Data-Final-Fixes")
--require("prototypes/kaoextended/Data-Final-Fixes")
--require("prototypes/madclowns-mods/Data-Final-Fixes")
--require("prototypes/mining-space-industries/Data-Final-Fixes")
require('prototypes/omni-mods/Data-Final-Fixes')
--require("prototypes/space-exploration/Data-Final-Fixes")
require("prototypes/industrialrevolution-WIP/Data-Final-Fixes")
require('updates/acid-changes')
require('updates/pyproductivityadjuster')
if mods['Advanced-Solar'] then
data.raw.technology['electric-energy-accumulators-2'].prerequisites = {'electric-energy-accumulators'}
end
if mods['BlackMarket'] then
data.raw.technology['black-market-energy'].prerequisites = {'black-market-item', 'electric-energy-accumulators'}
end
--attempt to fix bob steel tech issue
for t, tech in pairs(data.raw.technology) do
if tech.prerequisites ~= nil then
for p, preq in pairs(tech.prerequisites) do
if data.raw.technology[preq] ~= nil and data.raw.technology[preq].hidden ~= nil then
if data.raw.technology[preq].hidden == true then
table.remove(tech.prerequisites, p)
end
end
end
end
end
--log(serpent.block(data.raw.recipe['advanced-circuit']))
--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] 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] 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] 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
--omni icon issue fixer
if mods['omnilib'] then
for _, recipe in pairs(data.raw.recipe) do
--log(serpent.block(recipe))
if recipe.icon_size ~= nil and recipe.icon == nil then
if data.raw.item[recipe.name] ~= nil then
data.raw.recipe[recipe.name].icon = data.raw.item[recipe.name].icon
end
if data.raw.gun[recipe.name] ~= nil then
data.raw.recipe[recipe.name].icon = data.raw.gun[recipe.name].icon
end
if data.raw.ammo[recipe.name] ~= nil then
if data.raw.ammo[recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw.ammo[recipe.name].icon
else
data.raw.recipe[recipe.name].icons = data.raw.ammo[recipe.name].icons
end
end
if data.raw.armor[recipe.name] ~= nil then
if data.raw.armor[recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw.armor[recipe.name].icon
else
data.raw.recipe[recipe.name].icons = data.raw.armor[recipe.name].icons
end
end
if data.raw['repair-tool'][recipe.name] ~= nil then
if data.raw['repair-tool'][recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw['repair-tool'][recipe.name].icon
else
data.raw.recipe[recipe.name].icons = data.raw['repair-tool'][recipe.name].icons
end
end
if data.raw.car[recipe.name] ~= nil then
if data.raw.car[recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw.car[recipe.name].icon
else
data.raw.recipe[recipe.name].icons = data.raw.car[recipe.name].icons
end
end
if data.raw.capsule[recipe.name] ~= nil then
if data.raw.capsule[recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw.capsule[recipe.name].icon
else
data.raw.recipe[recipe.name].icons = data.raw.capsule[recipe.name].icons
end
end
if data.raw.module[recipe.name] ~= nil then
if data.raw.module[recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw.module[recipe.name].icon
else
data.raw.recipe[recipe.name].icons = data.raw.module[recipe.name].icons
end
end
if data.raw['rail-planner'][recipe.name] ~= nil then
if data.raw['rail-planner'][recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw['rail-planner'][recipe.name].icon
else
data.raw.recipe[recipe.name].icons = data.raw['rail-planner'][recipe.name].icons
end
end
if data.raw['item-with-entity-data'][recipe.name] ~= nil then
if data.raw['item-with-entity-data'][recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw['item-with-entity-data'][recipe.name].icon
else
data.raw.recipe[recipe.name].icons = data.raw['item-with-entity-data'][recipe.name].icons
end
end
if data.raw.tool[recipe.name] ~= nil then
if data.raw.tool[recipe.name].icon ~= nil then
data.raw.recipe[recipe.name].icon = data.raw.tool[recipe.name].icon
else
data.raw.recipe[recipe.name].icon = data.raw.tool[recipe.name].icons[1].icon
end
end
if string.find(recipe.name, '-combine') ~= nil then
--log(recipe.name)
local rn = string.gsub(recipe.name, '-combine', '')
--log(rn)
data.raw.recipe[recipe.name].icon = data.raw.module[rn].icon
end
if recipe.name == 'ammo-initial' then
data.raw.recipe['ammo-initial'].main_product = data.raw.recipe['ammo-initial'].results[1].name
end
if recipe.name == 'copper-nickel-firearm-magazine' then
data.raw.recipe['copper-nickel-firearm-magazine'].main_product = 'firearm-magazine'
end
if recipe.name == 'nickel-piercing-rounds-magazine' then
data.raw.recipe['nickel-piercing-rounds-magazine'].main_product = 'firearm-magazine'
end
if recipe.name == 'flamethrower-ammo-fueled_fluid' then
data.raw.recipe['flamethrower-ammo-fueled_fluid'].main_product = "flamethrower-ammo"
end
if recipe.icon == nil then
if recipe.results ~= nil then
recipe.main_product = recipe.results[1].name
elseif recipe.normal ~= nil then
if recipe.normal.results ~= nil then
recipe.main_product = recipe.normal.results[1].name
end
elseif recipe.expensive ~= nil then
if recipe.expensive.results ~= nil then
recipe.main_product = recipe.expensive.results[1].name
end
end
end
end
--log(serpent.block(recipe))
end
--removes missing items from recipe results that dont exist
for _, recipe in pairs(data.raw.recipe) do
if recipe.results ~= nil then
for r, result in pairs(recipe.results) do
if result.name ~= nil then
if data.raw.item[result.name] == nil and data.raw.fluid[result.name] == nil and data.raw['selection-tool'][result.name] == nil and data.raw.tool[result.name] == nil and data.raw.ammo[result.name] == nil then
log(serpent.block(recipe))
data.raw.recipe[recipe.name].results[r] = nil
end
end
end
end
if recipe.normal ~= nil then
if recipe.normal.results ~= nil then
for r, result in pairs(recipe.normal.results) do
if result.name ~= nil then
if data.raw.item[result.name] == nil and data.raw.fluid[result.name] == nil and data.raw['selection-tool'][result.name] == nil and data.raw.tool[result.name] == nil and data.raw.ammo[recipe.name] == nil then
data.raw.recipe[recipe.name].normal.results[r] = nil
end
end
end
end
end
if recipe.expensive ~= nil then
if recipe.expensive.results ~= nil then
for r, result in pairs(recipe.expensive.results) do
if result.name ~= nil then
if data.raw.item[result.name] == nil and data.raw.fluid[result.name] == nil and data.raw['selection-tool'][result.name] == nil and data.raw.tool[result.name] == nil and data.raw.ammo[recipe.name] == nil then
data.raw.recipe[recipe.name].expensive.results[r] = nil
end
end
end
end
end
end
--table.insert(data.raw.recipe['zone-planner'].results, {type="item", name="zone-planner", amount=1})
--table.insert(data.raw.recipe["iron-oxide"].results, {type="item", name="iron-plate", amount=10})
if data.raw.recipe["botanical-nursery"] ~= nil then
data.raw.recipe['botanical-nursery'].enabled = true
end
end
--log(serpent.block(data.raw.recipe['gun-nano-emitter']))
if data.raw.recipe['gun-nano-emitter'] ~= nil and data.raw.recipe['gun-nano-emitter'].normal ~= nil and data.raw.recipe['gun-nano-emitter'].normal.results ~= nil then
data.raw.recipe['gun-nano-emitter'].normal.results = {{type = 'item', name = 'gun-nano-emitter', amount =1}}
end
if data.raw.recipe['gun-nano-emitter'] ~= nil and data.raw.recipe['gun-nano-emitter'].expensive ~= nil and data.raw.recipe['gun-nano-emitter'].expensive.results ~= nil then
data.raw.recipe['gun-nano-emitter'].expensive.results = {{type = 'item', name = 'gun-nano-emitter', amount =1}}
end
if data.raw.recipe['rail'] ~= nil and data.raw.recipe['rail'].normal ~= nil and data.raw.recipe['rail'].normal.results ~= nil then
data.raw.recipe['rail'].normal.results = {{type = 'item', name = 'rail', amount =1}}
end
if data.raw.recipe['rail'] ~= nil and data.raw.recipe['rail'].expensive ~= nil and data.raw.recipe['rail'].expensive.results ~= nil then
data.raw.recipe['rail'].expensive.results = {{type = 'item', name = 'rail', amount =1}}
end
--log(serpent.block(data.raw.recipe['rail']))
--log(serpent.block(data.raw.item['solid-sand']))
fun.global_item_replacer("sand", "solid-sand")
fun.results_replacer('soil-washing','sand','solid-sand')
--log(serpent.block(data.raw.recipe['soil-washing']))