2016-11-10 15:13:26 +01:00
|
|
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
|
|
|
local S
|
|
|
|
if minetest.get_modpath("intllib") then
|
|
|
|
S = intllib.Getter()
|
|
|
|
else
|
|
|
|
S = function(s) return s end
|
|
|
|
end
|
|
|
|
|
|
|
|
local desc = {S("Sandstone with eye engraving"), S("Sandstone with man engraving"), S("Sandstone with sun engraving")}
|
2013-09-26 01:37:24 +02:00
|
|
|
local img = {"eye", "men", "sun"}
|
|
|
|
|
2016-11-22 05:01:55 +01:00
|
|
|
local decodesc = ""
|
|
|
|
if minetest.get_modpath("doc_items") then
|
|
|
|
decodesc = doc.sub.items.temp.deco
|
|
|
|
end
|
|
|
|
|
2013-09-26 01:37:24 +02:00
|
|
|
for i=1,3 do
|
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-10 15:08:06 +01:00
|
|
|
tiles = {"default_sandstone.png", "default_sandstone.png", "default_sandstone.png^tsm_pyramids_"..img[i]..".png"},
|
2016-11-02 01:16:46 +01:00
|
|
|
is_ground_content = false,
|
2016-11-10 15:01:03 +01:00
|
|
|
groups = minetest.registered_nodes["default:sandstone"].groups,
|
2013-09-26 01:37:24 +02:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
})
|
2013-10-01 14:37:40 +02:00
|
|
|
end
|
|
|
|
|
2016-08-11 17:37:36 +02:00
|
|
|
local trap_on_timer = function (pos, elapsed)
|
2013-10-01 14:37:40 +02:00
|
|
|
local objs = minetest.env:get_objects_inside_radius(pos, 2)
|
|
|
|
for i, obj in pairs(objs) do
|
|
|
|
if obj:is_player() then
|
|
|
|
local n = minetest.get_node(pos)
|
2015-04-01 11:14:54 +02:00
|
|
|
if n and n.name then
|
2016-11-17 18:34:45 +01:00
|
|
|
if minetest.registered_nodes[n.name]._tsm_pyramids_crack and minetest.registered_nodes[n.name]._tsm_pyramids_crack < 2 then
|
2016-11-10 16:27:59 +01:00
|
|
|
minetest.set_node(pos, {name="tsm_pyramids:trap_2"})
|
2015-04-01 11:14:54 +02:00
|
|
|
nodeupdate(pos)
|
|
|
|
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", {
|
2016-11-10 15:13:26 +01: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,
|
2016-11-10 15:01:03 +01:00
|
|
|
groups = {crumbly=3,cracky=3},
|
2013-10-01 14:37:40 +02:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
on_construct = function(pos)
|
|
|
|
minetest.env:get_node_timer(pos):start(0.1)
|
|
|
|
end,
|
2016-11-17 18:34:45 +01:00
|
|
|
_tsm_pyramids_crack = 1,
|
2013-10-01 14:37:40 +02:00
|
|
|
on_timer = trap_on_timer,
|
|
|
|
drop = "",
|
|
|
|
})
|
|
|
|
|
2014-10-04 08:38:08 +02:00
|
|
|
minetest.register_node("tsm_pyramids:trap_2", {
|
2016-11-10 15:13:26 +01:00
|
|
|
description = S("Fallen cracked sandstone brick"),
|
2016-11-22 05:01:55 +01:00
|
|
|
_doc_items_longdesc = S("This old and porous brick fell to the ground. It does not hold itself anymore."),
|
2014-10-04 08:38:08 +02:00
|
|
|
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack.png^[transformR90"},
|
2016-11-02 01:16:46 +01:00
|
|
|
is_ground_content = false,
|
2016-11-10 15:01:03 +01:00
|
|
|
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(),
|
|
|
|
drop = "",
|
|
|
|
})
|