forked from mtcontrib/pipeworks
fix facedir getting reset in detector tubes on state change
This commit is contained in:
parent
5f393d0545
commit
ea32144950
12
tubes.lua
12
tubes.lua
@ -359,9 +359,11 @@ if pipeworks.enable_detector_tube then
|
|||||||
item_exit = function(pos)
|
item_exit = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local nitems = meta:get_int("nitems")-1
|
local nitems = meta:get_int("nitems")-1
|
||||||
local name = minetest.get_node(pos).name
|
local node = minetest.get_node(pos)
|
||||||
|
local name = node.name
|
||||||
|
local fdir = node.param2
|
||||||
if nitems == 0 then
|
if nitems == 0 then
|
||||||
minetest.set_node(pos,{name = string.gsub(name, "on", "off")})
|
minetest.set_node(pos, {name = string.gsub(name, "on", "off"), param2 = fdir})
|
||||||
mesecon:receptor_off(pos, pipeworks.mesecons_rules)
|
mesecon:receptor_off(pos, pipeworks.mesecons_rules)
|
||||||
else
|
else
|
||||||
meta:set_int("nitems", nitems)
|
meta:set_int("nitems", nitems)
|
||||||
@ -376,8 +378,10 @@ if pipeworks.enable_detector_tube then
|
|||||||
pipeworks.register_tube("pipeworks:detector_tube_off", "Detector tube segment", detector_plain_textures, noctr_textures,
|
pipeworks.register_tube("pipeworks:detector_tube_off", "Detector tube segment", detector_plain_textures, noctr_textures,
|
||||||
end_textures, short_texture, detector_inv_texture,
|
end_textures, short_texture, detector_inv_texture,
|
||||||
{tube = {can_go = function(pos, node, velocity, stack)
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
local name = minetest.get_node(pos).name
|
local node = minetest.get_node(pos)
|
||||||
minetest.set_node(pos,{name = string.gsub(name, "off", "on")})
|
local name = node.name
|
||||||
|
local fdir = node.param2
|
||||||
|
minetest.set_node(pos,{name = string.gsub(name, "off", "on"), param2 = fdir})
|
||||||
mesecon:receptor_on(pos, pipeworks.mesecons_rules)
|
mesecon:receptor_on(pos, pipeworks.mesecons_rules)
|
||||||
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
|
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
|
||||||
end},
|
end},
|
||||||
|
Loading…
Reference in New Issue
Block a user