Page 1 of 1
Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Sun Mar 07, 2021 2:33 am
by yagaodirac
TL;DR
Once the assembly machine is set to recipe_lock, the recipe inside should be totally customizable, the ingredients, productions, energy consumption, duration. I mean, everything.
What ?
Sometimes, we want to provide some automatic item conversion for players. The shop doesn't do the job automatically. The assembly machine is not customizable. A machine with locked recipe could be utilized as a shop, like, vending machine. People could use it with loaders, inserters. Quite convenient. But with the run time now, I've got no idea how to change the input.
If I mean to change the ingredient, I have to introduce a mod. But you know, the mod means less convenient, less downloads less played.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Sun Mar 07, 2021 9:35 am
by ickputzdirwech
Honestly I don’t really know what you are talking about. Do you mind explaining it a bit more? Do you want to make a scenario for a server?
Also from what I gathered you might just be looking for a furnace. Furnaces automatically change the recipe.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Sun Mar 07, 2021 11:11 pm
by Silari
It sounds more like they want to be able to modify a recipe's properties during the game.
The engine doesn't support anything like that. You can change what recipe something uses (LUA API has the Entity.set_recipe command for that, which AFAIK works on buildings that are recipe locked), but the ingredients/outputs/energy required for a given recipe are all part of the RecipePrototype which is only changeable during startup. Recipes don't have a duration, it's just the result of the required energy * the machine speed.
If you want something that can convert from one item to another, you're going to have to write a mod to set them up during startup (as noted elsewhere a furnace would be good for that, since it automatically changes it's recipe based on what you put into it), or get really creative with control.lua scripting as part of a scenario.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Mon Mar 08, 2021 7:58 am
by yagaodirac
To both of the friends replied in this page.
Actually, only the ingredients list is NOT modifiable with out a mod. The production is possible to change(first, get the inventory, then change the content). The energy is possible to change(surface -> find entity -> entity.energy+=100000000). The crafting duration is possible to change( entity.craft_processing+=0.1667). Only the ingredients are stable. I've no idea how to change the item list the inserters grab from conveyor belts.
Generally this modifiable recipe hack is usually for some neutral force, or as part of the environment. It means the input for any assembly machine has to match some exist recipe. It's not possible to make a recipe 100 iron-ore >>> 65 iron-plate (which is useful when setting up shops).
Most of the case, we create a machine with force = "neutral", lock the recipe, push it into some container in lua, tick it to ass energy for it. Some times we even control the production, the duration. If it's possible to control the very last detail, the ingredient, it would be sweet.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Mon Mar 08, 2021 8:01 am
by yagaodirac
Silari wrote: Sun Mar 07, 2021 11:11 pm
Hi, I replied in 4th layer. I Hope it helps.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Mon Mar 08, 2021 2:43 pm
by ssilk
Sorry, don't understand it. I'm still missing the WHY do you need it.
What kind of game are you playing?
I mean: It's a recipe.
If I want to make a cake I use butter, eggs, flour. It makes no sense to change that recipe, because then something else will come out.
If I want to make a different cake I can use another recipe instead.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Tue Mar 09, 2021 12:59 am
by NotRexButCaesar
ssilk wrote: Mon Mar 08, 2021 2:43 pm
Sorry, don't understand it. I'm still missing the WHY do you need it.
What kind of game are you playing?
I mean: It's a recipe.
If I want to make a cake I use butter, eggs, flour. It makes no sense to change that recipe, because then something else will come out.
If I want to make a different cake I can use another recipe instead.
It sounds to me like he wants to create a scenario with random recipe machines spread around the map.
The recipes won’t be set by the payer, but by a script.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Wed Mar 10, 2021 7:03 am
by ssilk
Create random recipes and put them on the devices??
But, AmericanPatriot, you are guessing.
We cannot know the why yet.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Thu Mar 11, 2021 8:34 am
by yagaodirac
AmericanPatriot wrote: Tue Mar 09, 2021 12:59 am
It sounds to me like he wants to create a scenario with random recipe machines spread around the map.
The recipes won’t be set by the payer, but by a script.
Yeah. That's it.
Re: Fully customizable recipe in locked assembly machine WITHOUT MOD.
Posted: Thu Mar 11, 2021 8:38 am
by yagaodirac
I solved this problem with a very unintuitive way. I manage combinations of "filtered-inserter" and "wooden-chest". The filter sluts of filtered inserter are set to the ingredients and then items are changed in chest. Inserter gets rotated to grab items out. Now everything is under my control.