diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec8ad7a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.zip +*.dat +mod-list.json +/mods \ No newline at end of file diff --git a/017_science/data-updates.lua b/017_science/data-updates.lua index a460414..934957c 100644 --- a/017_science/data-updates.lua +++ b/017_science/data-updates.lua @@ -194,12 +194,58 @@ if settings.startup["017-durability"].value then end if settings.startup["017-axe"].value then + local function fake_axe(item, recipe) + local name = item.name .. "-item" + return{ + { + type = "item", + name = name, + localised_name = {"item-name." .. item.name}, + localised_description = {"item-description.fake-mining-tool"}, + icon = item.icon, + icon_size = item.icon_size, + flags = {"goes-to-main-inventory"}, + subgroup = "tool", + order = item.order, + stack_size = item.stack_size + }, + { + type = "recipe", + name = name, + ingredients = recipe.ingredients, + result = name + } + } + end + local axe_item = {} + local axe_recipe = {} + local axe_recipe_consumers = {} for _, axe in pairs(data.raw["mining-tool"]) do - for i, r in pairs(data.raw["recipe"]) do - if data.raw["recipe"][i].result == axe.name then - data.raw["recipe"][i].hidden = true - data.raw["recipe"][i].ingredients = {} + local axe_name = axe.name + axe_item[axe_name] = axe + axe_recipe_consumers[axe_name] = false + for i, recipe in pairs(data.raw["recipe"]) do + if recipe.ingredients then + for j, ingredients in pairs(recipe.ingredients) do + if ingredients[1] == axe_name and ingredients[2] ~= 0 then + ingredients[1] = axe_name .. "-item" + axe_recipe_consumers[axe_name] = true + end + end end + if recipe.result == axe_name then + axe_recipe[axe_name] = recipe + end + end + end + for l, axe in pairs(axe_item) do + if axe_recipe[axe.name] ~= nil then + local axe_name = axe.name + modify = false + if axe_recipe_consumers[axe_name] == true then + data:extend(fake_axe(axe, axe_recipe[axe_name])) + end + axe_recipe[axe_name].hidden = true end end end diff --git a/017_science/info.json b/017_science/info.json index c1c787b..0e98bc4 100644 --- a/017_science/info.json +++ b/017_science/info.json @@ -1,10 +1,10 @@ { "name": "017_science", - "version": "0.1.5", + "version": "0.1.61", "factorio_version": "0.16", "title": "0.17 science conversion", "author": "npc_strider(morley376)", "contact": "https://mods.factorio.com/mod/017_science/discussion", "homepage": "http://steamcommunity.com/id/morley376", - "description": "Read the modpage for more information: https://mods.factorio.com/mod/017_science. Adds in the new science pack recipes and known tech tree, while keeping 0.16 recipes intact so that the player may update their base at their own pace. Implements almost all 0.17 balance changes: transport-belt, mining, smelting changes, and more (see page for full list). Compatible with existing saves, most big mods and will support release 0.17!" + "description": "THE FINAL WORKING VERSION OF THE MOD. Expect version 0.1.7 of the mod to be a migration mod, the purpose of which is to migrate your savegame to factorio 0.17 so that this mod can be removed. Read the modpage for more information: https://mods.factorio.com/mod/017_science. Adds in the new science pack recipes and known tech tree, while keeping 0.16 recipes intact so that the player may update their base at their own pace. Implements almost all 0.17 balance changes: transport-belt, mining, smelting changes, and more (see page for full list). Compatible with existing saves, most big mods and will support release 0.17!" } diff --git a/017_science/locale/en/base.cfg b/017_science/locale/en/base.cfg index 4ac3fef..5cf758b 100644 --- a/017_science/locale/en/base.cfg +++ b/017_science/locale/en/base.cfg @@ -19,6 +19,9 @@ science-pack-3=Chemical science pack high-tech-science-pack=Utility science pack 017-mine=Request a new mining-tool +[item-description] +fake-mining-tool=Axe for crafting purposes only. + [mod-setting-name] 017-drill=Ore hardness simplification 017-smelting=Reduce smelting time