Trains tab initial testing

This commit is contained in:
Will Berry
2023-03-09 16:45:14 -05:00
parent 118f8c9eb2
commit fd3d62ea9d
4 changed files with 122 additions and 79 deletions

View File

@@ -64,27 +64,26 @@ end
function util.slot_table_build_from_manifest(manifest, color)
---@type GuiElemDef[]
local children = {}
for _, item in pairs(manifest) do
local name = item.name
local sprite
if item.type then
sprite = item.type .. "/" .. name
else
sprite = string.gsub(name, ",", "/")
end
if game.is_valid_sprite_path(sprite) then
children[#children + 1] = {
type = "sprite-button",
enabled = false,
style = "ltnm_small_slot_button_" .. color,
sprite = sprite,
tooltip = {
"",
"[img=" .. sprite .. "]",
{ "item-name." .. name },
"\n"..format.number(count),
},
}
if manifest then
for _, item in pairs(manifest) do
local name = item.name
local count = item.count
local sprite, img_path, item_string = util.generate_item_references(name)
if game.is_valid_sprite_path(sprite) then
children[#children + 1] = {
type = "sprite-button",
enabled = false,
style = "ltnm_small_slot_button_" .. color,
sprite = sprite,
number = count,
tooltip = {
"",
img_path,
{ item_string },
"\n"..format.number(count),
},
}
end
end
end
return children