forked from cacklingfiend/lignumis
		
	Add mod support for science packs and custom labs
And fix Cerys incompatibility
This commit is contained in:
		
							parent
							
								
									2596434131
								
							
						
					
					
						commit
						ec8fe81d3e
					
				
					 4 changed files with 90 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -1,10 +1,27 @@
 | 
			
		|||
Lignumis = {
 | 
			
		||||
    -- A technology having any of these science packs as ingredient will get wood and steam science packs added
 | 
			
		||||
    science_pack_whitelist = { "utility-science-pack", "production-science-pack", "space-science-pack" },
 | 
			
		||||
 | 
			
		||||
    -- A technology is skipped if it has any of these as ingredient
 | 
			
		||||
    science_pack_blacklist = {
 | 
			
		||||
        "wood-science-pack", "steam-science-pack", -- Lignumis
 | 
			
		||||
        "nanite-science-pack", "quantum-science-pack", "ring-science-pack", -- Metal and Stars
 | 
			
		||||
        "cerys-science-pack" -- Cerys
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    -- These technologies are skipped even if they are matches according to above lists
 | 
			
		||||
    science_blacklist = {
 | 
			
		||||
        "deep-miner",
 | 
			
		||||
        "logistic-system",
 | 
			
		||||
        "space-platform-thruster",
 | 
			
		||||
        "kovarex-enrichment-process",
 | 
			
		||||
        "astroponics"
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    -- Add wood and steam science packs to all labs' inputs except these
 | 
			
		||||
    lab_blacklist = {
 | 
			
		||||
        "wood-lab", -- Lignumis
 | 
			
		||||
        "cerys-lab" -- Cerys
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -12,4 +29,4 @@ require("__cf-lib__/util")
 | 
			
		|||
 | 
			
		||||
require("prototypes/content/data")
 | 
			
		||||
require("prototypes/integrations/data")
 | 
			
		||||
require("prototypes/compatibility/data")
 | 
			
		||||
require("prototypes/compatibility/data")
 | 
			
		||||
| 
						 | 
				
			
			@ -1,14 +1,12 @@
 | 
			
		|||
-- Add wood and steam science packs as ingredients to technologies that require Nauvis science packs.
 | 
			
		||||
-- It skips technologies that are available before coming back to Lignumis.
 | 
			
		||||
 | 
			
		||||
for _, technology in pairs(data.raw.technology) do
 | 
			
		||||
    if technology.unit and technology.unit.ingredients and not table.contains(Lignumis.science_blacklist, technology.name) then
 | 
			
		||||
        local ingredients = technology.unit.ingredients
 | 
			
		||||
        local noMatches = table.filter(ingredients, function(ingredient)
 | 
			
		||||
            return table.contains({ "wood-science-pack", "steam-science-pack", "nanite-science-pack", "quantum-science-pack", "ring-science-pack" }, ingredient[1])
 | 
			
		||||
            return table.contains(Lignumis.science_pack_blacklist, ingredient[1])
 | 
			
		||||
        end)
 | 
			
		||||
        local yesMatches = table.filter(ingredients, function(ingredient)
 | 
			
		||||
            return table.contains({ "utility-science-pack", "production-science-pack", "space-science-pack" }, ingredient[1])
 | 
			
		||||
            return table.contains(Lignumis.science_pack_whitelist, ingredient[1])
 | 
			
		||||
        end)
 | 
			
		||||
        if #noMatches == 0 and #yesMatches > 0 then
 | 
			
		||||
            table.insert(technology.unit.ingredients, { "wood-science-pack", 1 })
 | 
			
		||||
| 
						 | 
				
			
			@ -16,3 +14,14 @@ for _, technology in pairs(data.raw.technology) do
 | 
			
		|||
        end
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- Add wood and steam science packs to all labs' inputs
 | 
			
		||||
for _, lab in pairs(data.raw.lab) do
 | 
			
		||||
    if lab.inputs and not table.contains(Lignumis.lab_blacklist, lab.name) then
 | 
			
		||||
        lab.inputs = table.assign({
 | 
			
		||||
            "wood-science-pack",
 | 
			
		||||
            "steam-science-pack"
 | 
			
		||||
        }, lab.inputs)
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -44,18 +44,6 @@ data.raw.recipe["burner-inserter"].ingredients = {
 | 
			
		|||
 | 
			
		||||
-- Lab
 | 
			
		||||
 | 
			
		||||
local lab = data.raw["lab"]["lab"]
 | 
			
		||||
lab.inputs = table.assign({
 | 
			
		||||
    "wood-science-pack",
 | 
			
		||||
    "steam-science-pack"
 | 
			
		||||
}, lab.inputs)
 | 
			
		||||
 | 
			
		||||
local biolab = data.raw["lab"]["biolab"]
 | 
			
		||||
biolab.inputs = table.assign({
 | 
			
		||||
    "wood-science-pack",
 | 
			
		||||
    "steam-science-pack"
 | 
			
		||||
}, biolab.inputs)
 | 
			
		||||
 | 
			
		||||
local lab_recipe = data.raw.recipe["lab"]
 | 
			
		||||
for _, ingredient in pairs(lab_recipe.ingredients) do
 | 
			
		||||
    if ingredient.name == "transport-belt" then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue