diff --git a/changelog.txt b/changelog.txt index b2ec8e8..2c065f9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,10 @@ --------------------------------------------------------------------------------------------------- +Version: 1.0.6 +Date: 3.4.2022 + Features: + - integrated realistic reactors into overhaul mode. [WIP] + - updated thumbnail +--------------------------------------------------------------------------------------------------- Version: 1.0.5 Date: 2.4.2022 Features: diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 3ddcf3d..9378630 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -19,4 +19,14 @@ end --overhaul K2 if (settings.startup['overhaul_mode'].value == true and mods["Krastorio2"]) then require('scripts/krastorio2/overhaul') +end +--overhaul with realistic reactors +if mods["RealisticReactors"] then + for i,v in ipairs(data.raw.technology["nuclear-power"].prerequisites) do + if v == "effectivity-module-2" then data.raw.technology["nuclear-power"].prerequisites[i] = nil end + end + + if (settings.startup['overhaul_mode'].value == true and settings.startup['overhaul_realistic_reactors'].value == true) then + require('scripts/realisticreactors/overhaul') + end end \ No newline at end of file diff --git a/info.json b/info.json index 7a57e44..b0ac7ea 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "248k", - "version": "1.0.5", + "version": "1.0.6", "title": "248k Mod", "author": "PreLeyZero", "factorio_version": "1.1", @@ -12,6 +12,7 @@ "?informatron", "?Krastorio2", "?IndustrialRevolution", - "?space-exploration" + "?space-exploration", + "?RealisticReactors" ] } \ No newline at end of file diff --git a/locale/en/lang_en.cfg b/locale/en/lang_en.cfg index 56153df..14cf504 100644 --- a/locale/en/lang_en.cfg +++ b/locale/en/lang_en.cfg @@ -83,6 +83,9 @@ fi_materials_waste=Nuclear waste fi_materials_empty_solution=Empty solution container fi_materials_solution=Corrosive solution fi_materials_rich_powder=Rich powder +fi_tech_fuel=Fission tech +fi_test_fuel=Nuclear reasearch fuel +fi_test_used_fuel=Used reasearch fuel @@ -166,7 +169,8 @@ gr_materials_stacked_data_item=Stacked deep data gr_materials_charge_remote=Ultimate bug zapper remote - +#overhaul +uranium-fuel-cell-updated=Uranium fuel cell (old) #fluid [fluid-name] @@ -266,7 +270,8 @@ fu_ki_core_item=For usage please look into the ingame booktorio/Informatron wiki gr_white_hole_item=This machine can nearly replicate any item you put into! gr_materials_white_item=||Well done! You did it. You have reached the ultimate goal. With holding the 248k element you have beaten the 248k mod.|| - +#overhaul +uranium-fuel-cell-updated=This fuel cell can't be used in realistic reactor. #buildable entities [entity-name] @@ -523,6 +528,7 @@ el_train_fuel=Train fuel fi_basic_fuel=Basic nuclear fuel fi_advanced_fuel=Advanced nuclear fuel fi_pure_fuel=High energy nuclear fuel +fi_test_fuel=Nuclear reasearch fuel #settings [mod-setting-name] @@ -540,6 +546,7 @@ el_burner_kerosene_power_output=Kerosene generator power output fu_burner_power_output=Fusion Stage burner power output override_krastorio_endgame=Adjust Krastorio2 recipes for Anti-matter reactor, Intergalactic transreciever overhaul_mode=Overaul vanilla/Krastorio2 by inserting 248k in progression, aswell as in techs and recipes. NOTE: When 248k is added in already existing save this may cause problems. For best gameplay use this on new world. +overhaul_realistic_reactors=Integrate Realistic Reactors in 248k. Only possible in Overaul mode. el_ki_beacon_effectivity_2=KI2 beacon effectivity el_ki_beacon_supply_area_2=KI2 beacon area diff --git a/migrations/248k-1.0.6.lua b/migrations/248k-1.0.6.lua new file mode 100644 index 0000000..7d65c32 --- /dev/null +++ b/migrations/248k-1.0.6.lua @@ -0,0 +1,13 @@ +if settings.startup['overhaul_mode'].value == false then + game.print("You are currently playing 248k on standalone Mode.", {r=0.5, g=0, b=0.5}) + game.print("If you wish to play 248k as an overhaul mod with tech and item integration, especially in Krastorio2 turn on the mod setting", {r=0.5, g=0, b=0.5}) +elseif settings.startup['overhaul_mode'].value == true then + game.print("You are currently playing 248k on overhaul Mode.", {r=0.5, g=0, b=0.5}) + game.print("If you wish to play 248k as an standalone mod without tech and item integration turn off the mod setting", {r=0.5, g=0, b=0.5}) +end + +for _, force in pairs(game.forces) do + force.reset_recipes() + force.reset_technologies() + force.reset_technology_effects() +end \ No newline at end of file diff --git a/prototypes/248k_subgroups.lua b/prototypes/248k_subgroups.lua index aaaca3e..f40fed4 100644 --- a/prototypes/248k_subgroups.lua +++ b/prototypes/248k_subgroups.lua @@ -392,6 +392,10 @@ data:extend({ name = 'el_train_fuel', type = 'fuel-category', }, + { + name = 'fi_test_fuel', + type = 'fuel-category', + }, { name = 'fi_basic_fuel', type = 'fuel-category', diff --git a/ressources/fission/fi_fuel/fi_fuel_tech_item.png b/ressources/fission/fi_fuel/fi_fuel_tech_item.png new file mode 100644 index 0000000..04f153a Binary files /dev/null and b/ressources/fission/fi_fuel/fi_fuel_tech_item.png differ diff --git a/ressources/fission/fi_fuel/fi_fuel_test_item.png b/ressources/fission/fi_fuel/fi_fuel_test_item.png new file mode 100644 index 0000000..3e48734 Binary files /dev/null and b/ressources/fission/fi_fuel/fi_fuel_test_item.png differ diff --git a/ressources/fission/fi_fuel/fi_fuel_test_used_item.png b/ressources/fission/fi_fuel/fi_fuel_test_used_item.png new file mode 100644 index 0000000..b86dfe8 Binary files /dev/null and b/ressources/fission/fi_fuel/fi_fuel_test_used_item.png differ diff --git a/ressources/fission/fi_solid_reactor/fi_solid_reactor_entity_animation_2.png b/ressources/fission/fi_solid_reactor/fi_solid_reactor_entity_animation_2.png new file mode 100644 index 0000000..72db8f1 Binary files /dev/null and b/ressources/fission/fi_solid_reactor/fi_solid_reactor_entity_animation_2.png differ diff --git a/scripts/realisticreactors/data.lua b/scripts/realisticreactors/data.lua new file mode 100644 index 0000000..e69de29 diff --git a/scripts/realisticreactors/overhaul.lua b/scripts/realisticreactors/overhaul.lua new file mode 100644 index 0000000..2a46a11 --- /dev/null +++ b/scripts/realisticreactors/overhaul.lua @@ -0,0 +1,417 @@ +local function add_to_recipe(recipe, item, item_amount) + if not data.raw.recipe[recipe] then + return + end + + if data.raw.recipe[recipe].ingredients then + table.insert(data.raw.recipe[recipe].ingredients, {type="item", name=item, amount=item_amount}) + end + + if data.raw.recipe[recipe].normal and data.raw.recipe[recipe].expensive then + table.insert(data.raw.recipe[recipe].normal.ingredients, {type="item", name=item, amount=item_amount}) + table.insert(data.raw.recipe[recipe].expensive.ingredients, {type="item", name=item, amount=item_amount}) + end +end + +local function add_to_recipes(table_in) + --table structure: {{recipe, item, item_amount}, ... , ...} + for i,v in pairs(table_in) do + add_to_recipe(table_in[i].recipe, table_in[i].item, table_in[i].item_amount) + end +end + +local function change_table_index(table_in, structure) + + local indexed_table = {} + + for _,v in ipairs(table_in) do + local indexed_sub_table = {} + for i,x in ipairs(v) do + indexed_sub_table[structure[i]] = x + end + table.insert(indexed_table, indexed_sub_table) + end + return indexed_table +end + +local function add_to_tech(tech, pre_tech) + if not data.raw.technology[tech] then + return + end + + if not data.raw.technology[pre_tech] then + return + end + + table.insert(data.raw.technology[tech].prerequisites, pre_tech) +end + +local function add_to_techs(table_in) + --table structure: {{tech, pre_tech}, ... , ...} + for i,v in pairs(table_in) do + add_to_tech(table_in[i].tech, table_in[i].pre_tech) + end +end + +local function remove_tech_card(tech, card) + if not data.raw.technology[tech] then + return + end + + --in data.raw + --[[ + ingredients = { + {'automation-science-pack',1}, + {'logistic-science-pack',1}, + } + ]] + + for i,v in ipairs(data.raw.technology[tech].unit.ingredients) do + for j,w in ipairs(v) do + if w == card then + data.raw.technology[tech].unit.ingredients[i] = nil + end + end + end +end + +local function remove_tech_cards(table_in) + --table structure: {{tech, card}, ... , ...} + for i,v in pairs(table_in) do + remove_tech_card(table_in[i].tech, table_in[i].card) + end +end + +local function remove_pre_tech(tech, pre_tech) + if not data.raw.technology[tech] then + return + end + + for i,v in ipairs(data.raw.technology[tech].prerequisites) do + if v == pre_tech then + data.raw.technology[tech].prerequisites[i] = nil + end + end +end + +local function remove_pre_techs(table_in) + --table structure: {{tech, pre_tech}, ... , ...} + for i,v in pairs(table_in) do + remove_pre_tech(table_in[i].tech, table_in[i].pre_tech) + end +end + +local function add_tech_cards(table_in) + --table structure: {{tech, card}, ... , ...} + for i,v in pairs(table_in) do + add_tech_card(table_in[i].tech, table_in[i].card) + end +end + +local function add_tech_card(tech, card) + if not data.raw.technology[tech] then + return + end + + if contains_tech_card(data.raw.technology[tech].unit.ingredients, card) then + return + end + + table.insert(data.raw.technology[tech].unit.ingredients, {card, 1}) +end + +function contains_tech_card(table_in, card) + for i,v in ipairs(table_in) do + if v[1] == card then + return true + end + end + return false +end + + +--=================================================================================================================== +-- 248k item/tech integration with Krastorio2 +--=================================================================================================================== + +--[BUILDINGS] + +building_table = { + --{"kr-electrolysis-plant", "el_materials_ALK", 10}, + +} + +--[ITEMS] + +item_table = { + {"fi_train_equipment_generator_recipe", "fi_tech_fuel", 10}, + {"fi_equipment_player_reactor_recipe", "fi_tech_fuel", 10}, + {"fu_tech_sign_recipe", "fi_tech_fuel", 1}, + +} + +--[TECH] + +tech_table = { + {"fi_energy_tech", "fi_solid_reactor_tech"}, + {"nuclear-power", "fi_energy_tech"}, + {"fi_solid_reactor_tech", "fi_materials_tech"}, + {"fi_train_tech", "nuclear-power"}, + {"fi_refining_tech", "fi_energy_tech"}, + {"nuclear-power", "fi_refining_tech"}, +} + +--[ADD TECH CARDS] + +add_card_table = { + --{"el_purifier_tech", "space-science-pack"}, + +} + +--[REMOVE TECH CARDS] + +remove_card_table = { + --{"el_purifier_tech", "logistic-science-pack"}, + +} + +--[REMOVE PREREQUISITES] + +pre_tech_table = { + --{"nuclear-power", "effectivity-module-2"}, + {"nuclear-power", "uranium-processing"}, + {"fi_energy_tech", "nuclear-power"}, + {"fi_solid_reactor_tech", "fi_refining_tech"}, + {"fi_solid_reactor_tech", "fi_energy_tech"}, + + +} + +--=================================================================================================================== +-- changes in entities and other protypes +--=================================================================================================================== + +data.raw.item["uranium-fuel-cell"].localised_name = {"item-name.uranium-fuel-cell-updated"} +data.raw.item["uranium-fuel-cell"].localised_description = {"item-description.uranium-fuel-cell-updated"} + +data.raw.technology["nuclear-fuel-reprocessing"].hidden = true + +data.raw.reactor["fi_solid_reactor_entity"] = nil +data.raw.reactor["realistic-reactor-breeder"].energy_source.fuel_categories = {"fi_advanced_fuel", "fi_basic_fuel"} +data.raw.reactor["realistic-reactor-normal"].energy_source.fuel_categories = {"fi_advanced_fuel", "fi_basic_fuel"} +data.raw.reactor["realistic-reactor"].energy_source.fuel_categories = {"fi_advanced_fuel", "fi_basic_fuel"} +for i=1, 250 do + data.raw.reactor["realistic-reactor-"..i].energy_source.fuel_categories = {"fi_advanced_fuel", "fi_basic_fuel"} +end + + +table.insert(data.raw.technology["nuclear-power"].effects, { + type = 'unlock-recipe', + recipe = 'fi_advanced_fuel_recipe', +}) +table.insert(data.raw.technology["nuclear-power"].effects, { + type = 'unlock-recipe', + recipe = 'fi_pure_fuel_recipe', +}) +table.insert(data.raw.technology["nuclear-power"].effects, { + type = 'unlock-recipe', + recipe = 'fi_advanced_thorium_fuel_recipe', +}) +table.insert(data.raw.technology["nuclear-power"].effects, { + type = 'unlock-recipe', + recipe = 'fi_advanced_fuel_recycle_recipe', +}) +table.insert(data.raw.technology["nuclear-power"].effects, { + type = 'unlock-recipe', + recipe = 'fi_advanced_thorium_fuel_recycle_recipe', +}) +table.insert(data.raw.technology["nuclear-power"].effects, { + type = 'unlock-recipe', + recipe = 'fi_pure_fuel_recycle_recipe', +}) + +data.raw.recipe["realistic-reactor"].ingredients = { + {"fi_solid_reactor_item", 1}, {"fi_tech_fuel", 20}, {"heat-pipe", 20} +} + +data.raw.recipe["breeder-reactor"].ingredients = { + {"fi_solid_reactor_item", 1}, {"fi_tech_fuel", 40}, {"heat-pipe", 20}, {"productivity-module-3", 3} +} + +data:extend({ + { + name = 'fi_test_fuel', + type = 'item', + icon = '__248k__/ressources/fission/fi_fuel/fi_fuel_test_item.png', + icon_size = 64, + stack_size = 20, + subgroup = 'fi_item_subgroup_b', + fuel_category = 'fi_test_fuel', + fuel_value = '50MJ', + fuel_glow_color = {r=0.1,g=0.74,b=0.39,a=0.5}, + order = 'x-a', + burnt_result = 'fi_test_used_fuel', + }, + { + name = 'fi_test_used_fuel', + type = 'item', + icon = '__248k__/ressources/fission/fi_fuel/fi_fuel_test_used_item.png', + icon_size = 64, + stack_size = 100, + subgroup = 'fi_item_subgroup_b', + order = 'x-b', + }, + { + name = 'fi_tech_fuel', + type = 'item', + icon = '__248k__/ressources/fission/fi_fuel/fi_fuel_tech_item.png', + icon_size = 64, + stack_size = 100, + subgroup = 'fi_item_subgroup_b', + order = 'x-c', + }, + { + name = 'fi_test_fuel_recipe', + type = 'recipe', + enabled = 'false', + category = 'crafting', + ingredients = { + {'uranium-238',2}, + {'el_materials_ALK',5}, + }, + result = 'fi_test_fuel', + result_count = 1, + energy_required = 2, + order = 'b-b', + }, + { + name = 'fi_tech_fuel_recipe', + type = 'recipe', + enabled = 'false', + category = 'crafting', + ingredients = { + {'fi_test_used_fuel', 1}, + {'chemical-science-pack', 2}, + {'uranium-238', 2}, + }, + result = 'fi_tech_fuel', + result_count = 1, + energy_required = 1, + order = 'b-b', + }, + { + name = 'fi_use_tech_fuel_recipe', + type = 'recipe', + enabled = 'false', + category = 'fi_test_fuel_crafting_category', + ingredients = { + {'fi_test_fuel', 1} + }, + result = 'fi_test_used_fuel', + result_count = 1, + energy_required = 5, + order = 'b-b', + hidden = true, + }, + { + name = 'fi_solid_reactor_tech', + type = 'technology', + icon = '__248k__/ressources/techs/fi_solid_reactor_tech.png', + icon_size = 128, + prerequisites = {'fi_energy_tech','fi_refining_tech'}, + effects = { + { + type = 'unlock-recipe', + recipe = 'fi_solid_reactor_recipe', + }, + { + type = 'unlock-recipe', + recipe = 'fi_tech_fuel_recipe', + }, + { + type = 'unlock-recipe', + recipe = 'fi_test_fuel_recipe', + } + }, + unit = { + count = '500', + ingredients = { + {'chemical-science-pack',1}, + {'automation-science-pack',1}, + {'logistic-science-pack',1,}, + }, + time = 30, + }, + }, + { + name = 'fi_solid_reactor_entity', + type = 'assembling-machine', + icon = '__248k__/ressources/fission/fi_solid_reactor/fi_solid_reactor_entity_icon.png', + icon_size = 64, + flags = {"player-creation","placeable-neutral"}, + max_health = 300, + corpse = 'big-remnants', + collision_box = {{-2.7,-2.7},{2.7,2.7}}, + selection_box = {{-3.0,-3.0},{3.0,3.0}}, + map_color = {r=0, g=0, b=1, a=1}, + minable = { + mining_time = 1, + result = 'fi_solid_reactor_item', + }, + fixed_recipe = 'fi_use_tech_fuel_recipe', + crafting_categories = {"fi_test_fuel_crafting_category"}, + crafting_speed = 1, + energy_source = { + type = 'void', + }, + energy_usage = "1W", + animation = { + filename = '__248k__/ressources/fission/fi_solid_reactor/fi_solid_reactor_entity_animation.png', + width = 960, + height = 960, + shift = {0, 0}, + scale = 0.2, + }, + working_visualisations = { + { + animation = { + filename = '__248k__/ressources/fission/fi_solid_reactor/fi_solid_reactor_entity_animation_2.png', + width = 960, + height = 960, + shift = {0, 0}, + scale = 0.2, + line_length = 4, + lines_per_file = 1, + frame_count = 4, + animation_speed = 0.1, + } + } + }, + working_sound = { + sound = { filename ='__base__/sound/nuclear-reactor-1.ogg'}, + apparent_volume = 2.5, + }, + }, + { + name = 'fi_test_fuel_crafting_category', + type = 'recipe-category', + }, +}) + + + +--=================================================================================================================== +-- structures and adding +--=================================================================================================================== + +recipe_structure = {"recipe", "item", "item_amount"} +tech_structure = {"tech", "pre_tech"} +card_structure = {"tech", "card"} + +add_to_recipes(change_table_index(building_table, recipe_structure)) +add_to_recipes(change_table_index(item_table, recipe_structure)) +add_to_techs(change_table_index(tech_table, tech_structure)) +add_tech_cards(change_table_index(add_card_table, tech_structure)) +remove_pre_techs(change_table_index(pre_tech_table, tech_structure)) +remove_tech_cards(change_table_index(remove_card_table, card_structure)) + diff --git a/settings.lua b/settings.lua index eaa6ca6..3604088 100644 --- a/settings.lua +++ b/settings.lua @@ -183,4 +183,11 @@ data:extend({ default_value = true, order = 'b', }, + { + name = 'overhaul_realistic_reactors', + type = 'bool-setting', + setting_type = 'startup', + default_value = true, + order = 'b', + }, }) \ No newline at end of file