improvements on door controller and pusher
This commit is contained in:
parent
59a0a3248e
commit
61bbf5ea52
@ -101,6 +101,8 @@ local function pushing(pos, crd, meta, nvm)
|
|||||||
nvm.item_count = nil
|
nvm.item_count = nil
|
||||||
nvm.item_name = nil
|
nvm.item_name = nil
|
||||||
crd.State:stop(pos, nvm)
|
crd.State:stop(pos, nvm)
|
||||||
|
local number = M(pos):get_string("node_number")
|
||||||
|
techage.send_single(number, nvm.rmt_num, "off")
|
||||||
else
|
else
|
||||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||||
end
|
end
|
||||||
@ -218,6 +220,7 @@ local tubing = {
|
|||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
CRD(pos).State:stop(pos, nvm)
|
CRD(pos).State:stop(pos, nvm)
|
||||||
nvm.item_count = math.min(config_item(pos, payload), 12)
|
nvm.item_count = math.min(config_item(pos, payload), 12)
|
||||||
|
nvm.rmt_num = src
|
||||||
CRD(pos).State:start(pos, nvm)
|
CRD(pos).State:start(pos, nvm)
|
||||||
return true
|
return true
|
||||||
elseif topic == "config" then
|
elseif topic == "config" then
|
||||||
|
@ -27,6 +27,7 @@ end
|
|||||||
|
|
||||||
local function store_door_data(pos)
|
local function store_door_data(pos)
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
|
nvm.door_state = false
|
||||||
local numbers = M(pos):get_string("numbers")
|
local numbers = M(pos):get_string("numbers")
|
||||||
nvm.door_blocks = {}
|
nvm.door_blocks = {}
|
||||||
for _,num in ipairs(string.split(numbers, " ")) do
|
for _,num in ipairs(string.split(numbers, " ")) do
|
||||||
@ -40,19 +41,22 @@ end
|
|||||||
|
|
||||||
local function swap_door_nodes(pos, open)
|
local function swap_door_nodes(pos, open)
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
for _,item in ipairs(nvm.door_blocks or {}) do
|
if nvm.door_state ~= open then
|
||||||
if item.pos and item.name and item.param2 then
|
nvm.door_state = open
|
||||||
local node = techage.get_node_lvm(item.pos)
|
for _,item in ipairs(nvm.door_blocks or {}) do
|
||||||
if open then
|
if item.pos and item.name and item.param2 then
|
||||||
if node.name == item.name then
|
local node = techage.get_node_lvm(item.pos)
|
||||||
minetest.remove_node(item.pos)
|
if open then
|
||||||
|
if node.name == item.name then
|
||||||
|
minetest.remove_node(item.pos)
|
||||||
|
else
|
||||||
|
item.name = nil
|
||||||
|
end
|
||||||
|
elseif node.name == "air" then
|
||||||
|
minetest.add_node(item.pos, {name = item.name, param2 = item.param2})
|
||||||
else
|
else
|
||||||
item.name = nil
|
minetest.add_item(pos, item.pos, {name = item.name})
|
||||||
end
|
end
|
||||||
elseif node.name == "air" then
|
|
||||||
minetest.add_node(item.pos, {name = item.name, param2 = item.param2})
|
|
||||||
else
|
|
||||||
minetest.add_item(pos, item.pos, {name = item.name})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user