FNEI

by npo6ka

FNEI mod. All recipes for items and usage for them.

Utilities
2 months ago
0.15 - 1.1
267K

g Pyblock Recipes

3 years ago

Searching for items is not working but the recipe is in the system.

What gives?

https://imgur.com/a/bwKukmH

Top image is showing no results for search, middle image shows that the recipe can be manually found and bottom image is the actual recipe. All settings are default and I did not change anything.

Is there a way to fix?

3 years ago

For that specific item, you probably need to search using the name "flask". You can also use Default Search to find it under "glassware"

3 years ago

I'm gonna hijack this conversation as it seems I have a similar issue. Playing SeaBlock with Angel's/Bob's and was trying to look up all "coil" items to show all the items like "Gold sheet coil" or "Iron sheet coil", this didn't work although those are valid items. It seems FNEI is using the internal names not normally available to the user (can be seen in "show-debug-info-in-tooltips" debug setting. The names of the particular items are "angels-roll-gold" and "angels-roll-iron" internally, searching for "roll" instead of "coil" returns the expected results of all the different coils.

Could an option to also search internal names be added?

1 year, 2 months ago

Why does the mod not look for localized name instead?

3 months ago

I guess the following function needs to be integrated into the FNEI mod:

function get_localized_name(name)
    local _localized_name = ''
    if game.item_prototypes[name] then
        _localized_name = game.item_prototypes[name].localised_name
    elseif game.equipment_prototypes[name] then
        _localized_name = game.equipment_prototypes[name].localised_name  
    elseif game.entity_prototypes[name] then
        _localized_name = game.entity_prototypes[name].localised_name
    end

    return  _localized_name
end
2 months ago

Using .localised_name will still return the internal name, and not the localized name, and thus not solve the problem. What you need is the word written in the locale file, which is not so easy to retreive. And that word will change depending on the language the player selected.

Mods like Recipe Book does this already using a dedicated tool that requests all translations for the required internal names when the game starts up.

2 months ago

The Factorio API has been expanded in this direction.
New feature and event for it https://lua-api.factorio.com/latest/classes/LuaPlayer.html#request_translation and https://lua-api.factorio.com/latest/events.html#on_string_translated.
But my test showed an increase in the time it takes to search for a prototype using localased_names. And I discovered a new problem: the tolower function does not work with a localized string. The search in this option is case sensitive.

2 months ago
2 months ago

I might be misunderstanding something, but on_string_translated contains the translated word as a string, which you should be able to lowercase using string:lower(word), no?

I think here RecipeBook takes the returned value from request_translation, takes it to lower case, and sees if it matches the searched word. Not sure though, just poking around in the code.

And also not sure how this will work for languages like Russian like mentioned in that thread though. Maybe you can translate English, but keep other languages case sensitive.

2 months ago
(updated 2 months ago)

Russian character "Б" is not converted to "б" when using str:lower()

2 months ago
(updated 2 months ago)

I tried adding localized search. Need to test it))

New response