mirror of
https://github.com/minetest-mods/craftguide.git
synced 2025-06-30 15:10:38 +02:00
Compare commits
2 Commits
1.14.1
...
6e6ff93d29
Author | SHA1 | Date | |
---|---|---|---|
6e6ff93d29 | |||
2fd3604cac |
13
init.lua
13
init.lua
@ -23,6 +23,7 @@ local reg_aliases = core.registered_aliases
|
|||||||
local log = core.log
|
local log = core.log
|
||||||
local after = core.after
|
local after = core.after
|
||||||
local clr = core.colorize
|
local clr = core.colorize
|
||||||
|
local sound_play = core.sound_play
|
||||||
local parse_json = core.parse_json
|
local parse_json = core.parse_json
|
||||||
local write_json = core.write_json
|
local write_json = core.write_json
|
||||||
local chat_send = core.chat_send_player
|
local chat_send = core.chat_send_player
|
||||||
@ -103,6 +104,7 @@ local FMT = {
|
|||||||
image = "image[%f,%f;%f,%f;%s]",
|
image = "image[%f,%f;%f,%f;%s]",
|
||||||
button = "button[%f,%f;%f,%f;%s;%s]",
|
button = "button[%f,%f;%f,%f;%s;%s]",
|
||||||
tooltip = "tooltip[%f,%f;%f,%f;%s]",
|
tooltip = "tooltip[%f,%f;%f,%f;%s]",
|
||||||
|
hypertext = "hypertext[%f,%f;%f,%f;;%s]",
|
||||||
item_image = "item_image[%f,%f;%f,%f;%s]",
|
item_image = "item_image[%f,%f;%f,%f;%s]",
|
||||||
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
|
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
|
||||||
animated_image = "animated_image[%f,%f;%f,%f;;%s;%u;%u]",
|
animated_image = "animated_image[%f,%f;%f,%f;;%s;%u;%u]",
|
||||||
@ -1173,8 +1175,8 @@ local function get_title_fs(query_item, lang_code, favs, fs, spacing)
|
|||||||
local t_desc = query_item
|
local t_desc = query_item
|
||||||
t_desc = #t_desc > 40 and fmt("%s...", sub(t_desc, 1, 37)) or t_desc
|
t_desc = #t_desc > 40 and fmt("%s...", sub(t_desc, 1, 37)) or t_desc
|
||||||
|
|
||||||
fs[#fs + 1] = fmt("hypertext[9.05,%f;5.85,1.2;;%s]",
|
fs[#fs + 1] = fmt(FMT.hypertext,
|
||||||
spacing - 0.1,
|
9.05, spacing - 0.1, 5.85, 1.2,
|
||||||
fmt("<item name=%s float=right width=64 height=64 rotate=yes>" ..
|
fmt("<item name=%s float=right width=64 height=64 rotate=yes>" ..
|
||||||
"<big><b>%s</b></big>\n<style color=#7bf font=mono>%s</style>",
|
"<big><b>%s</b></big>\n<style color=#7bf font=mono>%s</style>",
|
||||||
query_item, desc, t_desc))
|
query_item, desc, t_desc))
|
||||||
@ -1342,7 +1344,7 @@ local function make_fs(data)
|
|||||||
lbl = ES"Collect items to reveal more recipes"
|
lbl = ES"Collect items to reveal more recipes"
|
||||||
end
|
end
|
||||||
|
|
||||||
fs[#fs + 1] = fmt("hypertext[%f,%f;%f,%f;;%s]",
|
fs[#fs + 1] = fmt(FMT.hypertext,
|
||||||
0.05, 3, 8.29, 1,
|
0.05, 3, 8.29, 1,
|
||||||
fmt("<center><style size=20><b>%s</b></style></center>]",
|
fmt("<center><style size=20><b>%s</b></style></center>]",
|
||||||
translate(data.lang_code, lbl)))
|
translate(data.lang_code, lbl)))
|
||||||
@ -1641,9 +1643,14 @@ on_joinplayer(function(player)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local function fields(player, _f)
|
local function fields(player, _f)
|
||||||
|
if _f.quit then return end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local data = pdata[name]
|
local data = pdata[name]
|
||||||
|
|
||||||
|
if not _f.key_enter_field then
|
||||||
|
sound_play("craftguide_click", {to_player = name, gain = 0.2})
|
||||||
|
end
|
||||||
|
|
||||||
if _f.clear then
|
if _f.clear then
|
||||||
reset_data(data)
|
reset_data(data)
|
||||||
|
|
||||||
|
BIN
sounds/craftguide_click.ogg
Normal file
BIN
sounds/craftguide_click.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user