when using icon_scale & shift and that pushes the icons out of the frame, it shows up weird in Rich Text.
- 10-18-2024, 18-48-35.png (11.68 KiB) Viewed 710 times
- 10-18-2024, 18-48-51.png (8.04 KiB) Viewed 710 times
- 10-18-2024, 18-49-11.png (27.38 KiB) Viewed 710 times
Code
Code: Select all
local function makeCastingIcons(item, iconType)
local icons = {}
if item.icons == nil then
icons = {
{
icon = modName .. "/graphics/64x64-empty.png"
},
{
icon = item.icon,
icon_size = item.icon_size,
scale = (0.5 * defaultIconSizeDefine / (item.icon_size or defaultIconSizeDefine)) * 0.8125,
shift = { 0, 20 / 2 },
draw_background = true
},
{
icon = spaceAge .. "/graphics/icons/fluid/molten-" .. iconType .. ".png",
icon_size = 64,
scale = (0.5 * defines.default_icon_size / 64) * 0.8125,
shift = { 19 / 2, -2 / 2 },
draw_background = true
}
}
else
icons = {
{
icon = modName .. "/graphics/64x64-empty.png"
}
}
for i = 1, #item.icons do
local icon = table.deepcopy(item.icons[i])
icon.scale = ((icon.scale == nil) and (0.5 * defaultIconSizeDefine / (icon.icon_size or defaultIconSizeDefine)) or icon.scale) * 0.8125
icon.shift = util.mul_shift(icon.shift, 0.8125)
if icon.shift then
icon.shift = { icon.shift[1], icon.shift[2] + (20 / 2) }
else
icon.shift = { 0, 20 / 2 }
end
icons[#icons + 1] = icon
end
icons[#icons + 1] = {
icon = spaceAge .. "/graphics/icons/fluid/molten-" .. iconType .. ".png",
icon_size = 64,
scale = (0.5 * defines.default_icon_size / 64) * 0.8125,
shift = { 19 / 2, -2 / 2 },
draw_background = true
}
end
return icons
end