mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-29 13:53:43 +01:00
Handle entity models
This commit is contained in:
parent
fdfc6fe934
commit
a964fd768c
21
init.lua
21
init.lua
@ -18,12 +18,12 @@ local singleplayer = core.is_singleplayer()
|
|||||||
|
|
||||||
local reg_items = core.registered_items
|
local reg_items = core.registered_items
|
||||||
local reg_tools = core.registered_tools
|
local reg_tools = core.registered_tools
|
||||||
|
local reg_entities = core.registered_entities
|
||||||
local reg_aliases = core.registered_aliases
|
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
|
||||||
@ -217,6 +217,11 @@ local group_names = {
|
|||||||
["color_dark_green,dye"] = S"Any dark green dye",
|
["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)
|
local function err(str)
|
||||||
return log("error", str)
|
return log("error", str)
|
||||||
end
|
end
|
||||||
@ -1173,8 +1178,20 @@ local function get_title_fs(query_item, favs, lang_code, fs, spacing)
|
|||||||
"style_type[label;font=normal]")
|
"style_type[label;font=normal]")
|
||||||
|
|
||||||
local def = reg_items[query_item]
|
local def = reg_items[query_item]
|
||||||
|
local model_alias = craftguide.model_alias[query_item]
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
if def.drawtype == "mesh" then
|
|
||||||
local tiles = def.tiles or def.textures
|
local tiles = def.tiles or def.textures
|
||||||
local t = {}
|
local t = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user