mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-22 19:03:43 +01:00
Fix bug
This commit is contained in:
parent
fcea88ac8c
commit
1e7e41c73e
21
init.lua
21
init.lua
@ -263,6 +263,10 @@ local function msg(name, str)
|
|||||||
return chat_send(name, sprintf("[craftguide] %s", str))
|
return chat_send(name, sprintf("[craftguide] %s", str))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function is_num(x)
|
||||||
|
return type(x) == "number"
|
||||||
|
end
|
||||||
|
|
||||||
local function is_str(x)
|
local function is_str(x)
|
||||||
return type(x) == "string"
|
return type(x) == "string"
|
||||||
end
|
end
|
||||||
@ -1436,15 +1440,18 @@ local function get_model_fs(fs, data, def, model_alias)
|
|||||||
local _name
|
local _name
|
||||||
|
|
||||||
if v.color then
|
if v.color then
|
||||||
local hex = sprintf("%02x", v.color)
|
if is_num(v.color) then
|
||||||
|
local hex = sprintf("%02x", v.color)
|
||||||
|
|
||||||
while #hex < 8 do
|
while #hex < 8 do
|
||||||
hex = "0" .. hex
|
hex = "0" .. hex
|
||||||
|
end
|
||||||
|
|
||||||
|
_name = sprintf("%s^[multiply:%s", v.name,
|
||||||
|
sprintf("#%s%s", sub(hex, 3), sub(hex, 1, 2)))
|
||||||
|
else
|
||||||
|
_name = sprintf("%s^[multiply:%s", v.name, v.color)
|
||||||
end
|
end
|
||||||
|
|
||||||
_name = sprintf("%s^[multiply:%s", v.name,
|
|
||||||
sprintf("#%s%s", sub(hex, 3), sub(hex, 1, 2)))
|
|
||||||
|
|
||||||
elseif v.animation then
|
elseif v.animation then
|
||||||
_name = sprintf("%s^[verticalframe:%u:0", v.name, v.animation.aspect_h)
|
_name = sprintf("%s^[verticalframe:%u:0", v.name, v.animation.aspect_h)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user