6 Commits

Author SHA1 Message Date
paramat
7fe9ca538b Fix is_ground_content settings for nodes
Remove line if set to the default of 'true'
2015-06-18 02:25:02 +01:00
Wuzzy
a2ce7629aa Add gunpowder trails
Uses group “connect_to_raillike”
2015-06-07 14:27:18 +02:00
Novatux
a7bf161875 Copy pos before giving it to on_blast because it can modify it; also remove a debug print that had nothing to do here 2015-05-12 21:03:02 +02:00
Novatux
87fc2aac60 Fix problems with TNT 2015-05-12 16:53:04 +02:00
Wuzzy
f81820203d Make TNT respect on_blast, implement on_blast for some nodes
Implemented nodes:
- Steel Door: Ignores explosion
- Locked Chest: Ignores explosion
- Fire: Ignores explosion
- TNT: Starts burning
- Burning TNT: Explodes immediately
- Gunpowder: Starts burning
- Burning Gunpowder: Ignores explosion
2015-05-12 16:32:52 +02:00
PilzAdam
6aec1811eb Remove weird constants in default 2015-01-10 15:47:30 +01:00
12 changed files with 53 additions and 19 deletions

View File

@@ -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,34 +247,39 @@ 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", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"tnt_boom.png"}, tiles = {"tnt_boom.png"},
light_source = LIGHT_MAX, light_source = default.LIGHT_MAX,
walkable = false, walkable = false,
drop = "", drop = "",
groups = {dig_immediate=3}, groups = {dig_immediate=3},
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({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B