[1.1.94] Visual inconsistency when layering icons on equipment
Posted: Fri Nov 17, 2023 9:59 pm
In my mod, I add overlays to various icons, including personal equipment.
The icons look OK when viewed on the armor equipment grid, but are completely off when hovering over the armor, which also shows the equipment grid.
This is the code I have used to layer the icon:
The "quality.icon" image is 32x32.
The icons look OK when viewed on the armor equipment grid, but are completely off when hovering over the armor, which also shows the equipment grid.
This is the code I have used to layer the icon:
Code: Select all
if string.find(new_p.type, "-equipment") and new_p.sprite then
if not new_p.sprite.layers then
new_p.sprite.layers = { table.deepcopy(new_p.sprite) }
end
local layer = new_p.sprite.layers[1]
table.insert(
new_p.sprite.layers,
{
filename = quality.icon, height = 32, width = 32, scale = 0.5,
shift = { -(layer.size or layer.width) / 2, (layer.size or layer.height) / 2 }
}
)
end