1 --get point where particle spawner is added
2 local function get_offset(wdir)
14 return {x = x, y = 0.27, z = z}
17 --remove smoke and fire
18 local function delete_ps(pos)
19 local meta = minetest.get_meta(pos)
20 minetest.delete_particlespawner(meta:get_int("psf"))
21 minetest.delete_particlespawner(meta:get_int("pss"))
24 --add in smoke and fire
25 local function create_ps(pos)
26 local dir = get_offset(minetest.get_node(pos).param2)
27 local ppos = vector.add(dir,pos)
28 local meta = minetest.get_meta(pos)
29 local psf = minetest.add_particlespawner({
34 minvel = vector.new(0,0,0),
35 maxvel = vector.new(0,0,0),
36 minacc = {x=0, y=0, z=0},
37 maxacc = {x=0, y=0, z=0},
42 collisiondetection = false,
44 texture = "redstone_torch_animated.png",
45 animation = {type = "vertical_frames",
48 -- Width of a frame in pixels
51 -- Height of a frame in pixels
57 local pss = minetest.add_particlespawner({
62 minvel = vector.new(-0.1,0.1,-0.1),
63 maxvel = vector.new(0.1,0.3,0.1),
64 minacc = vector.new(0,0,0),
65 maxacc = vector.new(0,0,0),
70 collisiondetection = false,
72 texture = "smoke.png",
74 meta:set_int("psf", psf)
75 meta:set_int("pss", pss)
78 --reload smoke and flame on load
80 minetest.register_lbm({
81 name = "redstone:torch",
82 nodenames = {"redstone:torch_floor","redstone:torch_wall"},
83 run_at_every_load = true,
84 action = function(pos, node)
90 minetest.register_craftitem("redstone:torch", {
91 description = "Redstone Torch",
92 inventory_image = "redstone_torch.png",
93 wield_image = "redstone_torch.png",
94 wield_scale = {x = 1, y = 1, z = 1 + 1/16},
95 liquids_pointable = false,
97 on_place = function(itemstack, placer, pointed_thing)
98 if pointed_thing.type ~= "node" then
102 local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
104 local fakestack = itemstack
108 elseif wdir == 1 then
109 retval = fakestack:set_name("redstone:torch_floor")
111 retval = fakestack:set_name("redstone:torch_wall")
112 --local name = minetest.get_node(pointed_thing.under).name
113 --local def = minetest.registered_nodes[name]
114 --if def.drawtype == "normal" and string.match(name, "main:") then
115 -- minetest.set_node(pointed_thing.under,{name="redstone:"..string.gsub(name, "main:", "").."_deactivator"})
121 itemstack, retval = minetest.item_place(fakestack, placer, pointed_thing, wdir)
122 itemstack:set_name("redstone:torch")
125 minetest.sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
132 minetest.register_node("redstone:torch_floor", {
133 inventory_image = "redstone_torch.png",
134 wield_image = "redstone_torch.png",
135 wield_scale = {x = 1, y = 1, z = 1 + 2/16},
137 mesh = "torch_floor.obj",
138 tiles = {"redstone_torch.png"},
142 sunlight_propagates = true,
143 drop = "redstone:torch",
146 groups = {choppy=2, dig_immediate=3, not_in_creative_inventory=1, attached_node=1, torch=1,redstone=1,redstone_torch=1,redstone_power=9},
147 legacy_wallmounted = true,
150 fixed = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16},
153 on_construct = function(pos)
154 --redstone.torch_activate(pos)
155 redstone.collect_info(pos)
157 after_destruct = function(pos, oldnode)
158 redstone.collect_info(pos)
160 sounds = main.woodSound(),
163 minetest.register_node("redstone:torch_wall", {
164 inventory_image = "redstone_torch.png",
165 wield_image = "redstone_torch.png",
166 wield_scale = {x = 1, y = 1, z = 1 + 1/16},
168 mesh = "torch_wall.obj",
169 tiles = {"redstone_torch.png"},
171 paramtype2 = "wallmounted",
172 sunlight_propagates = true,
176 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},
177 drop = "redstone:torch",
179 type = "wallmounted",
180 wall_top = {-0.1, -0.1, -0.1, 0.1, 0.5, 0.1},
181 wall_bottom = {-0.1, -0.5, -0.1, 0.1, 0.1, 0.1},
182 wall_side = {-0.5, -0.3, -0.1, -0.2, 0.3, 0.1},
184 on_construct = function(pos)
185 --redstone.torch_activate(pos)
186 redstone.collect_info(pos)
188 after_destruct = function(pos, oldnode)
189 redstone.collect_info(pos)
191 sounds = main.woodSound(),