Page 1 of 1

On the matter of display panels...

Posted: Wed Nov 06, 2024 5:21 pm
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.

Re: On the matter of display panels...

Posted: Wed Nov 06, 2024 6:17 pm
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 262 times
11-06-2024, 19-17-16.png
11-06-2024, 19-17-16.png (191.88 KiB) Viewed 262 times

Re: On the matter of display panels...

Posted: Wed Nov 06, 2024 11:49 pm
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.