On the matter of display panels...

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
BinkanSalaryman
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Nov 03, 2024 6:17 pm
Contact:

On the matter of display panels...

Post by BinkanSalaryman »

Creating display panels from code is a bit cumbersome right now:

Code: Select all

local display_panel = surface.create_entity{
	name = "display-panel",
	position = {-2, -3},
	force = player.force
}

display_panel.get_or_create_control_behavior().set_message(1, {
	icon = { type = "item", name = "coal" },
	text = "Test",
	condition = {
		fulfilled = true, -- not sure why this does nothing
		first_signal = {type="item", name="raw-fish"},
		comparator = "=",
		second_signal = {type="item", name="raw-fish"}
	}
})

-- workaround: since the display panel doesn't show anything, connect it to a circuit network, and disconnect it immediately after, to give it an update
local a = some_other_required_entity_with_circuit_connection_ability.get_wire_connector(defines.wire_connector_id.circuit_red, true)
local b = display_panel.get_wire_connector(defines.wire_connector_id.circuit_red, false)
a.connect_to(b, false, defines.wire_origin.script)
a.disconnect_from(b) -- not really necessary since wire_origin.script disables drawing the wire already
Therefore I kindly request that display panels can be updated to show their message from code instead of the workaround, or possibly already do it without a call to an update function. It seems there is no way to set "Always show" and "Show in chart" flags in the api, so add that aswell, please. Finally, "Always show" is a bit counter-intuitive since alt-mode needs to be enabled for it to work. So I would suggest either making alt-mode toggleable by code, or really "always show" the first line, if the flag is enabled.
BinkanSalaryman
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Nov 03, 2024 6:17 pm
Contact:

Re: On the matter of display panels...

Post by BinkanSalaryman »

Unrelated to the lua api, but this occurrance is rather annoying:
11-06-2024, 19-16-29.png
11-06-2024, 19-16-29.png (97.18 KiB) Viewed 263 times
11-06-2024, 19-17-16.png
11-06-2024, 19-17-16.png (191.88 KiB) Viewed 263 times
curiosity
Filter Inserter
Filter Inserter
Posts: 476
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: On the matter of display panels...

Post by curiosity »

BinkanSalaryman wrote: Wed Nov 06, 2024 6:17 pm Unrelated to the lua api, but this occurrance is rather annoying:

11-06-2024, 19-16-29.png
11-06-2024, 19-17-16.png
This belongs in bugs, not here. You should have reported it there if you want it fixed.
Post Reply

Return to “Modding interface requests”