1 local S
= minetest
.get_translator("tsm_pyramids")
5 "ankh", "scarab", "cactus"
8 S("Sandstone with Eye Engraving"), S("Sandstone with Man Engraving"), S("Sandstone with Sun Engraving"),
9 S("Desert Sandstone with Ankh Engraving"), S("Desert Sandstone with Scarab Engraving"), S("Desert Sandstone with Cactus Engraving")
13 if minetest
.get_modpath("doc_items") then
14 decodesc
= doc
.sub
.items
.temp
.deco
18 local sandstone_img
, basenode
20 sandstone_img
= "default_desert_sandstone.png"
21 basenode
= "default:desert_sandstone"
23 sandstone_img
= "default_sandstone.png"
24 basenode
= "default:sandstone"
26 minetest
.register_node("tsm_pyramids:deco_stone"..i
, {
27 description
= desc
[i
],
28 _doc_items_longdesc
= decodesc
,
29 is_ground_content
= false,
30 tiles
= {sandstone_img
, sandstone_img
, sandstone_img
.."^tsm_pyramids_"..img
[i
]..".png"},
31 groups
= minetest
.registered_nodes
[basenode
].groups
,
32 sounds
= minetest
.registered_nodes
[basenode
].sounds
,
36 local trap_on_timer
= function(pos
, elapsed
)
37 local n
= minetest
.get_node(pos
)
38 if not (n
and n
.name
) then
41 -- Drop trap stone when player is nearby
42 local objs
= minetest
.get_objects_inside_radius(pos
, 2)
43 for i
, obj
in pairs(objs
) do
44 if obj
:is_player() then
45 if minetest
.registered_nodes
[n
.name
]._tsm_pyramids_crack
and minetest
.registered_nodes
[n
.name
]._tsm_pyramids_crack
< 2 then
46 -- 70% chance to ignore player to make the time of falling less predictable
47 if math
.random(1, 10) >= 3 then
50 if n
.name
== "tsm_pyramids:trap" then
51 minetest
.set_node(pos
, {name
="tsm_pyramids:trap_2"})
52 minetest
.check_for_falling(pos
)
53 elseif n
.name
== "tsm_pyramids:desert_trap" then
54 minetest
.set_node(pos
, {name
="tsm_pyramids:desert_trap_2"})
55 minetest
.check_for_falling(pos
)
64 local register_trap_stone
= function(basename
, desc_normal
, desc_falling
, base_tile
, drop
)
65 minetest
.register_node("tsm_pyramids:"..basename
, {
66 description
= desc_normal
,
67 _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."),
68 tiles
= { base_tile
.. "^tsm_pyramids_crack.png" },
69 is_ground_content
= false,
70 groups
= {crumbly
=3,cracky
=3},
71 sounds
= default
.node_sound_stone_defaults(),
72 on_construct
= function(pos
)
73 minetest
.get_node_timer(pos
):start(0.1)
75 _tsm_pyramids_crack
= 1,
76 on_timer
= trap_on_timer
,
80 minetest
.register_node("tsm_pyramids:"..basename
.."_2", {
81 description
= desc_falling
,
82 _doc_items_longdesc
= S("This old porous brick falls under its own weight."),
83 tiles
= { base_tile
.. "^tsm_pyramids_crack2.png" },
84 is_ground_content
= false,
85 groups
= {crumbly
=3,cracky
=3,falling_node
=1,not_in_creative_inventory
=1},
86 sounds
= default
.node_sound_stone_defaults(),
91 register_trap_stone("trap",
92 S("Cracked Sandstone Brick"), S("Falling Cracked Sandstone Brick"),
93 "default_sandstone_brick.png",
94 { items
= { { items
= { "default:sand" }, rarity
= 1 }, { items
= { "default:sand" }, rarity
= 2 }, } })
95 register_trap_stone("desert_trap",
96 S("Cracked Desert Sandstone Brick"), S("Falling Cracked Desert Sandstone Brick"),
97 "default_desert_sandstone_brick.png",
98 { items
= { { items
= { "default:desert_sand" }, rarity
= 1 }, { items
= { "default:desert_sand" }, rarity
= 2 }, } })