Page 2 of 2

Re: [Request] Recipe Configuration Mod

Posted: Tue Dec 19, 2017 8:56 am
by bobingabout
Well, your request... text editable method to edit recipes... basically is saying "I want a mod, that I mod, to do everything I can by just modding", the request doesn't make a whole lot of sense. The response telling you to mod, is an appropriate response to your request.

Re: [Request] Recipe Configuration Mod

Posted: Tue Dec 19, 2017 11:33 am
by darkfrei
It's possible to make a mod, where will be checked technology of recipes and price of items. If something isn't possible to do, then this item can be replaced with another item with same price and technology level.
So, it's market mod, maybe universal materia.

Re: [Request] Recipe Configuration Mod

Posted: Tue Dec 19, 2017 7:07 pm
by donoya
bobingabout wrote:Well, your request... text editable method to edit recipes... basically is saying "I want a mod, that I mod, to do everything I can by just modding", the request doesn't make a whole lot of sense. The response telling you to mod, is an appropriate response to your request.
All I'm asking is for easier recipe modification. I don't need the ability to make custom buildings as part of the mod or anything like that.

Re: [Request] Recipe Configuration Mod

Posted: Wed Dec 20, 2017 4:57 am
by donoya
I guess I should be a bit more specific. I want someone to make a mod that I can use to list items (both fluids and entities) and recipes, then, with that information, give it a text file with a specific format that says to remove and/or add recipes during loading using a+b+c+... inputs in x machine to produce y+z+... outputs with an optional chance information per output. All fluid inputs and outputs will need to be checked by the mod and if an added recipe fails to meet this requirement, it can either be made to ignore the recipe and keep going, or stop loading and give a message (or ignore it and keep loading, but still log the erroring recipes). Also, the tech which unlocks the recipe should also be configurable with this mod. That is, in as exact detail as I can currently manage, what I want someone to mod.

Re: [Request] Recipe Configuration Mod

Posted: Wed Dec 20, 2017 6:08 am
by darkfrei
donoya wrote:All fluid inputs and outputs will need to be checked by the mod and if an added recipe fails to meet this requirement, it can either be made to ignore the recipe and keep going, or stop loading and give a message (or ignore it and keep loading, but still log the erroring recipes).
It sounds like viewtopic.php?f=135&t=53618

Re: [Request] Recipe Configuration Mod

Posted: Wed Dec 20, 2017 10:36 am
by bobingabout
You'll still be writing a mod, but take a look at my library. viewtopic.php?f=51&t=16642
https://mods.factorio.com/mods/Bobingabout/boblibrary

The information is a little out of date, but instead of having to redefine entire recipes, or use the raw.data.recipe hard table edits, you can instead use lines like this

bobmods.lib.recipe.replace_ingredient(recipe, old, new) --(Performs a remove, then an add, keeping the same amount of the item)
bobmods.lib.recipe.add_new_ingredient(recipe, item) --(If the item exists already it is ignored)
bobmods.lib.recipe.add_ingredient(recipe, item) --(if the item exists, the number required is increased)
bobmods.lib.recipe.remove_ingredient(recipe, item)

bobmods.lib.recipe.add_result(recipe, item)
bobmods.lib.recipe.remove_result(recipe, item)


Then you get advanced versions for recipes with two definitions for expensive.
bobmods.lib.recipe.remove_difficulty_ingredient(recipe, difficulty, item)
bobmods.lib.recipe.add_new_difficulty_ingredient(recipe, difficulty, item)
bobmods.lib.recipe.add_difficulty_ingredient(recipe, difficulty, item)
bobmods.lib.recipe.add_difficulty_result(recipe, difficulty, item)
bobmods.lib.recipe.remove_difficulty_result(recipe, difficulty, item)


For all cases, recipe is the recipe's internal name and difficulty is the difficulty name. ("normal" or "expensive")

item is different between add and remove. Remove (and replace) is simply the item's internal name (fluids are accounted for), however when you add, you need to specify more information, so {"wood",1} or {type="fluid", name="water", amount = 1} are valid item tables (Just like normal LUA)

