mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-14 02:12:42 -06:00
Merge branch 'make-gui-work' into gui-trains-tab
This commit is contained in:
@@ -96,14 +96,24 @@ function inventory_tab.build(map_data, player_data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if search_item then
|
if search_item then
|
||||||
if not station.deliveries then
|
if station.deliveries then
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
for item_name, _ in pairs(station.deliveries) do
|
for item_name, _ in pairs(station.deliveries) do
|
||||||
if item_name == search_item then
|
if item_name == search_item then
|
||||||
goto has_match
|
goto has_match
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
local comb1_signals, _ = get_signals(station)
|
||||||
|
if comb1_signals then
|
||||||
|
for _, signal_ID in pairs(comb1_signals) do
|
||||||
|
local item = signal_ID.signal.name
|
||||||
|
if item then
|
||||||
|
if string.match(item, search_item) then
|
||||||
|
goto has_match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
goto continue
|
goto continue
|
||||||
::has_match::
|
::has_match::
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -69,14 +69,14 @@ function manager.create(player)
|
|||||||
clear_and_focus_on_right_click = true,
|
clear_and_focus_on_right_click = true,
|
||||||
handler = manager.handle.manager_update_text_search, --on_gui_text_changed
|
handler = manager.handle.manager_update_text_search, --on_gui_text_changed
|
||||||
},
|
},
|
||||||
-- item search box commented out. It *works*, but, the filtering logic only checks delivieres, so I'm not sure what Mami intended it for, so I'm leaving it off for now...
|
--item search box commented out. It *works*, but, the filtering logic only checks delivieres, so I'm not sure what Mami intended it for, so I'm leaving it off for now...
|
||||||
--{ type = "label", style = "subheader_caption_label", caption = { "cybersyn-gui.search-item-label" } },
|
{ type = "label", style = "subheader_caption_label", caption = { "cybersyn-gui.search-item-label" } },
|
||||||
--{
|
{
|
||||||
-- name = "manager_item_search_field",
|
name = "manager_item_search_field",
|
||||||
-- type = "textfield",
|
type = "textfield",
|
||||||
-- clear_and_focus_on_right_click = true,
|
clear_and_focus_on_right_click = true,
|
||||||
-- handler = manager.handle.manager_update_item_search, --on_gui_text_changed
|
handler = manager.handle.manager_update_item_search, --on_gui_text_changed
|
||||||
--},
|
},
|
||||||
{ type = "empty-widget", style = "flib_horizontal_pusher" },
|
{ type = "empty-widget", style = "flib_horizontal_pusher" },
|
||||||
{ type = "label", style = "caption_label", caption = { "cybersyn-gui.network-name-label" } },
|
{ type = "label", style = "caption_label", caption = { "cybersyn-gui.network-name-label" } },
|
||||||
{ type= "choose-elem-button", name="network", style="slot_button_in_shallow_frame", elem_type="signal", tooltip={"cybersyn-gui.network-tooltip"}, handler=manager.handle.manager_update_network_name, },
|
{ type= "choose-elem-button", name="network", style="slot_button_in_shallow_frame", elem_type="signal", tooltip={"cybersyn-gui.network-tooltip"}, handler=manager.handle.manager_update_network_name, },
|
||||||
@@ -276,7 +276,7 @@ end
|
|||||||
--- @param refs table<string, LuaGuiElement>
|
--- @param refs table<string, LuaGuiElement>
|
||||||
--- @param e GuiEventData
|
--- @param e GuiEventData
|
||||||
function manager.handle.manager_update_item_search(player, player_data, refs, e)
|
function manager.handle.manager_update_item_search(player, player_data, refs, e)
|
||||||
local query = e.text
|
local query = e.element.text
|
||||||
if query then
|
if query then
|
||||||
-- Input sanitization
|
-- Input sanitization
|
||||||
for pattern, replacement in pairs(constants.input_sanitizers) do
|
for pattern, replacement in pairs(constants.input_sanitizers) do
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ function stations_tab.build(map_data, player_data, query_limit)
|
|||||||
if search_network_name ~= station.network_name then
|
if search_network_name ~= station.network_name then
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
::has_match::
|
|
||||||
local train_flag = get_network_flag(station, station.network_name)
|
local train_flag = get_network_flag(station, station.network_name)
|
||||||
if not bit32.btest(search_network_mask, train_flag) then
|
if not bit32.btest(search_network_mask, train_flag) then
|
||||||
goto continue
|
goto continue
|
||||||
@@ -124,14 +123,24 @@ function stations_tab.build(map_data, player_data, query_limit)
|
|||||||
|
|
||||||
|
|
||||||
if search_item then
|
if search_item then
|
||||||
if not station.deliveries then
|
if station.deliveries then
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
for item_name, _ in pairs(station.deliveries) do
|
for item_name, _ in pairs(station.deliveries) do
|
||||||
if item_name == search_item then
|
if item_name == search_item then
|
||||||
goto has_match
|
goto has_match
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
local comb1_signals, _ = get_signals(station)
|
||||||
|
if comb1_signals then
|
||||||
|
for _, signal_ID in pairs(comb1_signals) do
|
||||||
|
local item = signal_ID.signal.name
|
||||||
|
if item then
|
||||||
|
if string.match(item, search_item) then
|
||||||
|
goto has_match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
goto continue
|
goto continue
|
||||||
::has_match::
|
::has_match::
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user