Attach new machines and cables to touched networks
This commit is contained in:
17
cables.lua
17
cables.lua
@@ -15,6 +15,20 @@
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
local S=minetest.get_translator("industrialtest")
|
||||
local cable={}
|
||||
|
||||
cable.onConstruct=function(pos)
|
||||
local connections=industrialtest.api.getConnections(pos)
|
||||
for _,conn in ipairs(connections) do
|
||||
local meta=minetest.get_meta(conn)
|
||||
local networks=industrialtest.api.isAttachedToNetwork(meta)
|
||||
if networks then
|
||||
for _,network in ipairs(networks) do
|
||||
industrialtest.api.createNetworkMapForNode(network)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function registerCable(name,displayName,size,flow,registerInsulated)
|
||||
local definition={
|
||||
@@ -88,7 +102,8 @@ local function registerCable(name,displayName,size,flow,registerInsulated)
|
||||
"group:_industrialtest_hasPowerInput",
|
||||
"group:_industrialtest_hasPowerOutput",
|
||||
"group:_industrialtest_cable"
|
||||
}
|
||||
},
|
||||
on_construct=cable.onConstruct
|
||||
}
|
||||
if industrialtest.mtgAvailable then
|
||||
definition.groups={
|
||||
|
||||
Reference in New Issue
Block a user