Simplify trap stone definition

This commit is contained in:
Wuzzy 2019-08-25 16:02:25 +02:00
parent c2167e305a
commit 47b32ecae1

View File

@ -61,10 +61,11 @@ local trap_on_timer = function(pos, elapsed)
return true return true
end end
minetest.register_node("tsm_pyramids:trap", { local register_trap_stone = function(basename, desc_normal, desc_falling, base_tile, drop)
description = S("Cracked Sandstone Brick"), minetest.register_node("tsm_pyramids:"..basename, {
description = desc_normal,
_doc_items_longdesc = S("This brick is old, porous and unstable and is barely able to hold itself. One should be careful not to disturb it."), _doc_items_longdesc = S("This brick is old, porous and unstable and is barely able to hold itself. One should be careful not to disturb it."),
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack.png"}, tiles = { base_tile .. "^tsm_pyramids_crack.png" },
is_ground_content = false, is_ground_content = false,
groups = {crumbly=3,cracky=3}, groups = {crumbly=3,cracky=3},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
@ -73,60 +74,26 @@ minetest.register_node("tsm_pyramids:trap", {
end, end,
_tsm_pyramids_crack = 1, _tsm_pyramids_crack = 1,
on_timer = trap_on_timer, on_timer = trap_on_timer,
drop = { drop = drop,
items = { })
{ items = { "default:sand" }, rarity = 1 },
{ items = { "default:sand" }, rarity = 2 },
},
}
})
minetest.register_node("tsm_pyramids:trap_2", { minetest.register_node("tsm_pyramids:"..basename.."_2", {
description = S("Falling Cracked Sandstone Brick"), description = desc_falling,
_doc_items_longdesc = S("This old porous brick falls under its own weight."), _doc_items_longdesc = S("This old porous brick falls under its own weight."),
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack2.png"}, tiles = { base_tile .. "^tsm_pyramids_crack2.png" },
is_ground_content = false, is_ground_content = false,
groups = {crumbly=3,cracky=3,falling_node=1,not_in_creative_inventory=1}, groups = {crumbly=3,cracky=3,falling_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = { drop = drop,
items = { })
{ items = { "default:sand" }, rarity = 1 }, end
{ items = { "default:sand" }, rarity = 2 },
},
}
})
minetest.register_node("tsm_pyramids:desert_trap", { register_trap_stone("trap",
description = S("Cracked Desert Sandstone Brick"), S("Cracked Sandstone Brick"), S("Falling Cracked Sandstone Brick"),
_doc_items_longdesc = S("This brick is old, porous and unstable and is barely able to hold itself. One should be careful not to disturb it."), "default_sandstone_brick.png",
tiles = {"default_desert_sandstone_brick.png^tsm_pyramids_crack.png"}, { items = { { items = { "default:sand" }, rarity = 1 }, { items = { "default:sand" }, rarity = 2 }, } })
is_ground_content = false, register_trap_stone("desert_trap",
groups = {crumbly=3,cracky=3}, S("Cracked Desert Sandstone Brick"), S("Falling Cracked Desert Sandstone Brick"),
sounds = default.node_sound_stone_defaults(), "default_desert_sandstone_brick.png",
on_construct = function(pos) { items = { { items = { "default:desert_sand" }, rarity = 1 }, { items = { "default:desert_sand" }, rarity = 2 }, } })
minetest.get_node_timer(pos):start(0.1)
end,
_tsm_pyramids_crack = 1,
on_timer = trap_on_timer,
drop = {
items = {
{ items = { "default:desert_sand" }, rarity = 1 },
{ items = { "default:desert_sand" }, rarity = 2 },
},
}
})
minetest.register_node("tsm_pyramids:desert_trap_2", {
description = S("Falling Cracked Desert Sandstone Brick"),
_doc_items_longdesc = S("This old porous brick falls under its own weight."),
tiles = {"default_desert_sandstone_brick.png^tsm_pyramids_crack2.png"},
is_ground_content = false,
groups = {crumbly=3,cracky=3,falling_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
drop = {
items = {
{ items = { "default:desert_sand" }, rarity = 1 },
{ items = { "default:desert_sand" }, rarity = 2 },
},
}
})