Am i right and is it possible in lua? Or am i doing it wrong. please help, I hate using hardcoded magic numbers.

BTW isnt here something like Modders irc where i could ask about simple problem like this and dont spam forum?
That would require people to regularly log into something, something I find relatively rare, even when the whole process can be automated.Kexík wrote:BTW isnt here something like Modders irc where i could ask about simple problem like this and dont spam forum?
Me too.Kexík wrote: I hate using hardcoded magic numbers.
What drs9999 sais is.......Kexík wrote:Hmm thanks, about that workaround, you mean like, when prototypes are loaded i will save their base_area for example like myTable[prototype.name] = prototype.liquid_box.base_area (with all necessary checks of course), but where can i do it? Do you have any example or link where is mentioned how to do it?
Code: Select all
for k,tank pairs(data.raw["storage-tank"]) do
data:extend(
{
{
type = "item",
name = "fluid-"..tank.name,
icon = "__mod__/graphics/generic.png",
flags = {"goes-to-main-inventory"},
fuel_value = v.fluid_box.base_area.."J",
subgroup = "a",
order = "a",
stack_size = 1
},
}
)
end
Yes, you have to create the items in data.lua. It's like you said prototypes are read-only once loading is done.Kexík wrote:Oh cool, thanks.
One question I have to use this in data.lua? Or can i use it in control.lua because i though that data is not modifiable in scripts?
I hate this, i have like 1300 items and 400 entities for this... with only an mining-tool.speed editable i can save above 300 itemsdrs9999 wrote:Yes, you have to create the items in data.lua. It's like you said prototypes are read-only once loading is done.
Can add dependencies like scrapmod, and i think don't need the versionKexík wrote:Thanks,
i will use it, but i guess it will not work with others mod like i hoped. When my mod will be loaded before another, i will have no other oprion then use magic number because meta-item will not exist
yep, is optional dependency.Kexík wrote:Oh, if dependenci have ? before name it mean i dont have to have it, but if i have it will load it before my?
Code: Select all
data:extend(
{
{
type = "item-group",
name = "nombre",
order = "a",
inventory_order = "z",
icon="__icon-mod__/icons/icon/reicon/iconicon/icon.png"
}
}
)