mirror of
https://github.com/minetest-mods/craftguide.git
synced 2025-07-13 13:30:19 +02:00
Compare commits
3 Commits
9d26dc4840
...
25e241daa2
Author | SHA1 | Date | |
---|---|---|---|
25e241daa2 | |||
a964fd768c | |||
fdfc6fe934 |
31
init.lua
31
init.lua
@ -18,12 +18,12 @@ local singleplayer = core.is_singleplayer()
|
||||
|
||||
local reg_items = core.registered_items
|
||||
local reg_tools = core.registered_tools
|
||||
local reg_entities = core.registered_entities
|
||||
local reg_aliases = core.registered_aliases
|
||||
|
||||
local log = core.log
|
||||
local after = core.after
|
||||
local clr = core.colorize
|
||||
local sound_play = core.sound_play
|
||||
local parse_json = core.parse_json
|
||||
local write_json = core.write_json
|
||||
local chat_send = core.chat_send_player
|
||||
@ -117,9 +117,9 @@ local fs_elements = {
|
||||
local styles = sprintf([[
|
||||
style[filter;border=false]
|
||||
style_type[label,field;font_size=+0]
|
||||
style_type[image_button;border=false]
|
||||
style_type[image_button;border=false;sound=craftguide_click]
|
||||
style_type[button;border=false;font=bold;font_size=+2;content_offset=0]
|
||||
style_type[item_image_button;border=false;bgimg_hovered=%s;bgimg_pressed=%s]
|
||||
style_type[item_image_button;border=false;bgimg_hovered=%s;bgimg_pressed=%s;sound=craftguide_click]
|
||||
style[search;fgimg=%s;fgimg_hovered=%s]
|
||||
style[clear;fgimg=%s;fgimg_hovered=%s]
|
||||
style[prev_page;fgimg=%s;fgimg_hovered=%s;fgimg_pressed=%s]
|
||||
@ -217,6 +217,11 @@ local group_names = {
|
||||
["color_dark_green,dye"] = S"Any dark green dye",
|
||||
}
|
||||
|
||||
craftguide.model_alias = {
|
||||
["boats:boat"] = {name = "boats:boat", drawtype = "entity"},
|
||||
--["carts:cart"] = {name = "carts:cart", drawtype = "entity"}, -- the cart animation is broken
|
||||
}
|
||||
|
||||
local function err(str)
|
||||
return log("error", str)
|
||||
end
|
||||
@ -1173,9 +1178,21 @@ local function get_title_fs(query_item, favs, lang_code, fs, spacing)
|
||||
"style_type[label;font=normal]")
|
||||
|
||||
local def = reg_items[query_item]
|
||||
local model_alias = craftguide.model_alias[query_item]
|
||||
|
||||
if def.drawtype == "mesh" then
|
||||
local tiles = def.tiles or def.textures
|
||||
if def.drawtype == "mesh" or model_alias then
|
||||
if model_alias then
|
||||
if model_alias.drawtype == "entity" then
|
||||
def = reg_entities[model_alias.name]
|
||||
local init_props = def.initial_properties
|
||||
def.textures = init_props and init_props.textures or def.textures
|
||||
def.mesh = init_props and init_props.mesh or def.mesh
|
||||
else
|
||||
def = reg_items[model_alias.name]
|
||||
end
|
||||
end
|
||||
|
||||
local tiles = def.tiles or def.textures or {}
|
||||
local t = {}
|
||||
|
||||
for _, v in ipairs(tiles) do
|
||||
@ -1634,10 +1651,6 @@ local function fields(player, _f)
|
||||
local name = player:get_player_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
|
||||
reset_data(data)
|
||||
|
||||
|
Reference in New Issue
Block a user