tsm_pyramids/nodes.lua

127 lines
4.1 KiB
Lua
Raw Normal View History

local S = minetest.get_translator("tsm_pyramids")
2016-11-10 15:13:26 +01:00
2018-05-24 23:53:51 +02:00
local img = {
"eye", "men", "sun",
2018-05-25 00:23:05 +02:00
"ankh", "scarab", "cactus"
2018-05-24 23:53:51 +02:00
}
local desc = {
S("Sandstone with Eye Engraving"), S("Sandstone with Man Engraving"), S("Sandstone with Sun Engraving"),
2018-05-25 00:43:33 +02:00
S("Desert Sandstone with Ankh Engraving"), S("Desert Sandstone with Scarab Engraving"), S("Desert Sandstone with Cactus Engraving")
2018-05-24 23:53:51 +02:00
}
2016-11-22 05:01:55 +01:00
local decodesc = ""
if minetest.get_modpath("doc_items") then
decodesc = doc.sub.items.temp.deco
end
2018-05-24 23:53:51 +02:00
for i=1, #img do
local sandstone_img, basenode
if i > 3 then
sandstone_img = "default_desert_sandstone.png"
basenode = "default:desert_sandstone"
else
sandstone_img = "default_sandstone.png"
basenode = "default:sandstone"
end
2014-10-04 08:38:08 +02:00
minetest.register_node("tsm_pyramids:deco_stone"..i, {
2016-11-10 14:51:40 +01:00
description = desc[i],
2016-11-22 05:01:55 +01:00
_doc_items_longdesc = decodesc,
2016-11-02 01:16:46 +01:00
is_ground_content = false,
2018-05-24 23:53:51 +02:00
tiles = {sandstone_img, sandstone_img, sandstone_img.."^tsm_pyramids_"..img[i]..".png"},
groups = minetest.registered_nodes[basenode].groups,
sounds = minetest.registered_nodes[basenode].sounds,
})
2013-10-01 14:37:40 +02:00
end
2019-08-19 17:26:05 +02:00
local trap_on_timer = function(pos, elapsed)
2018-05-24 23:06:17 +02:00
local objs = minetest.get_objects_inside_radius(pos, 2)
2019-08-19 17:26:05 +02:00
local n = minetest.get_node(pos)
2013-10-01 14:37:40 +02:00
for i, obj in pairs(objs) do
if obj:is_player() then
2015-04-01 11:14:54 +02:00
if n and n.name then
if minetest.registered_nodes[n.name]._tsm_pyramids_crack and minetest.registered_nodes[n.name]._tsm_pyramids_crack < 2 then
2019-08-19 17:26:05 +02:00
if n.name == "tsm_pyramids:trap" then
minetest.set_node(pos, {name="tsm_pyramids:trap_2"})
minetest.check_for_falling(pos)
elseif n.name == "tsm_pyramids:desert_trap" then
minetest.set_node(pos, {name="tsm_pyramids:desert_trap_2"})
minetest.check_for_falling(pos)
end
return true
2015-04-01 11:14:54 +02:00
end
2013-10-01 14:37:40 +02:00
end
end
end
return true
end
2014-10-04 08:38:08 +02:00
minetest.register_node("tsm_pyramids:trap", {
2018-05-24 22:58:31 +02:00
description = S("Cracked Sandstone Brick"),
2016-11-22 05:01:55 +01:00
_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."),
2014-10-04 08:38:08 +02:00
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack.png"},
2016-11-02 01:16:46 +01:00
is_ground_content = false,
groups = {crumbly=3,cracky=3},
2013-10-01 14:37:40 +02:00
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
2018-05-24 23:06:17 +02:00
minetest.get_node_timer(pos):start(0.1)
2013-10-01 14:37:40 +02:00
end,
_tsm_pyramids_crack = 1,
2013-10-01 14:37:40 +02:00
on_timer = trap_on_timer,
2019-08-20 06:02:39 +02:00
drop = {
items = {
{ items = { "default:sand" }, rarity = 1 },
{ items = { "default:sand" }, rarity = 2 },
},
}
2013-10-01 14:37:40 +02:00
})
2014-10-04 08:38:08 +02:00
minetest.register_node("tsm_pyramids:trap_2", {
2018-05-24 23:29:13 +02:00
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"},
2016-11-02 01:16:46 +01:00
is_ground_content = false,
groups = {crumbly=3,cracky=3,falling_node=1,not_in_creative_inventory=1},
2013-10-01 14:37:40 +02:00
sounds = default.node_sound_stone_defaults(),
2019-08-20 06:02:39 +02:00
drop = {
items = {
{ items = { "default:sand" }, rarity = 1 },
{ items = { "default:sand" }, rarity = 2 },
},
}
2013-10-01 14:37:40 +02:00
})
2019-08-19 17:26:05 +02:00
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,
2019-08-20 06:02:39 +02:00
drop = {
items = {
{ items = { "default:desert_sand" }, rarity = 1 },
{ items = { "default:desert_sand" }, rarity = 2 },
},
}
2019-08-19 17:26:05 +02:00
})
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(),
2019-08-20 06:02:39 +02:00
drop = {
items = {
{ items = { "default:desert_sand" }, rarity = 1 },
{ items = { "default:desert_sand" }, rarity = 2 },
},
}
2019-08-19 17:26:05 +02:00
})