]> git.scottworley.com Git - more_tnt/blob - init.lua
TNT Rain
[more_tnt] / init.lua
1 minetest.register_node("more_tnt:tnt_rain_starter",{
2 description="TNT Rain Starter",
3 groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5},
4 sounds = default.node_sound_wood_defaults(),
5 tiles = {"tnt_rain_top.png","tnt_rain_bottom.png","tnt_rain_side.png"},
6 on_punch=function(pos,node,puncher)
7 if puncher:get_wielded_item():get_name() == "default:torch" then
8 minetest.get_meta(pos):set_int("rain",30)
9 minetest.get_node_timer(pos):start(.5)
10 end
11 end,
12 on_timer=function (pos,elapsed)
13 rain=minetest.get_meta(pos):get_int("rain")-1
14 if rain < 0 then
15 minetest.set_node(pos,{name="air"})
16 return false
17 end
18 minetest.get_meta(pos):set_int("rain",rain)
19 for i=0,10 do
20 minetest.set_node({x=pos.x+math.random(-25,25),y=pos.y+10,z=pos.z + math.random(-25,25)},{name="tnt:tnt_burning"})
21 end
22 return true
23 end
24 })
25
26
27 minetest.register_craft({
28 output="more_tnt:tnt_rain_starter",
29 recipe={{"tnt:tnt","tnt:tnt","tnt:tnt"},
30 {"tnt:tnt","tnt:tnt","tnt:tnt"},
31 {"tnt:tnt","tnt:tnt","tnt:tnt"}},
32 })