Add calendar node
parent
d3a7cf2d36
commit
990b42b947
31
gui.lua
31
gui.lua
|
@ -14,7 +14,7 @@ local player_current_calendars = {}
|
||||||
|
|
||||||
local ORDINAL = true
|
local ORDINAL = true
|
||||||
|
|
||||||
local function show_calendar(player_name, ordinal, wanted_months, wanted_years)
|
function calendar.show_calendar(player_name, ordinal, wanted_months, wanted_years)
|
||||||
local days, months, years = calendar.get_date()
|
local days, months, years = calendar.get_date()
|
||||||
local total_days = minetest.get_day_count()
|
local total_days = minetest.get_day_count()
|
||||||
local ddays, dmonths, dyears = calendar.get_date(nil, ordinal)
|
local ddays, dmonths, dyears = calendar.get_date(nil, ordinal)
|
||||||
|
@ -157,6 +157,33 @@ minetest.register_chatcommand("calendar", {
|
||||||
param = "",
|
param = "",
|
||||||
description = S("Display calendar"),
|
description = S("Display calendar"),
|
||||||
func = function( name, param )
|
func = function( name, param )
|
||||||
show_calendar(name, ORDINAL)
|
calendar.show_calendar(name, ORDINAL)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("calendar:calendar", {
|
||||||
|
drawtype = "signlike",
|
||||||
|
description = S("Calendar"),
|
||||||
|
tiles = { "calendar_calendar.png" },
|
||||||
|
inventory_image = "calendar_calendar.png",
|
||||||
|
wield_image = "calendar_calendar.png",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
groups = { dig_immediate = 2, 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 = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
|
if not clicker:is_player() then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
calendar.show_calendar(clicker:get_player_name(), ORDINAL)
|
||||||
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 354 B |
Loading…
Reference in New Issue