Compare commits
No commits in common. "d6a0b7dfec33c647414ed4c2dadf32b9347b7508" and "5e0c0cec38fa525f95a8bfb2ddd517269ff286c8" have entirely different histories.
d6a0b7dfec
...
5e0c0cec38
62
init.lua
62
init.lua
|
@ -1,4 +1,7 @@
|
||||||
local destroy = function(pos)
|
local destroy = function(pos)
|
||||||
|
if math.random(1,5) <= 4 then
|
||||||
|
minetest.env:add_entity({x=pos.x+math.random(0,10)/10-0.5, y=pos.y, z=pos.z+math.random(0,10)/10-0.5}, "tnt:smoke")
|
||||||
|
end
|
||||||
local nodename = minetest.env:get_node(pos).name
|
local nodename = minetest.env:get_node(pos).name
|
||||||
if nodename ~= "air" then
|
if nodename ~= "air" then
|
||||||
minetest.env:remove_node(pos)
|
minetest.env:remove_node(pos)
|
||||||
|
@ -7,9 +10,6 @@ local destroy = function(pos)
|
||||||
minetest.env:set_node(pos, {name="fire:basic_flame"})
|
minetest.env:set_node(pos, {name="fire:basic_flame"})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if math.random(1,3) == 3 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local drop = minetest.get_node_drops(nodename, "")
|
local drop = minetest.get_node_drops(nodename, "")
|
||||||
for _,item in ipairs(drop) do
|
for _,item in ipairs(drop) do
|
||||||
if type(item) == "string" then
|
if type(item) == "string" then
|
||||||
|
@ -55,8 +55,11 @@ boom = function(pos, time)
|
||||||
local damage = (80*0.5^dist)*2
|
local damage = (80*0.5^dist)*2
|
||||||
obj:punch(obj, 1.0, {
|
obj:punch(obj, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damage},
|
groupcaps={
|
||||||
}, vec)
|
fleshy={times={[1]=1/damage, [2]=1/damage, [3]=1/damage}},
|
||||||
|
snappy={times={[1]=1/damage, [2]=1/damage, [3]=1/damage}},
|
||||||
|
}
|
||||||
|
}, nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,23 +92,6 @@ boom = function(pos, time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.add_particlespawner(
|
|
||||||
100, --amount
|
|
||||||
0.1, --time
|
|
||||||
{x=pos.x-3, y=pos.y-3, z=pos.z-3}, --minpos
|
|
||||||
{x=pos.x+3, y=pos.y+3, z=pos.z+3}, --maxpos
|
|
||||||
{x=-0, y=-0, z=-0}, --minvel
|
|
||||||
{x=0, y=0, z=0}, --maxvel
|
|
||||||
{x=-0.5,y=5,z=-0.5}, --minacc
|
|
||||||
{x=0.5,y=5,z=0.5}, --maxacc
|
|
||||||
0.1, --minexptime
|
|
||||||
1, --maxexptime
|
|
||||||
8, --minsize
|
|
||||||
15, --maxsize
|
|
||||||
false, --collisiondetection
|
|
||||||
"tnt_smoke.png" --texture
|
|
||||||
)
|
|
||||||
end, pos)
|
end, pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -208,7 +194,7 @@ minetest.register_node("tnt:gunpowder", {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=2,attached_node=1},
|
groups = {dig_immediate=2},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, node, puncher)
|
||||||
|
@ -230,7 +216,7 @@ minetest.register_node("tnt:gunpowder_burning", {
|
||||||
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
||||||
},
|
},
|
||||||
drop = "",
|
drop = "",
|
||||||
groups = {dig_immediate=2,attached_node=1},
|
groups = {dig_immediate=2},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -258,12 +244,34 @@ minetest.register_craft({
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "tnt:tnt",
|
output = "tnt:tnt",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "group:wood", ""},
|
{"", "default:wood", ""},
|
||||||
{"group:wood", "tnt:gunpowder", "group:wood"},
|
{"default:wood", "tnt:gunpowder", "default:wood"},
|
||||||
{"", "group:wood", ""}
|
{"", "default:wood", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity("tnt:smoke", {
|
||||||
|
physical = true,
|
||||||
|
visual = "sprite",
|
||||||
|
textures = {"tnt_smoke.png"},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
|
||||||
|
timer = 0,
|
||||||
|
time = 5,
|
||||||
|
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
self.object:setacceleration({x=math.random(0,10)/10-0.5, y=5, z=math.random(0,10)/10-0.5})
|
||||||
|
self.time = math.random(1, 10)/10
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
self.timer = self.timer+dtime
|
||||||
|
if self.timer > self.time then
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
if minetest.setting_get("log_mods") then
|
if minetest.setting_get("log_mods") then
|
||||||
minetest.log("action", "tnt loaded")
|
minetest.log("action", "tnt loaded")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue