I have a research that adds turret range upgrades, but to do this it has to effectively clone turrets once per turret type, once per level.
This all works fine, but the problem is that the upgraded turrets (internally named [original name]-rangeboost-[level]") have no corresponding localization. As I cannot foresee all the possible turret types, nor am I willing to hardcode 800 entries for the ones I do know (Bob, 5Dim, DyTech, my Concussion, Plasma, and Cannon...), is there a way to either forcibly set a localized name (English only is fine, as it is still better than "unknown key:blah") or automatically populate the locale files? Ideally I would want the derivative turrets to appear exactly as their base counterparts.
Automatically generating localized names
Re: Automatically generating localized names
In locale.cfg
in data*.lua
Code: Select all
[turrets]
upgrade=__1__ range_boost __2__
Code: Select all
myturret.localised_name = {"turrets.upgrade", {"entity-name."..turret_name_from_loop}, level}
Re: Automatically generating localized names
What will that parse into?Nexela wrote:In locale.cfgin data*.luaCode: Select all
[turrets] upgrade=__1__ range_boost __2__
Code: Select all
myturret.localised_name = {"turrets.upgrade", {"entity-name."..turret_name_from_loop}, level}
- nucleargen
- Long Handed Inserter
- Posts: 64
- Joined: Sat May 07, 2016 4:51 pm
- Contact:
Re: Automatically generating localized names
%turret_name% range_boost %level%
%turret_name% = {"entity-name."..turret_name_from_loop} - entity name from your data loop.
__1__ and __2__ are placeholders.
%turret_name% = {"entity-name."..turret_name_from_loop} - entity name from your data loop.
__1__ and __2__ are placeholders.
The brightest future in the center of a nuclear explosion...2003©nucleargen
Re: Automatically generating localized names
Code: Select all
myturret.localised_name = -- Set the localized name for this prototype
{ --in most places if something takes a string you can use {} brackets to tell it to look for an entry in the locale table
"turrets.upgrade", --use the localization "turrets.upgradge"
{"entity-name."..turret_name_from_loop}, --use the localization for "entity-name.turrent-name" as the first placeholder value
level -- use the variable level for the third argument.
}