[Solved] Always show recipe product(s) on tooltip

Suggestions that have been added to the game.

Moderator: ickputzdirwech

Post Reply
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

[Solved] Always show recipe product(s) on tooltip

Post by Mooncat »

Suggestion:
No matter there is only one product or multiple products, show it on the recipe tooltip anyway.


Currently, recipes with more than one products will have the products being shown on the tooltip.
For example:
Image
But not if there is only one product:
Image
The problem is small if you are just playing with vanilla Factorio. But when you play with mods, recipes may become complicated.
Recipe icons may not reflect the products, and even recipe names may not be able to describe the products, like the example above.
(Not saying this mod is bad. It will be boring if all recipe names are product names, or even confusing if all recipe icons are product icons.)

Some recipes may be simpler. Their names can show what and how many products they can produce. But still, we humans can handle icons better than texts.
So, I suggest always showing the recipe products, like this:
Image
Last edited by Mooncat on Mon Oct 03, 2016 7:09 pm, edited 1 time in total.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5156
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Always show recipe product(s) on tooltip

Post by Klonan »

This is defined in the recipe prototype, but it is fairly useless for a single item,

You see the iron gear icon, and you wonder which product it makes,
Well it will be iron gears,

We only use it for recipes with multiple outputs, because their icon differs from the icon of their products,
Such as oil refining, cracking etc.

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Always show recipe product(s) on tooltip

Post by Mooncat »

Klonan wrote:This is defined in the recipe prototype
May I ask how? :shock:
Klonan wrote:but it is fairly useless for a single item,

You see the iron gear icon, and you wonder which product it makes,
Well it will be iron gears,

We only use it for recipes with multiple outputs, because their icon differs from the icon of their products,
Such as oil refining, cracking etc.
But for some mods, like Yuoki Industries, there are multiple recipes that require different ingredients but produce the same product.
Like the image on the example, there are multiple "100 x export some Foo" recipes and they all produce 100 x Merchant Sign. It will be confusing if they all use the Merchant Sign icon.
But, if there is such thing in the recipe prototype to force show the product, I think the problem is solved and I will tell Yuoki immediately. :P

Edit: sorry, I made a mistake. Those export recipes don't produce the same products. But I guess you know what I meant. :mrgreen:
Last edited by Mooncat on Mon Oct 03, 2016 7:00 pm, edited 1 time in total.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5156
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Always show recipe product(s) on tooltip

Post by Klonan »

Mooncat wrote:
Klonan wrote:This is defined in the recipe prototype
May I ask how? :shock:
Klonan wrote:but it is fairly useless for a single item,

You see the iron gear icon, and you wonder which product it makes,
Well it will be iron gears,

We only use it for recipes with multiple outputs, because their icon differs from the icon of their products,
Such as oil refining, cracking etc.
But for some mods, like Yuoki Industries, there are multiple recipes that require different ingredients but produce the same product.
Like the image on the example, there are multiple "100 x export some Foo" recipes and they all produce 100 x Merchant Sign. It will be confusing if they all use the Merchant Sign icon.
But, if there is such thing in the recipe prototype to force show the product, I think the problem is solved and I will tell Yuoki immediately. :P
It is easiest to show with a comparison:

Iron axe:

Code: Select all

  {
    type = "recipe",
    name = "iron-axe",
    ingredients = {{"iron-stick", 2}, {"iron-plate", 3}},
    result = "iron-axe"
  },
Heavy oil cracking:

Code: Select all

  {
    type = "recipe",
    name = "heavy-oil-cracking",
    category = "chemistry",
    enabled = false,
    energy_required = 5,
    ingredients =
    {
      {type="fluid", name="water", amount=3},
      {type="fluid", name="heavy-oil", amount=4}
    },
    results=
    {
      {type="fluid", name="light-oil", amount=3}
    },
    main_product= "",
    icon = "__base__/graphics/icons/fluid/heavy-oil-cracking.png",
    subgroup = "fluid-recipes",
    order = "b[fluid-chemistry]-a[heavy-oil-cracking]"
  },
The 'main_product' definition is the prime suspect

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Always show recipe product(s) on tooltip

Post by aubergine18 »

What is that main_product property actually for? In the base prototypes I've seen it a few times but always set to empty string.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Always show recipe product(s) on tooltip

Post by Mooncat »

Klonan wrote:It is easiest to show with a comparison:

Iron axe:

Code: Select all

  {
    type = "recipe",
    name = "iron-axe",
    ingredients = {{"iron-stick", 2}, {"iron-plate", 3}},
    result = "iron-axe"
  },
Heavy oil cracking:

Code: Select all

  {
    type = "recipe",
    name = "heavy-oil-cracking",
    category = "chemistry",
    enabled = false,
    energy_required = 5,
    ingredients =
    {
      {type="fluid", name="water", amount=3},
      {type="fluid", name="heavy-oil", amount=4}
    },
    results=
    {
      {type="fluid", name="light-oil", amount=3}
    },
    main_product= "",
    icon = "__base__/graphics/icons/fluid/heavy-oil-cracking.png",
    subgroup = "fluid-recipes",
    order = "b[fluid-chemistry]-a[heavy-oil-cracking]"
  },
The 'main_product' definition is the prime suspect
Wow, it is really working!
I just added main_product= "" to the recipe:
Image
I thought main_product is just for fluid recipes.
A little bit surprised that the "100 x" was added to the recipe name by Factorio if the product is not visible. But I guess it is not a problem, and is good for the users.

