Add button tooltips

master
Wuzzy 2020-08-27 10:13:13 +02:00
parent 50d7f558d6
commit 5015feb362
1 changed files with 10 additions and 3 deletions

13
gui.lua
View File

@ -90,9 +90,14 @@ local function show_calendar(player_name, ordinal, wanted_months, wanted_years)
if wanted_months > 0 or wanted_years > 0 then
formspec = formspec .. "button[0.5,"..y..";1,1;prev_year;<<]"
.. "button[1.5,"..y..";1,1;prev_month;<]"
.. "tooltip[prev_month;"..F(S("Previous month")).."]"
.. "tooltip[prev_year;"..F(S("Previous year")).."]"
end
formspec = formspec .. "button[2.5,"..y..";1,1;next_month;>]"
.. "button[3.5,"..y..";1,1;next_year;>>]"
formspec = formspec .. "button[2.5,"..y..";2,1;today;"..F(S("Today")).."]"
formspec = formspec .. "button[4.5,"..y..";1,1;next_month;>]"
.. "button[5.5,"..y..";1,1;next_year;>>]"
.. "tooltip[next_month;"..F(S("Next month")).."]"
.. "tooltip[next_year;"..F(S("Next year")).."]"
minetest.show_formspec(player_name, "calendar:calendar", formspec)
player_current_calendars[player_name] = { years = wanted_years, months = wanted_months }
@ -112,7 +117,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
cur_years = player_current_calendars[name].years
cur_months = player_current_calendars[name].months
if fields.next_year then
if fields.today then
show_calendar(name, ORDINAL)
elseif fields.next_year then
cur_years = cur_years + 1
show_calendar(name, ORDINAL, cur_months, cur_years)
elseif fields.prev_year then