2 -- Compability translator code to support MT 0.4, which doesn't support
3 -- translations for mods.
4 if not minetest
.translate
then
5 -- No translation system available, use dummy functions
6 local function translate(textdomain
, str
, ...)
7 local arg
= {n
=select('#', ...), ...}
8 return str
:gsub("@(.)", function(matched
)
9 local c
= string.byte(matched
)
10 if string.byte("1") <= c
and c
<= string.byte("9") then
11 return arg
[c
- string.byte("0")]
18 S
= function(str
, ...)
19 return translate("calendar_node", str
, ...)
22 S
= minetest
.get_translator("calendar_node")
26 if minetest
.get_modpath("calendar") then
27 on_rightclick
= function(pos
, node
, clicker
, itemstack
, pointed_thing
)
28 if not clicker
:is_player() then
31 calendar
.show_calendar(clicker
:get_player_name())
34 -- If the calendar mod was not found, the calendar node is basically
35 -- just a decorative node.
38 minetest
.register_node("calendar_node:calendar", {
39 drawtype
= "signlike",
40 description
= S("Calendar"),
41 tiles
= { "calendar_node_calendar.png" },
42 inventory_image
= "calendar_node_calendar.png",
43 wield_image
= "calendar_node_calendar.png",
45 paramtype2
= "wallmounted",
46 is_ground_content
= false,
48 groups
= { dig_immediate
= 3, attached_node
= 1, },
52 on_construct
= function(pos
)
53 local meta
= minetest
.get_meta(pos
)
54 meta
:set_string("infotext", S("Calendar"))
56 on_rightclick
= on_rightclick
,
59 if minetest
.get_modpath("default") and minetest
.get_modpath("dye") then
60 minetest
.register_craft({
61 output
= "calendar_node:calendar",
63 { "default:paper","default:paper","default:paper" },
64 { "default:paper","dye:black","default:paper" },
65 { "default:paper","default:paper","default:paper" },