Simplify trap stone definition

This commit is contained in:
Wuzzy 2019-08-25 16:02:25 +02:00
parent c2167e305a
commit 47b32ecae1
1 changed files with 33 additions and 66 deletions

View File

@ -61,72 +61,39 @@ local trap_on_timer = function(pos, elapsed)
return true
end
minetest.register_node("tsm_pyramids:trap", {
description = S("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."),
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack.png"},
is_ground_content = false,
groups = {crumbly=3,cracky=3},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(0.1)
end,
_tsm_pyramids_crack = 1,
on_timer = trap_on_timer,
drop = {
items = {
{ items = { "default:sand" }, rarity = 1 },
{ items = { "default:sand" }, rarity = 2 },
},
}
})
local register_trap_stone = function(basename, desc_normal, desc_falling, base_tile, drop)
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."),
tiles = { base_tile .. "^tsm_pyramids_crack.png" },
is_ground_content = false,
groups = {crumbly=3,cracky=3},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(0.1)
end,
_tsm_pyramids_crack = 1,
on_timer = trap_on_timer,
drop = drop,
})
minetest.register_node("tsm_pyramids:trap_2", {
description = S("Falling Cracked Sandstone Brick"),
_doc_items_longdesc = S("This old porous brick falls under its own weight."),
tiles = {"default_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:sand" }, rarity = 1 },
{ items = { "default:sand" }, rarity = 2 },
},
}
})
minetest.register_node("tsm_pyramids:"..basename.."_2", {
description = desc_falling,
_doc_items_longdesc = S("This old porous brick falls under its own weight."),
tiles = { base_tile .. "^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 = drop,
})
end
minetest.register_node("tsm_pyramids:desert_trap", {
description = S("Cracked Desert 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."),
tiles = {"default_desert_sandstone_brick.png^tsm_pyramids_crack.png"},
is_ground_content = false,
groups = {crumbly=3,cracky=3},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
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 },
},
}
})
register_trap_stone("trap",
S("Cracked Sandstone Brick"), S("Falling Cracked Sandstone Brick"),
"default_sandstone_brick.png",
{ items = { { items = { "default:sand" }, rarity = 1 }, { items = { "default:sand" }, rarity = 2 }, } })
register_trap_stone("desert_trap",
S("Cracked Desert Sandstone Brick"), S("Falling Cracked Desert Sandstone Brick"),
"default_desert_sandstone_brick.png",
{ 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 },
},
}
})