49 lines
1.3 KiB
Lua
49 lines
1.3 KiB
Lua
local S = minetest.get_translator("calendar_node")
|
|
|
|
local on_rightclick
|
|
if minetest.get_modpath("calendar") then
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
if not clicker:is_player() then
|
|
return itemstack
|
|
end
|
|
calendar.show_calendar(clicker:get_player_name())
|
|
return itemstack
|
|
end
|
|
-- If the calendar mod was not found, the calendar node is basically
|
|
-- just a decorative node.
|
|
end
|
|
|
|
minetest.register_node("calendar_node:calendar", {
|
|
drawtype = "signlike",
|
|
description = S("Calendar"),
|
|
tiles = { "calendar_node_calendar.png" },
|
|
inventory_image = "calendar_node_calendar.png",
|
|
wield_image = "calendar_node_calendar.png",
|
|
paramtype = "light",
|
|
paramtype2 = "wallmounted",
|
|
is_ground_content = false,
|
|
walkable = false,
|
|
groups = { dig_immediate = 3, attached_node = 1, },
|
|
selection_box = {
|
|
type = "wallmounted",
|
|
},
|
|
on_construct = function(pos)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string("infotext", S("Calendar"))
|
|
end,
|
|
on_rightclick = on_rightclick,
|
|
})
|
|
|
|
if minetest.get_modpath("default") and minetest.get_modpath("dye") then
|
|
minetest.register_craft({
|
|
output = "calendar_node:calendar",
|
|
recipe = {
|
|
{ "default:paper","default:paper","default:paper" },
|
|
{ "default:paper","dye:black","default:paper" },
|
|
{ "default:paper","default:paper","default:paper" },
|
|
|
|
|
|
},
|
|
})
|
|
end
|