So a couple of literal examples:
bobmods.lib.recipe.replace_ingredient("bob-pump-2", "steel-plate", "aluminium-plate")
bobmods.lib.recipe.add_ingredient("bob-locomotive-2", {"steel-bearing", 16})

Unfortunately in it's current state, it doesn't do everything for a recipe, it doesn't change category, or crafting time. Since the primary reason for this existing was to help me, and changing a category is easy enough, you just do data.raw.recipe[recipe].category = new_category, crafting time is a little harder with the multiple difficulties though.
There is also another set of functions for manipulating Technologies, which include adding or removing a recipe as an unlock for that technology.

Do you think this is closer to what you want?

Re: [Request] Recipe Configuration Mod

Posted: Wed Dec 20, 2017 10:50 pm
by donoya
bobingabout wrote:You'll still be writing a mod, but take a look at my library. viewtopic.php?f=51&t=16642
https://mods.factorio.com/mods/Bobingabout/boblibrary

The information is a little out of date, but instead of having to redefine entire recipes, or use the raw.data.recipe hard table edits, you can instead use lines like this

bobmods.lib.recipe.replace_ingredient(recipe, old, new) --(Performs a remove, then an add, keeping the same amount of the item)
bobmods.lib.recipe.add_new_ingredient(recipe, item) --(If the item exists already it is ignored)
bobmods.lib.recipe.add_ingredient(recipe, item) --(if the item exists, the number required is increased)
bobmods.lib.recipe.remove_ingredient(recipe, item)

bobmods.lib.recipe.add_result(recipe, item)
bobmods.lib.recipe.remove_result(recipe, item)


Then you get advanced versions for recipes with two definitions for expensive.
bobmods.lib.recipe.remove_difficulty_ingredient(recipe, difficulty, item)
bobmods.lib.recipe.add_new_difficulty_ingredient(recipe, difficulty, item)
bobmods.lib.recipe.add_difficulty_ingredient(recipe, difficulty, item)
bobmods.lib.recipe.add_difficulty_result(recipe, difficulty, item)
bobmods.lib.recipe.remove_difficulty_result(recipe, difficulty, item)


For all cases, recipe is the recipe's internal name and difficulty is the difficulty name. ("normal" or "expensive")

item is different between add and remove. Remove (and replace) is simply the item's internal name (fluids are accounted for), however when you add, you need to specify more information, so {"wood",1} or {type="fluid", name="water", amount = 1} are valid item tables (Just like normal LUA)

So a couple of literal examples:
bobmods.lib.recipe.replace_ingredient("bob-pump-2", "steel-plate", "aluminium-plate")
bobmods.lib.recipe.add_ingredient("bob-locomotive-2", {"steel-bearing", 16})

Unfortunately in it's current state, it doesn't do everything for a recipe, it doesn't change category, or crafting time. Since the primary reason for this existing was to help me, and changing a category is easy enough, you just do data.raw.recipe[recipe].category = new_category, crafting time is a little harder with the multiple difficulties though.
There is also another set of functions for manipulating Technologies, which include adding or removing a recipe as an unlock for that technology.

Do you think this is closer to what you want?
Do I need to make a separate mod to use these? Because I don't know how to make all the other files a mod needs. If I can do it as a single file in your library mod, which folder would I need to put it in?

Re: [Request] Recipe Configuration Mod

Posted: Thu Dec 21, 2017 9:02 am
by bobingabout
You have to make your own mod, which is quite simple. for using these instructions in your own mod, simply just add them to data.lua.
To make the mod itself, you need info.json, take a look at that file in any existing mod, then copy it and write your own data in there. Add my Library as a Dependancy, as well as all other mods with recipes that you edit.

to note: You need a version number in the mod file, the folder you put your mod in must match the format modname_version, with an underscore between.


Example:
folder name: recipeedit_0.1.0
info.json contents:

Code: Select all

{
  "name": "recipeedit",
  "version": "0.1.0",
  "factorio_version": "0.16",
  "title": "Recipe editing mod",
  "author": "donoya",
  "contact": "donoya@hotmail.com",
  "homepage": "https://forums.factorio.com/viewforum.php?f=33&t=7656",
  "description": "This mod will change recipes in the game.",
  "dependencies": ["base >= 0.16.0", "boblibrary >= 0.16.0"]
}