forked from raiguard/Krastorio2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata-final-fixes.lua
167 lines (155 loc) · 6.9 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
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
local table = require("__flib__.table")
---------------------------------------------------------------------------
-- -- -- PRE FINAL FIXES
---------------------------------------------------------------------------
krastorio.stage = "data-final-fixes"
---------------------------------------------------------------------------
-- Apply module limitations
for recipe_name, recipe in pairs(data.raw.recipe) do
if recipe.mod == "Krastorio2" then
if recipe.allow_efficiency == true then
krastorio.modules.addEfficiencyLimitation(recipe_name, true)
elseif recipe.allow_speed == true then
krastorio.modules.addSpeedLimitation(recipe_name, true)
elseif recipe.allow_productivity == true then
krastorio.modules.addProductivityLimitation(recipe_name, true)
elseif recipe.allow_pollution_reduction == true then
krastorio.modules.addLessPollutionLimitation(recipe_name, true)
end
end
end
---------------------------------------------------------------------------
-- -- -- SCIENCE PACK SANITIZING
-- -- Krastorio 2 science pack collection
krastorio.technologies.addSciencePackCollection("Krastorio2", {
"basic-tech-card",
"automation-science-pack",
"logistic-science-pack",
"military-science-pack",
"chemical-science-pack",
"production-science-pack",
"utility-science-pack",
"matter-tech-card",
krastorio.optimization_tech_card_name,
"advanced-tech-card",
"singularity-tech-card",
})
-- sanitize Krastorio Technologies with other mods
-- krastorio.technologies.sanitizeUnitsOfAllTechnologiesInPacks("Krastorio2", false)
-- -- Sanitize T2 only (in bottom up on tree for correct result)
local science_pack_incompatibilities = {
"basic-tech-card",
"automation-science-pack",
"logistic-science-pack",
"military-science-pack",
"chemical-science-pack",
}
-- Sanitize matter tech card from T1 packs
krastorio.technologies.removeSciencePackIncompatibleWith("matter-tech-card", science_pack_incompatibilities)
-- Sanitize space science pack from T1 packs
krastorio.technologies.removeSciencePackIncompatibleWith(
krastorio.optimization_tech_card_name,
science_pack_incompatibilities
)
-- Sanitize advanced tech card from T1 packs
krastorio.technologies.removeSciencePackIncompatibleWith("advanced-tech-card", science_pack_incompatibilities)
-- Sanitize singularity tech card from T1 packs
krastorio.technologies.removeSciencePackIncompatibleWith("singularity-tech-card", science_pack_incompatibilities)
-- -- Sanitize T1 only (in bottom up on tree for correct result)
science_pack_incompatibilities = {
"basic-tech-card",
}
-- Sanitize production science pack from T0 packs
krastorio.technologies.removeSciencePackIncompatibleWith("production-science-pack", science_pack_incompatibilities)
-- Sanitize utility science pack from T0 packs
krastorio.technologies.removeSciencePackIncompatibleWith("utility-science-pack", science_pack_incompatibilities)
-- -- -- ENFORCE SCIENCE PACK PREREQUISITE COHERENCE
krastorio.technologies.enforceUsedSciencePacksInPrerequisites()
---------------------------------------------------------------------------
-- OPTION FIXES
---------------------------------------------------------------------------
-- Apply the choosen science pack recipes
require(kr_prototypes_path .. "vanilla-changes/optional/modify-science-packs-recipes")
-- Apply fixes if in peaceful mode
require(kr_prototypes_path .. "vanilla-changes/optional/peaceful-mode")
-- Final fuels fixes
require(kr_prototypes_path .. "vanilla-changes/optional/rebalance-vehicles&fuels-final-fixes")
-- Change the background with the selected one
require(kr_prototypes_path .. "vanilla-changes/optional/change-background")
-- Increase the difficult of hardmode
require(kr_prototypes_path .. "vanilla-changes/optional/impossible-more-than-difficult")
---------------------------------------------------------------------------
-- -- -- COMPATIBILITY INITIALIZATION (data final fixes stage)
---------------------------------------------------------------------------
local scripts_path = "compatibility-scripts/data-final-fixes/"
-- Angels (multiple scripts)
require(scripts_path .. "angels")
require(scripts_path .. "aai-industry")
require(scripts_path .. "aircraft")
require(scripts_path .. "nco-SpaceShuttle")
require(scripts_path .. "AsphaltRoads")
-- Bobs (multiple scripts)
require(scripts_path .. "bobs_mod")
require(scripts_path .. "Clockwork")
require(scripts_path .. "Dectorio")
require(scripts_path .. "DeadlockLargerLamp")
require(scripts_path .. "deadlock-beltboxes-loaders")
require(scripts_path .. "ElectricTrain")
require(scripts_path .. "FoodIndustry")
require(scripts_path .. "Hovercrafts")
require(scripts_path .. "IndustrialRevolution")
require(scripts_path .. "LightedPolesPlus")
require(scripts_path .. "Nuclear Fuel")
-- Pyanodons (multiple scripts)
require(scripts_path .. "Pyanodon")
require(scripts_path .. "realistic-electric-trains")
require(scripts_path .. "Tral-robot-tree-farm")
require(scripts_path .. "vtk-armor-plating")
require(scripts_path .. "RealisticReactors")
-- Other
require(scripts_path .. "spidertron-tiers")
---------------------------------------------------------------------------
-- -- -- POST ALL FIXES
---------------------------------------------------------------------------
-- Add new fuels to entities
krastorio.entities.addFuelCategory("assembling-machine", "stone-furnace", "vehicle-fuel")
krastorio.entities.addFuelCategory("assembling-machine", "steel-furnace", "vehicle-fuel")
krastorio.entities.addFuelCategory("boiler", "boiler", "vehicle-fuel")
krastorio.entities.addFuelCategory("inserter", "burner-inserter", "vehicle-fuel")
krastorio.entities.addFuelCategory("mining-drill", "burner-mining-drill", "vehicle-fuel")
-- Make characters be targeted by the teleporter turrets
for _, character in pairs(data.raw["character"]) do
local mask = character.trigger_target_mask or { "common", "ground-unit" }
character.trigger_target_mask = mask
-- FIXME: Use a proper name
table.insert(mask, "character")
end
-- Make anything with an equipment grid of the correct category be targetable by tesla coils
local types_have_grid = {
"artillery-wagon",
"car",
"cargo-wagon",
"character",
"fluid-wagon",
"locomotive",
"spider-vehicle",
}
local grids = data.raw["equipment-grid"]
for _, type in pairs(types_have_grid) do
for _, prototype in pairs(data.raw[type]) do
if type ~= "character" then
local grid = grids[prototype.equipment_grid]
if not grid or not table.find(grid.equipment_categories, "universal-equipment") then
goto continue
end
end
local mask = prototype.trigger_target_mask or { "common", "ground-unit" }
prototype.trigger_target_mask = mask
-- The tesla coil turrets will only target entities with this mask
table.insert(mask, "kr-tesla-coil-trigger")
-- If the entity is not considered a "military target", then the tesla coil turrets will not wake up when the entity
-- gets within range
prototype.is_military_target = true
::continue::
end
end