Skip to content

Commit

Permalink
fix: Fix maraxsis crafting categories not applying to certain modded …
Browse files Browse the repository at this point in the history
…entities. Resolves #184
  • Loading branch information
notnotmelon committed Dec 25, 2024
1 parent cf44ba2 commit 68d5bfa
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
27 changes: 27 additions & 0 deletions data-final-fixes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,30 @@ for entity_type in pairs(defines.prototypes.entity) do
::continue::
end
end

-- add maraxsis crafting categories to existing crafting machines
local function add_crafting_category_if_other_category_exists(category_to_find, category_to_add)
for _, assembling_machine_type in pairs {
"assembling-machine",
"rocket-silo",
"furnace",
"character",
} do
for _, assembling_machine in pairs(data.raw[assembling_machine_type] or {}) do
for _, category in pairs(assembling_machine.crafting_categories or {}) do
if category == category_to_find then
table.insert(assembling_machine.crafting_categories, category_to_add)
break
end
end
end
end
end

add_crafting_category_if_other_category_exists("chemistry", "maraxsis-hydro-plant-or-chemistry")
add_crafting_category_if_other_category_exists("smelting", "maraxsis-smelting-or-biochamber")
add_crafting_category_if_other_category_exists("metallurgy", "maraxsis-hydro-plant-or-foundry")
add_crafting_category_if_other_category_exists("organic", "maraxsis-smelting-or-biochamber")
add_crafting_category_if_other_category_exists("organic", "maraxsis-hydro-plant-or-biochamber")
add_crafting_category_if_other_category_exists("crafting", "maraxsis-hydro-plant-or-assembling")
add_crafting_category_if_other_category_exists("advanced-crafting", "maraxsis-hydro-plant-or-advanced-crafting")
20 changes: 0 additions & 20 deletions prototypes/vanilla-changes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@ add_hydraulic_pack("promethium-science-pack", false)
table.insert(data.raw["technology"]["promethium-science-pack"].prerequisites, "maraxsis-deepsea-research")
add_hydraulic_pack("research-productivity", false)

for _, machine_type in pairs {"assembling-machine", "rocket-silo", "furnace", "character"} do
for _, machine in pairs(data.raw[machine_type] or {}) do
if machine.crafting_categories then
for _, category in pairs(machine.crafting_categories) do
if category == "crafting" then
table.insert(machine.crafting_categories, "maraxsis-hydro-plant-or-assembling")
elseif category == "advanced-crafting" then
table.insert(machine.crafting_categories, "maraxsis-hydro-plant-or-advanced-crafting")
end
end
end
end
end

data.raw.recipe["thruster"].category = "maraxsis-hydro-plant-or-assembling"
data.raw.recipe["pumpjack"].category = "maraxsis-hydro-plant-or-assembling"
data.raw.recipe["chemical-plant"].category = "maraxsis-hydro-plant-or-assembling"
Expand Down Expand Up @@ -75,12 +61,6 @@ table.insert(data.raw.recipe["rocket-part"].surface_conditions, {
max = 50000,
})

table.insert(data.raw.furnace["electric-furnace"].crafting_categories, "maraxsis-smelting-or-biochamber")
table.insert(data.raw["assembling-machine"]["biochamber"].crafting_categories, "maraxsis-smelting-or-biochamber")
table.insert(data.raw["assembling-machine"]["biochamber"].crafting_categories, "maraxsis-hydro-plant-or-biochamber")
table.insert(data.raw["assembling-machine"]["chemical-plant"].crafting_categories, "maraxsis-hydro-plant-or-chemistry")
table.insert(data.raw["assembling-machine"]["foundry"].crafting_categories, "maraxsis-hydro-plant-or-foundry")

if data.raw.technology["rocket-part-productivity"] then
table.insert(data.raw.technology["rocket-part-productivity"].effects, {
type = "change-recipe-productivity",
Expand Down

0 comments on commit 68d5bfa

Please sign in to comment.