Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7fe9ca538b | ||
|
a2ce7629aa | ||
|
a7bf161875 | ||
|
87fc2aac60 | ||
|
f81820203d |
70
init.lua
@@ -23,6 +23,7 @@ minetest.after(0, function()
|
|||||||
name = name,
|
name = name,
|
||||||
drops = def.drops,
|
drops = def.drops,
|
||||||
flammable = def.groups.flammable,
|
flammable = def.groups.flammable,
|
||||||
|
on_blast = def.on_blast,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -79,6 +80,10 @@ local function destroy(drops, pos, cid)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local def = cid_data[cid]
|
local def = cid_data[cid]
|
||||||
|
if def and def.on_blast then
|
||||||
|
def.on_blast(vector.new(pos), 1)
|
||||||
|
return
|
||||||
|
end
|
||||||
if def and def.flammable then
|
if def and def.flammable then
|
||||||
minetest.set_node(pos, fire_node)
|
minetest.set_node(pos, fire_node)
|
||||||
else
|
else
|
||||||
@@ -172,12 +177,6 @@ local function explode(pos, radius)
|
|||||||
local p = {}
|
local p = {}
|
||||||
|
|
||||||
local c_air = minetest.get_content_id("air")
|
local c_air = minetest.get_content_id("air")
|
||||||
local c_tnt = minetest.get_content_id("tnt:tnt")
|
|
||||||
local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning")
|
|
||||||
local c_gunpowder = minetest.get_content_id("tnt:gunpowder")
|
|
||||||
local c_gunpowder_burning = minetest.get_content_id("tnt:gunpowder_burning")
|
|
||||||
local c_boom = minetest.get_content_id("tnt:boom")
|
|
||||||
local c_fire = minetest.get_content_id("fire:basic_flame")
|
|
||||||
|
|
||||||
for z = -radius, radius do
|
for z = -radius, radius do
|
||||||
for y = -radius, radius do
|
for y = -radius, radius do
|
||||||
@@ -189,13 +188,7 @@ local function explode(pos, radius)
|
|||||||
p.x = pos.x + x
|
p.x = pos.x + x
|
||||||
p.y = pos.y + y
|
p.y = pos.y + y
|
||||||
p.z = pos.z + z
|
p.z = pos.z + z
|
||||||
if cid == c_tnt or cid == c_gunpowder then
|
if cid ~= c_air then
|
||||||
burn(p)
|
|
||||||
elseif cid ~= c_tnt_burning and
|
|
||||||
cid ~= c_gunpowder_burning and
|
|
||||||
cid ~= c_air and
|
|
||||||
cid ~= c_fire and
|
|
||||||
cid ~= c_boom then
|
|
||||||
destroy(drops, p, cid)
|
destroy(drops, p, cid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -222,6 +215,7 @@ end
|
|||||||
minetest.register_node("tnt:tnt", {
|
minetest.register_node("tnt:tnt", {
|
||||||
description = "TNT",
|
description = "TNT",
|
||||||
tiles = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png"},
|
tiles = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png"},
|
||||||
|
is_ground_content = false,
|
||||||
groups = {dig_immediate=2, mesecon=2},
|
groups = {dig_immediate=2, mesecon=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, node, puncher)
|
||||||
@@ -231,6 +225,9 @@ minetest.register_node("tnt:tnt", {
|
|||||||
minetest.get_node_timer(pos):start(4)
|
minetest.get_node_timer(pos):start(4)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_blast = function(pos, intensity)
|
||||||
|
burn(pos)
|
||||||
|
end,
|
||||||
mesecons = {effector = {action_on = boom}},
|
mesecons = {effector = {action_on = boom}},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -250,6 +247,8 @@ minetest.register_node("tnt:tnt_burning", {
|
|||||||
drop = "",
|
drop = "",
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_timer = boom,
|
on_timer = boom,
|
||||||
|
-- unaffected by explosions
|
||||||
|
on_blast = function() end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tnt:boom", {
|
minetest.register_node("tnt:boom", {
|
||||||
@@ -262,22 +261,25 @@ minetest.register_node("tnt:boom", {
|
|||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
-- unaffected by explosions
|
||||||
|
on_blast = function() end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tnt:gunpowder", {
|
minetest.register_node("tnt:gunpowder", {
|
||||||
description = "Gun Powder",
|
description = "Gun Powder",
|
||||||
drawtype = "raillike",
|
drawtype = "raillike",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
tiles = {"tnt_gunpowder.png",},
|
tiles = {"tnt_gunpowder_straight.png", "tnt_gunpowder_curved.png", "tnt_gunpowder_t_junction.png", "tnt_gunpowder_crossing.png"},
|
||||||
inventory_image = "tnt_gunpowder_inventory.png",
|
inventory_image = "tnt_gunpowder_inventory.png",
|
||||||
wield_image = "tnt_gunpowder_inventory.png",
|
wield_image = "tnt_gunpowder_inventory.png",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
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,attached_node=1,connect_to_raillike=minetest.raillike_group("gunpowder")},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, node, puncher)
|
||||||
@@ -285,6 +287,9 @@ minetest.register_node("tnt:gunpowder", {
|
|||||||
burn(pos)
|
burn(pos)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_blast = function(pos, intensity)
|
||||||
|
burn(pos)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tnt:gunpowder_burning", {
|
minetest.register_node("tnt:gunpowder_burning", {
|
||||||
@@ -294,7 +299,34 @@ minetest.register_node("tnt:gunpowder_burning", {
|
|||||||
walkable = false,
|
walkable = false,
|
||||||
light_source = 5,
|
light_source = 5,
|
||||||
tiles = {{
|
tiles = {{
|
||||||
name = "tnt_gunpowder_burning_animated.png",
|
name = "tnt_gunpowder_burning_straight_animated.png",
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "tnt_gunpowder_burning_curved_animated.png",
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "tnt_gunpowder_burning_t_junction_animated.png",
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "tnt_gunpowder_burning_crossing_animated.png",
|
||||||
animation = {
|
animation = {
|
||||||
type = "vertical_frames",
|
type = "vertical_frames",
|
||||||
aspect_w = 16,
|
aspect_w = 16,
|
||||||
@@ -307,7 +339,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,attached_node=1,connect_to_raillike=minetest.raillike_group("gunpowder")},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
for dx = -1, 1 do
|
for dx = -1, 1 do
|
||||||
@@ -324,7 +356,9 @@ minetest.register_node("tnt:gunpowder_burning", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end
|
end,
|
||||||
|
-- unaffected by explosions
|
||||||
|
on_blast = function() end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
Before Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 203 B |
BIN
textures/tnt_gunpowder_burning_crossing_animated.png
Normal file
After Width: | Height: | Size: 612 B |
BIN
textures/tnt_gunpowder_burning_curved_animated.png
Normal file
After Width: | Height: | Size: 432 B |
BIN
textures/tnt_gunpowder_burning_straight_animated.png
Normal file
After Width: | Height: | Size: 461 B |
BIN
textures/tnt_gunpowder_burning_t_junction_animated.png
Normal file
After Width: | Height: | Size: 672 B |
BIN
textures/tnt_gunpowder_crossing.png
Normal file
After Width: | Height: | Size: 245 B |
BIN
textures/tnt_gunpowder_curved.png
Normal file
After Width: | Height: | Size: 268 B |
BIN
textures/tnt_gunpowder_straight.png
Normal file
After Width: | Height: | Size: 225 B |
BIN
textures/tnt_gunpowder_t_junction.png
Normal file
After Width: | Height: | Size: 328 B |