Thanks a lot Klonan. I will tell Yuoki and other modders about this. :D

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Always show recipe product(s) on tooltip

Post by Mooncat »

aubergine18 wrote:What is that main_product property actually for? In the base prototypes I've seen it a few times but always set to empty string.
Yes, I would like to know this too. Or is it just a magic property for force showing the products? :lol:

(I turned off the computer and slept right after I posted last night, didn't see this)

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5156
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Always show recipe product(s) on tooltip

Post by Klonan »

Mooncat wrote:
aubergine18 wrote:What is that main_product property actually for? In the base prototypes I've seen it a few times but always set to empty string.
Yes, I would like to know this too. Or is it just a magic property for force showing the products? :lol:

(I turned off the computer and slept right after I posted last night, didn't see this)

So if i have a recipe, say "really great way to make circuits" recipe,
The ingredient will be some special plates or something,

But the product will be this special circuit, and some waste material, like some water waste and stone,
These products aren't important,
So i set the main product to be the 'Special-circuit-mk2',
And just leave the 'waste-water-mk1' and 'waste-stone-module" in the products

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Always show recipe product(s) on tooltip

Post by Mooncat »

Klonan wrote:So if i have a recipe, say "really great way to make circuits" recipe,
The ingredient will be some special plates or something,

But the product will be this special circuit, and some waste material, like some water waste and stone,
These products aren't important,
So i set the main product to be the 'Special-circuit-mk2',
And just leave the 'waste-water-mk1' and 'waste-stone-module" in the products
But how is main_product different from other products? :shock: Like, it guarantees such item is shown as the first product? (But I thought "results" are already sorted?)

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [Solved] Always show recipe product(s) on tooltip

Post by aubergine18 »

So:

* If recipe yields single product, that product isn't shown
...unless main_product = "" in which case it is shown

* If recipe yields multiple products, they will all be shown
...unless main_product = "something" in which case only "something" is shown
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Always show recipe product(s) on tooltip

Post by Mooncat »

aubergine18 wrote:* If recipe yields multiple products, they will all be shown
...unless main_product = "something" in which case only "something" is shown
I am afraid it is not true. See the recipes of Pyanodons Coal Processing.
Its "coal-gas" recipe has 4 results and its main_product is set to one of them, but still all 4 are visible.
It is not related to the order neither. Its main_product is shown as the third product in game.

Another case: its "creosote" recipe has only 1 "results", and its "main_product" is set to that product.
No product is visible.

So I have no idea what main_product can do. :?

(BTW, probability in results is really a thing! :shock: )



Edit: oh wait. I think I know now. For single-product recipes, the recipe names are set according to their products. Like the "solid-fuel-from-light-oil" recipe in base mod, its final localised name is set according to its only product "solid-fuel". Other things like subgroup and order can also be set automatically according to the product if such fields are not provided.
For multi-product recipes, if main_product is set, it will be used for setting the fields.
That's why if I set main_product to empty string, it prompts me to provide recipe subgroup. :o

But hey, I smell black magic when I think about the recipe name. Does the engine check the locale under "recipe-name" before considering it needs to use the localised name of the recipe product? :?
I can find a case that's very very suspicious: offshore pump. There is no "recipe-name.offshore-pump" nor "item-name.offshore-pump", but only "entity-name.offshore-pump". But still, we have localised name for its recipe, and also for its item in game. So the engine first check recipe name locale -> not found -> product name locale -> not found -> product place_result entity name locale? :shock:

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [Solved] Always show recipe product(s) on tooltip

Post by aubergine18 »

Hrm, still none the wiser about the `main_product` then, particularly in how it affects which products are shown in game UI.

For localised name and description I would have assumed either the recipe's `name` property would be used, or alternatively the `localised_name` and `localised_description` properties. In cases where I've forgot to define locale strings, I've always seen the game UI mentioning `entity.<recipe-name>` rather than `item.` or `recipe.` - so yes, seems there's order of precedence: recipe, otherwise item, otherwise entity? In terms of place result, what if it's one of the other things that an item can define, such as `placed_as_equipment_result`, `place_as_tile`, etc?

I had no idea probability worked in recipes. Investigating Py's mod...
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Always show recipe product(s) on tooltip

Post by Mooncat »

aubergine18 wrote:Hrm, still none the wiser about the `main_product` then, particularly in how it affects which products are shown in game UI.
I guess it doesn't affect which product to show or not. Instead, it tells the recipe to set its name, icon, subgroup and order (maybe more?) based on which product if such fields are not provided.
aubergine18 wrote:For localised name and description I would have assumed either the recipe's `name` property would be used, or alternatively the `localised_name` and `localised_description` properties. In cases where I've forgot to define locale strings, I've always seen the game UI mentioning `entity.<recipe-name>` rather than `item.` or `recipe.` - so yes, seems there's order of precedence: recipe, otherwise item, otherwise entity? In terms of place result, what if it's one of the other things that an item can define, such as `placed_as_equipment_result`, `place_as_tile`, etc?
Now I want to make a request for such function. I am making a mod to force show products in all recipes, but now I am stuck because after adding main_product = "", some recipes have different names now. :(

Edit: made it - viewtopic.php?f=28&t=33802 :P

Post Reply

Return to “Implemented Suggestions”