Add description to vlayer combinator (#382)

* Update vlayer.lua

* Update vlayer.lua

* Update vlayer.lua

* Use rich text for description

---------

Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
This commit is contained in:
2025-04-06 23:37:53 +09:00
committed by GitHub
parent e200533c6c
commit d5b889146b

View File

@@ -333,6 +333,7 @@ end
-- @treturn LuaEntity The entity that was created for the interface -- @treturn LuaEntity The entity that was created for the interface
function vlayer.create_input_interface(surface, position, circuit, last_user) function vlayer.create_input_interface(surface, position, circuit, last_user)
local interface = surface.create_entity{ name = "storage-chest", position = position, force = "neutral" } local interface = surface.create_entity{ name = "storage-chest", position = position, force = "neutral" }
interface.storage_filter = { name = "deconstruction-planner", quality = "normal" }
table.insert(vlayer_data.entity_interfaces.storage_input, interface) table.insert(vlayer_data.entity_interfaces.storage_input, interface)
if last_user then if last_user then
@@ -541,6 +542,12 @@ function vlayer.get_circuits()
} }
end end
local vlayer_circuits_string = ""
for key, value in pairs(vlayer.get_circuits()) do
vlayer_circuits_string = vlayer_circuits_string .. string.format("[virtual-signal=%s] = %s\n", value, key:gsub("_", " "))
end
--- Create a new circuit interface --- Create a new circuit interface
-- @tparam LuaSurface surface The surface to place the interface onto -- @tparam LuaSurface surface The surface to place the interface onto
-- @tparam MapPosition position The position on the surface to place the interface at -- @tparam MapPosition position The position on the surface to place the interface at
@@ -577,7 +584,11 @@ local function handle_circuit_interfaces()
if not interface.valid then if not interface.valid then
vlayer_data.entity_interfaces.circuit[index] = nil vlayer_data.entity_interfaces.circuit[index] = nil
else else
local circuit_oc = interface.get_or_create_control_behavior().sections[1] local circuit_oc = interface.get_or_create_control_behavior()
if circuit_oc.sections_count == 0 then
circuit_oc.add_section()
end
circuit_oc = circuit_oc.sections[1]
local signal_index = 1 local signal_index = 1
local circuit = vlayer.get_circuits() local circuit = vlayer.get_circuits()
@@ -610,6 +621,8 @@ local function handle_circuit_interfaces()
circuit_oc.clear_slot(clear_index) circuit_oc.clear_slot(clear_index)
end end
interface.combinator_description = vlayer_circuits_string
end end
end end
end end