Compare commits
5 Commits
5e0c0cec38
...
d6a0b7dfec
Author | SHA1 | Date |
---|---|---|
PilzAdam | d6a0b7dfec | |
PilzAdam | e12ae2711f | |
PilzAdam | dc0d3f6700 | |
PilzAdam | d64cac49d4 | |
PilzAdam | d377a8d959 |
62
init.lua
62
init.lua
|
@ -1,7 +1,4 @@
|
|||
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
|
||||
if nodename ~= "air" then
|
||||
minetest.env:remove_node(pos)
|
||||
|
@ -10,6 +7,9 @@ local destroy = function(pos)
|
|||
minetest.env:set_node(pos, {name="fire:basic_flame"})
|
||||
return
|
||||
end
|
||||
if math.random(1,3) == 3 then
|
||||
return
|
||||
end
|
||||
local drop = minetest.get_node_drops(nodename, "")
|
||||
for _,item in ipairs(drop) do
|
||||
if type(item) == "string" then
|
||||
|
@ -55,11 +55,8 @@ boom = function(pos, time)
|
|||
local damage = (80*0.5^dist)*2
|
||||
obj:punch(obj, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=1/damage, [2]=1/damage, [3]=1/damage}},
|
||||
snappy={times={[1]=1/damage, [2]=1/damage, [3]=1/damage}},
|
||||
}
|
||||
}, nil)
|
||||
damage_groups={fleshy=damage},
|
||||
}, vec)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -92,6 +89,23 @@ boom = function(pos, time)
|
|||
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
|
||||
|
||||
|
@ -194,7 +208,7 @@ minetest.register_node("tnt:gunpowder", {
|
|||
type = "fixed",
|
||||
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
||||
},
|
||||
groups = {dig_immediate=2},
|
||||
groups = {dig_immediate=2,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_punch = function(pos, node, puncher)
|
||||
|
@ -216,7 +230,7 @@ minetest.register_node("tnt:gunpowder_burning", {
|
|||
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
||||
},
|
||||
drop = "",
|
||||
groups = {dig_immediate=2},
|
||||
groups = {dig_immediate=2,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
|
@ -244,34 +258,12 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
output = "tnt:tnt",
|
||||
recipe = {
|
||||
{"", "default:wood", ""},
|
||||
{"default:wood", "tnt:gunpowder", "default:wood"},
|
||||
{"", "default:wood", ""}
|
||||
{"", "group:wood", ""},
|
||||
{"group:wood", "tnt:gunpowder", "group:wood"},
|
||||
{"", "group: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
|
||||
minetest.log("action", "tnt loaded")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue