Strange formatting of recipe description

Place to get help with not working mods / modding interface.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1759
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Strange formatting of recipe description

Post by Pi-C »

I've a strange case of formatting for one of the recipes in Bio Industries when Factorio is used with the English localization. These are the strings:

Code: Select all

[item-name]
fertiliser=Common fertilizer

[recipe-name]
bi-biomass-1=Produce Algae biomass using __ITEM__fertiliser__
bi-biomass-2=Replicate Algae biomass

[recipe-description]
bi-biomass-1=Prime your Algae biomass production with __ITEM__fertiliser__!
bi-biomass-2=Feed back some of the produced Algae biomass to produce more of it!\nNote: This will yield less (and take longer) than using the start-up recipe, but you will save on __ITEM__fertiliser__.
This is what it looks like in the game:
bi-biomass_en.png
bi-biomass_en.png (156.33 KiB) Viewed 789 times
There's obviously something wrong with the recipe on the left side. As far as I can see, this is the only recipe where that happens, and it doesn't occur with the German or the Russian localization. I suspected that using " __ITEM__fertiliser__" at the end of the name of the first recipe would be the reason why the heading extends so far to the right and throws everything off. But replacing this with the actual text "Common fertiziler" doesn't change anything. However, if I use something else than "__ITEM_fertiliser__" or "Common fertiliser", the formatting is as expected:
bi-biomass-test.png
bi-biomass-test.png (77.88 KiB) Viewed 789 times
So, why isn't there a line break in the heading of the first example, and why doesn't the box with the recipe data align with the box for the heading?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Strange formatting of recipe description

Post by Deadlock989 »

I haven't encountered this exact same issue. In the past (before the 0.18 GUI update) I had some other issues with tooltips being too narrow. At one point I was even overriding the minimum width of the tooltip style. I haven't had any issues like that since 0.18 though. I have also observed that overly long recipe names don't ever look good and tried to cut them down where possible.

I think your guess is probably a good one, that the way the field derives width doesn't/can't compensate perfectly in all situations for the double-underscore "parameter strings" or whatever they are called. Your findings are explained when you have them both in the recipe name and the description, the line lengths are dynamic from locale in both cases so the results aren't always ideal.

To be blunt though - that description (for the Produce recipe, not the Replicate one) says nothing that the recipe name doesn't also say. Do you even need it?
Pi-C
Smart Inserter
Smart Inserter
Posts: 1759
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Strange formatting of recipe description

Post by Pi-C »

Deadlock989 wrote: Thu Nov 26, 2020 1:29 pm I haven't encountered this exact same issue. In the past (before the 0.18 GUI update) I had some other issues with tooltips being too narrow. At one point I was even overriding the minimum width of the tooltip style. I haven't had any issues like that since 0.18 though. I have also observed that overly long recipe names don't ever look good and tried to cut them down where possible.

I think your guess is probably a good one, that the way the field derives width doesn't/can't compensate perfectly in all situations for the double-underscore "parameter strings" or whatever they are called.
I've also tried it with spelling out the text that would replace the parameter string. It didn't work either, so it's probably not that auto-inserted text gets non-breakable spaces.
Your findings are explained when you have them both in the recipe name and the description, the line lengths are dynamic from locale in both cases so the results aren't always ideal.
Perhaps I should remove the last part ("with Common fertiliser").
To be blunt though - that description (for the Produce recipe, not the Replicate one) says nothing that the recipe name doesn't also say. Do you even need it?
You've got to see it in context: There are three recipes for Algae biomass. The first one is just about combining fertilizer and water. The others replace the fertilizer with liquid air (recipe 2) or liquid air + ash (recipe 3) and feed back some of the algae biomass into the process. They can't be used unless some biomass already exists. So the whole point of that description was to make people aware that recipe 1 will always be available (the "prime" also indicates that they'll always have to start with this recipe), but will be more expensive (it's harder to set up the fertilizer production than plopping down a chemical plant that produces liquid air without any ingredients). Perhaps that was too subtle. :-D
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Modding help”