forked from danielmartin0/PlanetsLib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-final-fixes.lua
More file actions
32 lines (29 loc) · 1.01 KB
/
data-final-fixes.lua
File metadata and controls
32 lines (29 loc) · 1.01 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
require("prototypes.override-final.starmap")
for _, p in pairs(data.raw.planet) do
if p.sprite_only then
data.raw.planet[p.name] = nil
end
end
for _, p in pairs(data.raw["space-location"]) do
if p.sprite_only then
data.raw["space-location"][p.name] = nil
end
end
local gas_list = { "oxygen", "nitrogen", "carbon-dioxide", "argon" }
local enforce_percentage = settings.startup["PlanetsLib-enforce-gas-percentage"].value --Whether code should assert that combined gas contents add up to less than 100%.
for _, p in pairs(data.raw.planet) do
if p.surface_properties and enforce_percentage then
local gas_content = 0
for _, gas in pairs(gas_list) do
if p.surface_properties[gas] then
gas_content = gas_content + p.surface_properties[gas]
end
end
assert(
gas_content <= 100,
"Combined gas contents of planet "
.. p.name
.. ' exceed 100%. To override this assertion, add \'data.raw["bool-setting"]["PlanetsLib-enforce-gas-percentage"].forced_value = false\' to data-updates.lua.'
)
end
end