Page 1 of 1

[NotImplemented] Existence of localisation key

Posted: Wed Oct 05, 2016 2:45 am
by Mooncat
I know it is already inside the engine, please expose it to lua so I can use it in data phase. :P
(Yes, not a usual request. This request is for the data phase, not control phase.)

See this for details about how I know that and why I need that: viewtopic.php?f=66&t=33732

TL;DR Based on "offshore-pump", I know recipe names can be generated based on the sequence: get the localised string of {"recipe-name.<recipe name>"}, if such key is not found -> {"item-name.<product's item name"}, if not found -> {"entity-name.<product place_result's entity-name>"}, if not found -> "unknown key: entity-name...."

I am making a mod which will do the same thing for determining recipe name. Now everything is ready, except I am stuck at "if such key is not found" so that some recipes have wrong names.
(I am doing it in reverse way, i.e. if no recipe.localised_name -> if product has place_result or placed_as_equipment_result, then use entity-name or equipment-name, otherwise, item-name or fluid-name. As the result, recipe.name is always ignored.)

Such API will help me to fix this problem. So, please? :)

Re: API for checking existence of localisation key in data phase

Posted: Wed Oct 05, 2016 10:01 am
by Rseding91
Unfortunately that can't be used as it can lead to desyncs. The existence of a localized key is conditional on the locale you're currently using which is not deterministic across peers/game instances.

So, while on English you might have a given locale key but then in German when someone loads up they don't and you end up with different prototypes.

Re: API for checking existence of localisation key in data phase

Posted: Wed Oct 05, 2016 3:42 pm
by Mooncat
Rseding91 wrote:Unfortunately that can't be used as it can lead to desyncs. The existence of a localized key is conditional on the locale you're currently using which is not deterministic across peers/game instances.

So, while on English you might have a given locale key but then in German when someone loads up they don't and you end up with different prototypes.
awwwwwww.... you are right... :(
Nvm, I will make request for another thing. It would be doable I guess. :mrgreen:

Edit: tada - viewtopic.php?f=28&t=33823