mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
vlayer auto connect circuit (#291)
* Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua * Update vlayer.lua
This commit is contained in:
@@ -269,7 +269,7 @@ end
|
||||
-- @tparam MapPosition position The position on the surface to place the interface at
|
||||
-- @tparam[opt] LuaPlayer player The player to show as the last user of the interface
|
||||
-- @treturn LuaEntity The entity that was created for the interface
|
||||
function vlayer.create_input_interface(surface, position, last_user)
|
||||
function vlayer.create_input_interface(surface, position, circuit, last_user)
|
||||
local interface = surface.create_entity{name='logistic-chest-storage', position=position, force='neutral'}
|
||||
table.insert(vlayer_data.entity_interfaces.storage_input, interface)
|
||||
|
||||
@@ -277,6 +277,14 @@ function vlayer.create_input_interface(surface, position, last_user)
|
||||
interface.last_user = last_user
|
||||
end
|
||||
|
||||
if circuit then
|
||||
for k, _ in pairs(circuit) do
|
||||
for _, v in pairs(circuit[k]) do
|
||||
interface.connect_neighbour({wire=defines.wire_type[k], target_entity=v})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
interface.destructible = false
|
||||
interface.minable = false
|
||||
interface.operable = true
|
||||
@@ -318,7 +326,7 @@ end
|
||||
-- @tparam MapPosition position The position on the surface to place the interface at
|
||||
-- @tparam[opt] LuaPlayer player The player to show as the last user of the interface
|
||||
-- @treturn LuaEntity The entity that was created for the interface
|
||||
function vlayer.create_output_interface(surface, position, last_user)
|
||||
function vlayer.create_output_interface(surface, position, circuit, last_user)
|
||||
local interface = surface.create_entity{name='logistic-chest-requester', position=position, force='neutral'}
|
||||
table.insert(vlayer_data.entity_interfaces.storage_output, interface)
|
||||
|
||||
@@ -326,6 +334,14 @@ function vlayer.create_output_interface(surface, position, last_user)
|
||||
interface.last_user = last_user
|
||||
end
|
||||
|
||||
if circuit then
|
||||
for k, _ in pairs(circuit) do
|
||||
for _, v in pairs(circuit[k]) do
|
||||
interface.connect_neighbour({wire=defines.wire_type[k], target_entity=v})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
interface.destructible = false
|
||||
interface.minable = false
|
||||
interface.operable = true
|
||||
@@ -432,7 +448,7 @@ end
|
||||
-- @tparam MapPosition position The position on the surface to place the interface at
|
||||
-- @tparam[opt] LuaPlayer player The player to show as the last user of the interface
|
||||
-- @treturn LuaEntity The entity that was created for the interface
|
||||
function vlayer.create_circuit_interface(surface, position, last_user)
|
||||
function vlayer.create_circuit_interface(surface, position, circuit, last_user)
|
||||
local interface = surface.create_entity{name='constant-combinator', position=position, force='neutral'}
|
||||
table.insert(vlayer_data.entity_interfaces.circuit, interface)
|
||||
|
||||
@@ -440,6 +456,14 @@ function vlayer.create_circuit_interface(surface, position, last_user)
|
||||
interface.last_user = last_user
|
||||
end
|
||||
|
||||
if circuit then
|
||||
for k, _ in pairs(circuit) do
|
||||
for _, v in pairs(circuit[k]) do
|
||||
interface.connect_neighbour({wire=defines.wire_type[k], target_entity=v})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
interface.destructible = false
|
||||
interface.minable = false
|
||||
interface.operable = true
|
||||
|
||||
Reference in New Issue
Block a user