0.1.6 Fix for mods which use mining-tools in recipes

FINAL WORKING RELEASE OF THE MOD - NEXT RELEASE WILL BE FOR MIGRATING
SAVES TO OFFICIAL 0.17. Thanks to those who reported bugs and provided fixes
This commit is contained in:
Peter 2019-02-23 17:11:22 +08:00
parent 0214389eb2
commit 3f70c4b208
3 changed files with 54 additions and 6 deletions

View File

@ -194,14 +194,59 @@ if settings.startup["017-durability"].value then
end end
if settings.startup["017-axe"].value then 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 _, axe in pairs(data.raw["mining-tool"]) do
for i, r in pairs(data.raw["recipe"]) do local axe_name = axe.name
if data.raw["recipe"][i].result == axe.name then axe_item[axe_name] = axe
data.raw["recipe"][i].hidden = true for i, recipe in pairs(data.raw["recipe"]) do
data.raw["recipe"][i].ingredients = {} 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 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
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
if settings.startup["017-equipment"].value and data.raw["recipe"]["belt-immunity-equipment"] == nil then if settings.startup["017-equipment"].value and data.raw["recipe"]["belt-immunity-equipment"] == nil then

View File

@ -1,10 +1,10 @@
{ {
"name": "017_science", "name": "017_science",
"version": "0.1.5", "version": "0.1.6",
"factorio_version": "0.16", "factorio_version": "0.16",
"title": "0.17 science conversion", "title": "0.17 science conversion",
"author": "npc_strider(morley376)", "author": "npc_strider(morley376)",
"contact": "https://mods.factorio.com/mod/017_science/discussion", "contact": "https://mods.factorio.com/mod/017_science/discussion",
"homepage": "http://steamcommunity.com/id/morley376", "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!"
} }

View File

@ -19,6 +19,9 @@ science-pack-3=Chemical science pack
high-tech-science-pack=Utility science pack high-tech-science-pack=Utility science pack
017-mine=Request a new mining-tool 017-mine=Request a new mining-tool
[item-description]
fake-mining-tool=Axe for crafting purposes only.
[mod-setting-name] [mod-setting-name]
017-drill=Ore hardness simplification 017-drill=Ore hardness simplification
017-smelting=Reduce smelting time 017-smelting=Reduce smelting time