Enhance K2SO Compatibility with Gold Research Data and Gold Tech Cards #15

Open
Jiopaba wants to merge 8 commits from Jiopaba/lignumis:master into master
3 changed files with 173 additions and 0 deletions

View file

@ -86,6 +86,8 @@ basic-circuit-board=Basic circuit board
crushed-gold-ore=Crushed gold ore
steam-science-pack-spoiled=Science flask with water
gold-module-3=Golden module
gold-research-data=Gold research data
gold-tech-card=Gold tech card
[item-description]
wooden-wall=Use wooden walls to protect your base from the locals and to reduce noise levels.
@ -93,6 +95,7 @@ stone-wall=Better acoustic and physical protection than the wooden counterpart.
gold-stromatolite-seed=Plant the seed to grow gold stromatolites. They house bacteria that enrich gold from the ground.\n__REMARK_COLOR_BEGIN__Expected yield:__REMARK_COLOR_END__ 1.5 [item=gold-ore]/m
steam-science-pack-spoiled=Spoiled steam science pack. Put it in a furnace to bring it to the right temperature.
gold-module-3=When you mastered quality assembling, this pristine module is unlocked, enabling you to craft the finest items available.
gold-tech-card=Advanced research data card based on Lignumis gold processing.
produces-noise=Produces __1__ noise/m
consumes-noise=Consumes __1__ noise/m
@ -116,6 +119,7 @@ active-noise-cancelling=Active noise cancelling
casting-gold=Casting gold
gold-ore-crushing=Gold ore crushing
processing-unit-gold=Processing unit (gold)
gold-research-data=Gold research data
burner-lamp-burning=Generating light
refresh-steam-science-pack=Refresh steam science pack
@ -123,6 +127,7 @@ refresh-steam-science-pack=Refresh steam science pack
moist-stromatolite-remnant-desiccation-without-steam=Used for balancing the production of steam.
gold-stromatolite-seed-to-peat=Used for voiding excess gold stromatolite seeds.
refresh-steam-science-pack=Heats a science flask with water to the right temperature to be used as steam science pack.
gold-research-data=Refines Lignumis gold into research data. Can only be produced on Lignumis.
electronic-circuit-iron=Inefficient alternative recipe that doesn't require wood ingredients.
[technology-name]
@ -206,6 +211,7 @@ lignumis-infinite-astroponics-productivity-research=[color=green][font=heading-2
lignumis-electric-lumber-mill=[color=green][font=heading-2]Easy[/font][/color] Electric lumber mill
lignumis-sciences-spoil=[color=red][font=heading-2]Hard[/font][/color] Lignumis science packs spoil
lignumis-basic-circuit-board=[color=gray][font=heading-2]Deprecated (please enable)[/font] Enable basic circuit board[/color]
lignumis-k2so-gold-tech-card=[color=orange][font=heading-2]Overhaul[/font][/color] [item=gold-tech-card] Replace Steam and Wood Science with Gold Tech Cards (Krastorio 2)
[mod-setting-description]
lignumis-belt-progression=Yellow belts will require wood belts to craft.
@ -223,6 +229,7 @@ lignumis-double-rocket=The provisional rocket can carry 80 instead of 40 slots.
lignumis-sciences-spoil=Both wood science packs and steam science packs spoil for additional difficulty.
lignumis-infinite-astroponics-productivity-research=Productivity research for Astroponics is infinite instead of being capped to level 5 (which results in 50% productivity).
lignumis-electric-lumber-mill=The lumber mill will consume electricity instead of burner fuel and will be unlocked after researching electricity.
lignumis-k2so-gold-tech-card=When Krastorio 2 Spaced Out is installed, late-game technologies that would require Wood and Steam Science Packs instead require Gold Tech Cards crafted from Lignumis gold. Requires progressive technologies to be enabled.
[autoplace-control-names]
lignumis_enemy_base=Lignumis enemy bases

View file

@ -2,6 +2,86 @@ local Technology = require("__cf-lib__/data/Technology")
if not mods["Krastorio2-spaced-out"] then return end
local data_util = require("__Krastorio2-spaced-out__/data-util")
data:extend({
{
type = "item",
name = "gold-research-data",
icon = Lignumis.graphics .. "icons/gold-research-data.png",
icon_size = 64,
subgroup = "science-pack",
order = "a09[gold-research-data]",
stack_size = 200,
weight = 1 * kg,
default_import_location = "lignumis"
},
{
type = "tool",
name = "gold-tech-card",
localised_description = { "item-description.science-pack" },
icon = Lignumis.graphics .. "icons/gold-tech-card.png",
icon_size = 64,
subgroup = "science-pack",
order = "b09[gold-tech-card]",
stack_size = 200,
weight = 1 * kg,
durability = 1,
durability_description_key = "description.science-pack-remaining-amount-key",
durability_description_value = "description.science-pack-remaining-amount-value",
pictures = {
layers = {
{
filename = Lignumis.graphics .. "icons/gold-tech-card.png",
size = 64,
scale = 0.5
},
{
filename = Lignumis.graphics .. "icons/gold-tech-card-light.png",
size = 64,
scale = 0.5,
draw_as_light = true
}
}
},
default_import_location = "lignumis"
}
})
data_util.make_tech_card("gold-tech-card", {
{ type = "item", name = "gold-research-data", amount = 5 }
})
data:extend({
{
type = "recipe",
name = "gold-research-data",
category = "crafting",
enabled = false,
energy_required = 20,
ingredients = {
{ type = "item", name = "gold-plate", amount = 10 },
{ type = "item", name = "gold-cable", amount = 10 }
},
results = {
{ type = "item", name = "gold-research-data", amount = 5 }
},
surface_conditions = {
{
property = "pollutant-type",
min = 3,
max = 3
}
},
allow_productivity = true,
main_product = "gold-research-data"
}
})
Technology:new("kr-advanced-lab")
:addRecipe("gold-research-data")
:addRecipe("gold-tech-card")
data.raw.recipe["burner-inserter"].ingredients = {
{ type = "item", name = "wooden-gear-wheel", amount = 1 },
{ type = "item", name = "lumber", amount = 1 }
@ -42,3 +122,77 @@ if settings.startup["kr-realistic-weapons"].value then
table.insert(pistol_attack.ammo_categories, "bullet")
data.raw.recipe["firearm-magazine"].enabled = false
end
if not (settings.startup["lignumis-technology-progression"].value and
settings.startup["lignumis-k2so-gold-tech-card"].value) then
return
end
local function upgrade_to_gold_card(tech)
if not (tech and tech.unit and tech.unit.ingredients) then return end
local new_ingredients = {}
local changed = false
for _, ing in pairs(tech.unit.ingredients) do
local name = ing[1] or ing.name
if name == "wood-science-pack" or name == "steam-science-pack" then
changed = true
else
table.insert(new_ingredients, ing)
end
end
local has_gold = false
for _, ing in pairs(new_ingredients) do
if (ing[1] or ing.name) == "gold-tech-card" then has_gold = true break end
end
if not has_gold then
table.insert(new_ingredients, {"gold-tech-card", 1})
changed = true
end
if changed then
tech.unit.ingredients = new_ingredients
tech.prerequisites = tech.prerequisites or {}
if not table.contains(tech.prerequisites, "kr-advanced-lab") then
table.insert(tech.prerequisites, "kr-advanced-lab")
end
end
end
for name, tech in pairs(data.raw.technology) do
if tech.unit and tech.unit.ingredients
and not tech.lignumis_skip_science_packs
and not table.contains(Lignumis.science_blacklist, name)
and not table.contains(Lignumis.science_pack_whitelist, name) then
local has_wood = false
local has_steam = false
local has_white = false
for _, ing in pairs(tech.unit.ingredients) do
local n = ing[1] or ing.name
if n == "wood-science-pack" then has_wood = true
elseif n == "steam-science-pack" then has_steam = true
elseif table.contains(Lignumis.science_pack_whitelist, n) then has_white = true end
end
if has_wood and has_steam and has_white then
upgrade_to_gold_card(tech)
end
end
end
-- Special Cases needing fixing
upgrade_to_gold_card(data.raw.technology["production-science-pack"])
upgrade_to_gold_card(data.raw.technology["utility-science-pack"])
-- Make sure gold tech card is in the labs, same code as in vanilla-updates.lua
for _, lab in pairs(data.raw.lab) do
if lab.inputs and not table.contains(Lignumis.lab_blacklist, lab.name) then
if not table.contains(lab.inputs, "gold-tech-card") then
table.insert(lab.inputs, "gold-tech-card")
end
end
end

View file

@ -136,6 +136,18 @@ if mods["astroponics"] then
})
end
if mods["Krastorio2-spaced-out"] then
data:extend({
{
type = "bool-setting",
name = "lignumis-k2so-gold-tech-card",
setting_type = "startup",
default_value = true,
order = "b[overhaul]-z[mods]-a"
}
})
end
if mods["aai-industry"] then
force("lignumis-inserter-progression", false)
force("lignumis-assembler-progression", false)