1 local minetest,vector = minetest,vector
4 --add in smoke and fire
5 local function create_ps(pos)
6 local dir = get_offset(minetest.get_node(pos).param2)
7 local ppos = vector.add(dir,pos)
8 local meta = minetest.get_meta(pos)
9 local psf = minetest.add_particlespawner({
14 minvel = vector.new(0,0,0),
15 maxvel = vector.new(0,0,0),
16 minacc = {x=0, y=0, z=0},
17 maxacc = {x=0, y=0, z=0},
22 collisiondetection = false,
24 texture = "redstone_torch_animated.png",
25 animation = {type = "vertical_frames",
28 -- Width of a frame in pixels
31 -- Height of a frame in pixels
37 local pss = minetest.add_particlespawner({
42 minvel = vector.new(-0.1,0.1,-0.1),
43 maxvel = vector.new(0.1,0.3,0.1),
44 minacc = vector.new(0,0,0),
45 maxacc = vector.new(0,0,0),
50 collisiondetection = false,
52 texture = "smoke.png",
54 meta:set_int("psf", psf)
55 meta:set_int("pss", pss)
59 minetest.register_craftitem("redstone:torch", {
60 description = "Redstone Torch",
61 inventory_image = "redstone_torch.png",
62 wield_image = "redstone_torch.png",
63 wield_scale = {x = 1, y = 1, z = 1 + 1/16},
64 liquids_pointable = false,
66 on_place = function(itemstack, placer, pointed_thing)
67 if pointed_thing.type ~= "node" then
71 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
73 local fakestack = itemstack
78 retval = fakestack:set_name("redstone:torch_floor")
80 retval = fakestack:set_name("redstone:torch_wall")
85 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
86 itemstack:set_name("redstone:torch")
89 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
96 minetest.register_node("redstone:torch_floor", {
97 inventory_image = "redstone_torch.png",
98 wield_image = "redstone_torch.png",
99 wield_scale = {x = 1, y = 1, z = 1 + 2/16},
101 mesh = "torch_floor.obj",
102 tiles = {"redstone_torch.png"},
106 sunlight_propagates = true,
107 drop = "redstone:torch",
110 groups = {choppy=2, dig_immediate=3, not_in_creative_inventory=1, attached_node=1, torch=1,redstone=1,redstone_torch=1,redstone_power=9},
111 legacy_wallmounted = true,
114 fixed = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16},
117 on_construct = function(pos)
118 redstone.inject(pos,{torch=9})
121 after_destruct = function(pos, oldnode)
122 redstone.inject(pos,nil)
125 sounds = main.woodSound(),
128 minetest.register_node("redstone:torch_wall", {
129 inventory_image = "redstone_torch.png",
130 wield_image = "redstone_torch.png",
131 wield_scale = {x = 1, y = 1, z = 1 + 1/16},
133 mesh = "torch_wall.obj",
134 tiles = {"redstone_torch.png"},
136 paramtype2 = "wallmounted",
137 sunlight_propagates = true,
141 groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1,redstone=1,redstone_torch=1,redstone_power=9},
142 drop = "redstone:torch",
144 type = "wallmounted",
145 wall_top = {-0.1, -0.1, -0.1, 0.1, 0.5, 0.1},
146 wall_bottom = {-0.1, -0.5, -0.1, 0.1, 0.1, 0.1},
147 wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1},
149 on_construct = function(pos)
150 redstone.inject(pos,{torch=9})
153 after_destruct = function(pos, oldnode)
154 redstone.inject(pos,nil)
157 sounds = main.woodSound(),