Identifying Items or Entities Lacking elem_tooltip
Posted: Wed Jan 29, 2025 9:37 pm
Hello everyone,
I am currently working on a script to identify items or entities that cannot have their own elem_tooltip. I have implemented the following code:
So far, this hardcoded solution works, but I am looking for advice on making this function more generic. Ideally, I would like the method to handle entities added by other mods without needing to update the code each time.
Does anyone have suggestions on how to achieve this? Any guidance or tips would be greatly appreciated!
Thank you in advance for your help.
I am currently working on a script to identify items or entities that cannot have their own elem_tooltip. I have implemented the following code:
Code: Select all
local function filter_unknown_prototype_name(prototype_name)
if prototype_name == "elevated-straight-rail"
or prototype_name == "straight-rail"
or prototype_name == "elevated-curved-rail-a"
or prototype_name == "elevated-curved-rail-b"
or prototype_name == "curved-rail-a"
or prototype_name == "curved-rail-b"
or prototype_name == "elevated-half-diagonal-rail"
or prototype_name == "half-diagonal-rail"
then return "rail" end
return prototype_name
end
...
gui.add{
...
elem_tooltip = {
type = 'item-with-quality',
name = filter_unknown_prototype_name(prototype.name),
quality = quality.name,
}
}
Does anyone have suggestions on how to achieve this? Any guidance or tips would be greatly appreciated!
Thank you in advance for your help.