[Solved] Item localized desc with startup setting variable
Posted: Mon Oct 05, 2020 11:42 pm
I'm trying to put a startup setting in as a variable in my item description. This works fine in the control stage, but I'm not getting it to work in the data stage. The settings tutorial page seems to indicate it can be done (as do other posts) but I be dumb. This is literally the first example from the wiki. Does this not work for localization settings at data stage? Settings is the first stage right?
From Wiki:
I have the following in my locale.cfg (ellipsis mine):
The variable to populate the __1__ is a startup setting defined as follows. The setting works fine in the control stage - does what it's supposed to:
My settings.lua:
I tried a couple things. In data.lua I have the following. I tried it in data-final-fixes.lua as well, but neither are working. The description just shows up with the __1__ in it. No errors are returned.
My data.lua:
Please advise and thank you.
From Wiki:
Code: Select all
--in settings.lua:
data:extend({
{
type = "int-setting",
name = "my-mod-stone-wall-stack-size",
setting_type = "startup",
minimum_value = 1,
default_value = 100
}
})
--in data.lua:
data.raw.item["stone-wall"].stack_size = settings.startup["my-mod-stone-wall-stack-size"].value
Code: Select all
[item-description]
k2cp-city=...They can also only be placed within __1__ tiles of each...
My settings.lua:
Code: Select all
data:extend({
{
type = "int-setting",
name = "k2cp-city-distance",
setting_type = "startup",
admin = true,
default_value = 320,
minimum_value = 32,
order = "c"
},
My data.lua:
Code: Select all
require("prototypes.entities")
require("prototypes.items")
require("prototypes.recipes")
require("prototypes.style")
require("prototypes.technology")
data.raw.item["k2cp-city"].localized_description = {"item-description.k2cp-city", settings.startup["k2cp-city-distance"].value}