Skip to content

Commit

Permalink
Agriculture Modules Arch666Angel#706
Browse files Browse the repository at this point in the history
  • Loading branch information
KiwiHawk committed Oct 16, 2021
1 parent 891a7bb commit 6e026b6
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 187 deletions.
187 changes: 0 additions & 187 deletions angelsbioprocessing/control.lua

This file was deleted.

3 changes: 3 additions & 0 deletions angelsbioprocessing/data-updates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ require("prototypes.bio-processing-override")
require("prototypes.bio-processing-generate")
require("prototypes.tips-and-tricks.tips-and-tricks")

-- AGRICULTURE MODULES
require("prototypes.overrides.bio-processing-override-agriculture-modules")

-- hoggers are not implemented, hide them in the meantime
angelsmods.functions.add_flag("bio-hogger-1", "hidden")
angelsmods.functions.add_flag("bio-hogger-2", "hidden")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
-- Disallow pollution modules from miners, labs, and furnaces
-- This will prevent agriculture modules being used where they shouldn't
--
-- Beacons will generally not be affected here as don't normally allow productivity
-- If productivity in beacons has been enabled, then beacons will not accept pollution modules
local categories = {"mining-drill", "lab", "furnace", "beacon"}

for _, category_name in pairs(categories) do
local category = data.raw[category_name]
if category then
for entity_name, entity in pairs(category) do
if entity.allowed_effects == nil then
entity.allowed_effects = {"speed", "productivity", "consumption"}
elseif type(entity.allowed_effects) == "table" then
-- If effects includes pollution and productivity
-- then remove pollution
local allowPollution = false
local allowProductivity = false
for _, effect_name in pairs(entity.allowed_effects) do
if effect_name == "pollution" then
allowPollution = true
elseif effect_name == "productivity" then
allowProductivity = true
end
end
if allowProductivity and allowPollution then
for i = #entity.allowed_effects, 1, -1 do
if entity.allowed_effects[i] == "pollution" then
table.remove(entity.allowed_effects, i)
end
end
end
end
end
end
end

local modules = {
"productivity-module",
"productivity-module-2",
"productivity-module-3",
"productivity-module-4",
"productivity-module-5",
"productivity-module-6",
"productivity-module-7",
"productivity-module-8",
"god-module-1",
"god-module-2",
"god-module-3",
"god-module-4",
"god-module-5"
}

for _, module_name in pairs(modules) do
local module = data.raw["module"][module_name]
if module then
module.effect.pollution = nil
end
end

0 comments on commit 6e026b6

Please sign in to comment.