-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdata-updates.lua
More file actions
152 lines (152 loc) · 9.26 KB
/
data-updates.lua
File metadata and controls
152 lines (152 loc) · 9.26 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
--Thanks to Arch666Angel for this snippet of code.
--Updates equipment grids to support the various bob's vehicle grids, within reason.
if settings.startup["non-combat-mode"].value == false then
if data.raw["equipment-category"]["armoured-vehicle"] then
table.insert(data.raw["equipment-grid"]["flying-fortress-equipment-grid"].equipment_categories,"vehicle")
table.insert(data.raw["equipment-grid"]["flying-fortress-equipment-grid"].equipment_categories,"armoured-vehicle")
table.insert(data.raw["equipment-grid"]["jet-equipment-grid"].equipment_categories,"vehicle")
table.insert(data.raw["equipment-grid"]["gunship-equipment-grid"].equipment_categories,"vehicle")
table.insert(data.raw["equipment-grid"]["gunship-equipment-grid"].equipment_categories,"armoured-vehicle")
end
--Updates equipment grids to support electric vehicles equipment (making them electric!)
if data.raw["equipment-category"]["electric-vehicles-equipment"] then
table.insert(data.raw["equipment-grid"]["flying-fortress-equipment-grid"].equipment_categories,"electric-vehicles-equipment")
table.insert(data.raw["equipment-grid"]["jet-equipment-grid"].equipment_categories,"electric-vehicles-equipment")
table.insert(data.raw["equipment-grid"]["gunship-equipment-grid"].equipment_categories,"electric-vehicles-equipment")
end
--Thanks to Articulating for this one :)
--Updates Gunship, Jet, and Flying Fortress recipes to use Rifles instead of Submachine Guns.
if data.raw["recipe"]["rifle"] then
for i, ingredient in pairs(data.raw["recipe"]["gunship"]["normal"].ingredients) do
if ingredient.name == "submachine-gun" or ingredient[1] == "submachine-gun" then
table.remove(data.raw["recipe"]["gunship"]["normal"].ingredients, i)
end
end
for i, ingredient in pairs(data.raw["recipe"]["gunship"]["expensive"].ingredients) do
if ingredient.name == "submachine-gun" or ingredient[1] == "submachine-gun" then
table.remove(data.raw["recipe"]["gunship"]["expensive"].ingredients, i)
end
end
table.insert(data.raw["recipe"]["gunship"]["normal"].ingredients, {"rifle", 5})
table.insert(data.raw["recipe"]["gunship"]["expensive"].ingredients, {"rifle", 10})
for i, ingredient in pairs(data.raw["recipe"]["jet"]["normal"].ingredients) do
if ingredient.name == "submachine-gun" or ingredient[1] == "submachine-gun" then
table.remove(data.raw["recipe"]["jet"]["normal"].ingredients, i)
end
end
for i, ingredient in pairs(data.raw["recipe"]["jet"]["expensive"].ingredients) do
if ingredient.name == "submachine-gun" or ingredient[1] == "submachine-gun" then
table.remove(data.raw["recipe"]["jet"]["expensive"].ingredients, i)
end
end
table.insert(data.raw["recipe"]["jet"]["normal"].ingredients, {"rifle", 3})
table.insert(data.raw["recipe"]["jet"]["expensive"].ingredients, {"rifle", 6})
for i, ingredient in pairs(data.raw["recipe"]["flying-fortress"]["normal"].ingredients) do
if ingredient.name == "submachine-gun" or ingredient[1] == "submachine-gun" then
table.remove(data.raw["recipe"]["flying-fortress"]["normal"].ingredients, i)
end
end
for i, ingredient in pairs(data.raw["recipe"]["flying-fortress"]["expensive"].ingredients) do
if ingredient.name == "submachine-gun" or ingredient[1] == "submachine-gun" then
table.remove(data.raw["recipe"]["flying-fortress"]["expensive"].ingredients, i)
end
end
table.insert(data.raw["recipe"]["flying-fortress"]["normal"].ingredients, {"rifle", 15})
table.insert(data.raw["recipe"]["flying-fortress"]["expensive"].ingredients, {"rifle", 30})
end
end
--Hardmode changes
if settings.startup["aircraft-hardmode"].value == true then
--Cargo Plane
table.remove(data.raw["car"]["cargo-plane"].resistances)
table.insert(data.raw["car"]["cargo-plane"].resistances, {type = "fire", decrease = 0, percent = 10})
table.insert(data.raw["car"]["cargo-plane"].resistances, {type = "physical", decrease = 0, percent = 5})
table.insert(data.raw["car"]["cargo-plane"].resistances, {type = "impact", decrease = 0, percent = 5})
table.insert(data.raw["car"]["cargo-plane"].resistances, {type = "explosion", decrease = 0, percent = 10})
table.insert(data.raw["car"]["cargo-plane"].resistances, {type = "acid", decrease = 0, percent = 5})
if settings.startup["non-combat-mode"].value == false then
--Gunship
table.remove(data.raw["car"]["gunship"].resistances)
table.insert(data.raw["car"]["gunship"].resistances, {type = "fire", decrease = 0, percent = 25})
table.insert(data.raw["car"]["gunship"].resistances, {type = "physical", decrease = 0, percent = 15})
table.insert(data.raw["car"]["gunship"].resistances, {type = "impact", decrease = 0, percent = 30})
table.insert(data.raw["car"]["gunship"].resistances, {type = "explosion", decrease = 0, percent = 15})
table.insert(data.raw["car"]["gunship"].resistances, {type = "acid", decrease = 0, percent = 10})
--Jet
table.remove(data.raw["car"]["jet"].resistances)
table.insert(data.raw["car"]["jet"].resistances, {type = "fire", decrease = 0, percent = 25})
table.insert(data.raw["car"]["jet"].resistances, {type = "physical", decrease = 0, percent = 15})
table.insert(data.raw["car"]["jet"].resistances, {type = "impact", decrease = 0, percent = 30})
table.insert(data.raw["car"]["jet"].resistances, {type = "explosion", decrease = 0, percent = 15})
table.insert(data.raw["car"]["jet"].resistances, {type = "acid", decrease = 0, percent = 10})
--Flying Fortress
table.remove(data.raw["car"]["flying-fortress"].resistances)
table.insert(data.raw["car"]["flying-fortress"].resistances, {type = "fire", decrease = 0, percent = 25})
table.insert(data.raw["car"]["flying-fortress"].resistances, {type = "physical", decrease = 0, percent = 20})
table.insert(data.raw["car"]["flying-fortress"].resistances, {type = "impact", decrease = 0, percent = 35})
table.insert(data.raw["car"]["flying-fortress"].resistances, {type = "explosion", decrease = 0, percent = 20})
table.insert(data.raw["car"]["flying-fortress"].resistances, {type = "acid", decrease = 0, percent = 15})
end
--Cheat Machine (ONLY ENABLE IF YOU HAVE ALSO ENABLED THE CHEAT MACHINE IN OTHER FILES!!!)
--[[table.remove(data.raw["car"]["cheat-machine"].resistances)
table.insert(data.raw["car"]["cheat-machine"].resistances, {type = "fire", decrease = 0, percent = 100})
table.insert(data.raw["car"]["cheat-machine"].resistances, {type = "physical", decrease = 0, percent = 100})
table.insert(data.raw["car"]["cheat-machine"].resistances, {type = "impact", decrease = 0, percent = 100})
table.insert(data.raw["car"]["cheat-machine"].resistances, {type = "explosion", decrease = 0, percent = 100})
table.insert(data.raw["car"]["cheat-machine"].resistances, {type = "acid", decrease = 0, percent = 100})
--]]
end
--Helicopters Technology change
if settings.startup["helicopter-tech"].value == true then
if data.raw["car"]["heli-entity-_-"] then
table.insert(data.raw["technology"]["heli-technology"].prerequisites, "advanced-aerodynamics")
end
end
--Raven Technology change
if settings.startup["raven-tech"].value == true then
if data.raw["car"]["raven-1"] then
table.insert(data.raw["technology"]["raven"].prerequisites, "advanced-aerodynamics")
end
end
--Helicopters Equipment change
if settings.startup["heli-equipment-grid"].value == true then
if data.raw["car"]["heli-entity-_-"] then
table.insert(data.raw["equipment-grid"]["heli-equipment-grid"].equipment_categories, "aircraft")
end
end
--Potential fix for incompatibility with Alternative Oil Processing (https://mods.factorio.com/mod/AlternativeOil)
if settings.startup["non-combat-mode"].value == false then
if data.raw["technology"]["hydrocarbons"] then
data.raw["technology"]["napalm"].prerequisites = {"flamethrower"}
end
end
--Non-combat mode
if settings.startup["non-combat-mode"].value == true then
data.raw["recipe"]["gunship"].enabled = false
data.raw["recipe"]["jet"].enabled = false
data.raw["recipe"]["flying-fortress"].enabled = false
data.raw["technology"]["napalm"].prerequisites = {"flammables"}
data.raw["technology"]["jets"].enabled = false
data.raw["technology"]["gunships"].enabled = false
data.raw["technology"]["flying-fortress"].enabled = false
end
if settings.startup["non-combat-mode"].value == false then
data.raw["recipe"]["gunship"].enabled = true
data.raw["recipe"]["jet"].enabled = true
data.raw["recipe"]["flying-fortress"].enabled = true
data.raw["technology"]["napalm"].prerequisites = {"flammables"}
data.raw["technology"]["jets"].enabled = true
data.raw["technology"]["gunships"].enabled = true
data.raw["technology"]["flying-fortress"].enabled = true
end
--Inserter Immunity
if settings.startup["inserter-immunity"].value == true then
table.insert(data.raw["car"]["gunship"].flags, "no-automated-item-removal")
table.insert(data.raw["car"]["gunship"].flags, "no-automated-item-insertion")
table.insert(data.raw["car"]["jet"].flags, "no-automated-item-removal")
table.insert(data.raw["car"]["jet"].flags, "no-automated-item-insertion")
table.insert(data.raw["car"]["cargo-plane"].flags, "no-automated-item-removal")
table.insert(data.raw["car"]["cargo-plane"].flags, "no-automated-item-insertion")
table.insert(data.raw["car"]["flying-fortress"].flags, "no-automated-item-removal")
table.insert(data.raw["car"]["flying-fortress"].flags, "no-automated-item-insertion")
end