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 7f1d08a909
4 changed files with 59 additions and 6 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.zip
*.dat
mod-list.json
/mods

View File

@ -194,12 +194,58 @@ if settings.startup["017-durability"].value then
end
if settings.startup["017-axe"].value then
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 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
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

View File

@ -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!"
}

View File

@ -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