-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathdata-final-fixes.lua
52 lines (42 loc) · 1.65 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
local updatedGrids = {}
local function addFarlCategory(equipmentGridName)
local equipmentGrid = data.raw["equipment-grid"][equipmentGridName]
if equipmentGrid and equipmentGrid.equipment_categories and not updatedGrids[equipmentGrid.name] then
local found = false
for _, category in pairs(equipmentGrid.equipment_categories) do
if category == "farl-equipment" then
found = true
break
end
end
if not found then
table.insert(equipmentGrid.equipment_categories, "farl-equipment")
updatedGrids[equipmentGrid.name] = true
end
end
end
--add grid to farl if one is present and FARL doesn't already have one
if data.raw["locomotive"]["locomotive"].equipment_grid and not data.raw["locomotive"]["farl"].equipment_grid then
data.raw["locomotive"]["farl"].equipment_grid = data.raw["locomotive"]["locomotive"].equipment_grid
end
if settings.startup["farl_enable_module"].value then
for locoName, loco in pairs(data.raw.locomotive) do
if locoName ~= "farl" then
if not loco.equipment_grid then
loco.equipment_grid = "farl-equipment-grid"
else
addFarlCategory(loco.equipment_grid)
end
end
--log("Loco: " .. locoName .. " " .. serpent.line(loco.equipment_grid, {comment=false}))
end
end
--[[
for wagonName, wagon in pairs(data.raw["cargo-wagon"]) do
if not wagon.equipment_grid then
wagon.equipment_grid = "farl-equipment-grid-wagon"
else
addFarlCategory(wagon.equipment_grid)
end
end
]]--