Merge pull request #163 from Zoryn4163/main

Initial update of the LTN GUI for 2.0
This commit is contained in:
Tetlanesh
2024-10-22 21:31:44 +02:00
committed by GitHub
9 changed files with 28 additions and 24 deletions

View File

@@ -40,15 +40,15 @@ function util.generate_item_references(item)
local sprite = nil
local image_path = ""
local item_name
if game.is_valid_sprite_path("item/" .. item) then
if helpers.is_valid_sprite_path("item/" .. item) then
sprite = "item/" .. item
image_path = "[img=item." .. item .. "]"
item_name = {"?", { "item-name." .. item }, { "entity-name." .. item }, "LocalizedString failure: " .. item }
elseif game.is_valid_sprite_path("fluid/" .. item) then
elseif helpers.is_valid_sprite_path("fluid/" .. item) then
sprite = "fluid/" .. item
image_path = "[img=fluid." .. item .. "]"
item_name = {"?", { "fluid-name." .. item }, "LocalizedString failure: " .. item }
elseif game.is_valid_sprite_path("virtual-signal/" .. item) then
elseif helpers.is_valid_sprite_path("virtual-signal/" .. item) then
sprite = "virtual-signal/" .. item
image_path = "[img=virtual-signal." .. item .. "]"
item_name = {"?", { "virtual-signal." .. item }, "LocalizedString failure: " .. item }
@@ -69,7 +69,7 @@ function util.slot_table_build_from_manifest(manifest, color)
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
if helpers.is_valid_sprite_path(sprite) then
children[#children + 1] = {
type = "sprite-button",
enabled = false,
@@ -113,7 +113,7 @@ function util.slot_table_build_from_station(station)
else
color = "red"
end
if game.is_valid_sprite_path(sprite) then
if helpers.is_valid_sprite_path(sprite) then
children[#children + 1] = {
type = "sprite-button",
enabled = false,
@@ -150,7 +150,7 @@ function util.slot_table_build_from_deliveries(station)
else
color = "blue"
end
if game.is_valid_sprite_path(sprite) then
if helpers.is_valid_sprite_path(sprite) then
children[#children + 1] = {
type = "sprite-button",
enabled = false,
@@ -190,7 +190,7 @@ function util.slot_table_build_from_control_signals(station, map_data)
else
sprite = "virtual-signal" .. "/" .. name
end
if game.is_valid_sprite_path(sprite) then
if helpers.is_valid_sprite_path(sprite) then
children[#children + 1] = {
type = "sprite-button",
enabled = false,
@@ -232,7 +232,7 @@ function util.slot_table_build_from_control_signals(station, map_data)
count = count * get_stack_size(map_data, name)
end
if game.is_valid_sprite_path(sprite) then
if helpers.is_valid_sprite_path(sprite) then
children[#children + 1] = {
type = "sprite-button",
enabled = false,
@@ -250,7 +250,7 @@ function util.slot_table_build_from_control_signals(station, map_data)
elseif item.type == "virtual" then
sprite = "virtual-signal" .. "/" .. name
if game.is_valid_sprite_path(sprite) then
if helpers.is_valid_sprite_path(sprite) then
children[#children + 1] = {
type = "sprite-button",
enabled = false,