ignore = false
input = nil
+ temp_pool = nil
temp_pool2 = nil
+ --if not (pool[pos.x] and pool[pos.x][pos.y] and pool[pos.x][pos.y][pos.z]) then return end
+
temp_pool = pool[pos.x][pos.y][pos.z]
if not temp_pool then ignore = true end
if not mem_map[i.x][i.y] then mem_map[i.x][i.y] = {} end
if not mem_map[i.x][i.y][i.z] then
+
if i and boundary and boundary[i.x] and boundary[i.x][i.y] and boundary[i.x][i.y][i.z] then
index = boundary[i.x][i.y][i.z]
+
if index.dust then
mem_map[i.x][i.y][i.z] = index
mem_map[i.x][i.y][i.z].sniffed = true
elseif index.activator then
mem_map[i.x][i.y][i.z] = index
mem_map[i.x][i.y][i.z].sniffed = true
- end
- --this needs to be hooked into the end
- --because nodes can be directional activators
- --and directional torches
- if index.directional_activator and vec_equals(pos,index.input) then
+ elseif index.directional_activator and vec_equals(pos,index.input) then
mem_map[i.x][i.y][i.z] = index
mem_map[i.x][i.y][i.z].sniffed = true
end
end
end
-
--do torches
for x,datax in pairs(dust_map) do
for y,datay in pairs(datax) do
--print("update")
if data.dust and data.dust ~= data.origin then
swap_node(new_vec(x,y,z),{name="redstone:dust_"..data.dust})
- end
- data_injection(new_vec(x,y,z),data)
-
- if data.dust then
+ data_injection(new_vec(x,y,z),data)
+
--delete the data to speed up next loop
dust_map[x][y][z] = nil
end
for _,nodey in pairs(bad_node) do
minetest.throw_item(pos,nodey)
end
- minetest.dig_node(pos)
+ minetest.remove_node(pos)
data_injection(pos,nil)
redstone.update(pos)
end)
nodenames = {"redstone:dust_"..i},
run_at_every_load = true,
action = function(pos)
- data_injection(pos,{dust=i})
+ data_injection(pos,{dust=i})
end,
})
end
name = "redstone:inverter_on",
deactivate = function(pos)
local param2 = minetest.get_node(pos).param2
- minetest.set_node(pos,{name="redstone:inverter_off",param2=param2})
+ minetest.swap_node(pos,{name="redstone:inverter_off",param2=param2})
local dir = minetest.facedir_to_dir(param2)
redstone.inject(pos,{
name = "redstone:inverter_off",
activate = function(pos)
local param2 = minetest.get_node(pos).param2
- minetest.set_node(pos,{name="redstone:inverter_on",param2=param2})
+ minetest.swap_node(pos,{name="redstone:inverter_on",param2=param2})
local dir = minetest.facedir_to_dir(param2)
redstone.inject(pos,{
name = "redstone:inverter_on",
for i = 1,table.getn(move_index) do
if move_index[i] then
if move_index[i].pos then
- move_index[i].pos = vector.add(move_index[i].pos,dir)
- minetest.set_node(move_index[i].pos,move_index[i])
- minetest.check_for_falling(move_index[i].pos)
+ move_index[i].pos = vector.add(move_index[i].pos,dir)
+ minetest.set_node(move_index[i].pos,move_index[i])
+ minetest.check_for_falling(move_index[i].pos)
end
end
end
name = "redstone:piston_on",
activator = true,
})
- minetest.after(0,function()
- redstone.update(pos)
- end)
+ redstone.update(pos)
end
end
drop = "redstone:piston_off",
paramtype = "light",
sunlight_propagates = true,
- --reverse the direction to face the player
- after_place_node = function(pos, placer, itemstack, pointed_thing)
- local look = placer:get_look_dir()
- look = vector.multiply(look,-1)
- local dir = minetest.dir_to_facedir(look, true)
- minetest.swap_node(pos,{name="redstone:piston_off",param2=dir})
+ --reverse the direction to face the player
+ on_construct = function(pos)
redstone.inject(pos,{
name = "redstone:piston_off",
activator = true,
})
redstone.update(pos)
end,
+ after_place_node = function(pos, placer, itemstack, pointed_thing)
+ local look = placer:get_look_dir()
+ look = vector.multiply(look,-1)
+ local dir = minetest.dir_to_facedir(look, true)
+ minetest.swap_node(pos,{name="redstone:piston_off",param2=dir})
+ end,
after_destruct = function(pos, oldnode)
redstone.inject(pos,nil)
end,
redstone.register_activator({
name = "redstone:piston_off",
activate = function(pos)
- actuator_arm_function(pos)
+ minetest.after(0,function()
+ actuator_arm_function(pos)
+ end)
end
})
name = "redstone:piston_off",
activator = true,
})
+ --redstone needs to warm up
minetest.after(0,function()
redstone.update(pos)
end)
name = "redstone:piston_on",
activator = true,
})
+ --redstone needs to warm up
minetest.after(0,function()
redstone.update(pos)
end)
name = "redstone:sticky_piston_on",
activator = true,
})
- minetest.after(0,function()
- redstone.update(pos)
- end)
+
+ redstone.update(pos)
end
end
drop = "redstone:sticky_piston_off",
paramtype = "light",
sunlight_propagates = true,
+ on_construct = function(pos)
+ redstone.inject(pos,{
+ name = "redstone:sticky_piston_off",
+ activator = true,
+ })
+ redstone.update(pos)
+ end,
--reverse the direction to face the player
after_place_node = function(pos, placer, itemstack, pointed_thing)
local look = placer:get_look_dir()
look = vector.multiply(look,-1)
local dir = minetest.dir_to_facedir(look, true)
minetest.swap_node(pos,{name="redstone:sticky_piston_off",param2=dir})
- redstone.inject(pos,{
- name = "redstone:sticky_piston_off",
- activator = true,
- })
- redstone.update(pos)
end,
after_destruct = function(pos, oldnode)
redstone.inject(pos,nil)
redstone.register_activator({
name = "redstone:sticky_piston_off",
activate = function(pos)
- sticky_actuator_arm_function(pos)
+ minetest.after(0,function()
+ sticky_actuator_arm_function(pos)
+ end)
end
})
name = "redstone:sticky_piston_off",
activator = true,
})
+ --redstone needs to warm up
minetest.after(0,function()
redstone.update(pos)
end)
name = "redstone:sticky_piston_on",
activator = true,
})
+ --redstone needs to warm up
minetest.after(0,function()
redstone.update(pos)
end)