local minetest,vector = minetest,vector
-
---add in smoke and fire
-local function create_ps(pos)
- local dir = get_offset(minetest.get_node(pos).param2)
- local ppos = vector.add(dir,pos)
- local meta = minetest.get_meta(pos)
- local psf = minetest.add_particlespawner({
- amount = 2,
- time = 0,
- minpos = ppos,
- maxpos = ppos,
- minvel = vector.new(0,0,0),
- maxvel = vector.new(0,0,0),
- minacc = {x=0, y=0, z=0},
- maxacc = {x=0, y=0, z=0},
- minexptime = 1,
- maxexptime = 1,
- minsize = 3,
- maxsize = 3,
- collisiondetection = false,
- vertical = true,
- texture = "redstone_torch_animated.png",
- animation = {type = "vertical_frames",
-
- aspect_w = 16,
- -- Width of a frame in pixels
-
- aspect_h = 16,
- -- Height of a frame in pixels
-
- length = 0.2,
- -- Full loop length
- },
- })
- local pss = minetest.add_particlespawner({
- amount = 2,
- time = 0,
- minpos = ppos,
- maxpos = ppos,
- minvel = vector.new(-0.1,0.1,-0.1),
- maxvel = vector.new(0.1,0.3,0.1),
- minacc = vector.new(0,0,0),
- maxacc = vector.new(0,0,0),
- minexptime = 1,
- maxexptime = 2,
- minsize = 1,
- maxsize = 2,
- collisiondetection = false,
- vertical = false,
- texture = "smoke.png",
- })
- meta:set_int("psf", psf)
- meta:set_int("pss", pss)
-end
-
-- Item definitions
minetest.register_craftitem("redstone:torch", {
description = "Redstone Torch",
},
on_construct = function(pos)
- redstone.collect_info(pos)
+ redstone.inject(pos,{torch=9})
+ redstone.update(pos)
end,
after_destruct = function(pos, oldnode)
- redstone.collect_info(pos)
+ redstone.inject(pos,nil)
+ redstone.update(pos)
end,
sounds = main.woodSound(),
})
wall_bottom = {-0.1, -0.5, -0.1, 0.1, 0.1, 0.1},
wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1},
},
- on_construct = function(pos)
- redstone.collect_info(pos)
+ on_construct = function(pos)
+ redstone.inject(pos,{torch=9})
+ redstone.update(pos)
end,
after_destruct = function(pos, oldnode)
- redstone.collect_info(pos)
+ redstone.inject(pos,nil)
+ redstone.update(pos)
end,
sounds = main.woodSound(),
})
+
+minetest.register_lbm({
+ name = "redstone:torch_init",
+ nodenames = {"redstone:torch_wall","redstone:torch_floor"},
+ run_at_every_load = true,
+ action = function(pos)
+ redstone.inject(pos,{torch=9})
+ end,
+})
\ No newline at end of file