GUI: show wear for recipe output
This commit is contained in:
parent
b4d7dfddef
commit
ec4e929491
4
init.lua
4
init.lua
|
@ -72,7 +72,7 @@ i3.files.groups()
|
|||
i3.files.callbacks()
|
||||
|
||||
local storage = core.get_mod_storage()
|
||||
local slz, dslz, str_to_pos, add_hud_waypoint = i3.get("slz", "dslz", "str_to_pos", "add_hud_waypoint")
|
||||
local slz, dslz, copy, str_to_pos, add_hud_waypoint = i3.get("slz", "dslz", "copy", "str_to_pos", "add_hud_waypoint")
|
||||
local set_fs = i3.set_fs
|
||||
|
||||
i3.data = dslz(storage:get_string "data") or {}
|
||||
|
@ -189,7 +189,7 @@ local function init_hudbar(player)
|
|||
end
|
||||
|
||||
local function save_data(player_name)
|
||||
local _data = table.copy(i3.data)
|
||||
local _data = copy(i3.data)
|
||||
|
||||
for name, v in pairs(_data) do
|
||||
for dat in pairs(v) do
|
||||
|
|
|
@ -721,11 +721,14 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||
|
||||
if rcp.type == "fuel" then
|
||||
fs("animated_image", X + 0.05, Y, i3.ITEM_BTN_SIZE, i3.ITEM_BTN_SIZE, PNG.fire_anim, 8, 180)
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
local item = ItemStack(rcp.output)
|
||||
local meta = item:get_meta()
|
||||
local name = item:get_name()
|
||||
local count = item:get_count()
|
||||
local wear = item:get_wear()
|
||||
local bt_s = i3.ITEM_BTN_SIZE * 1.2
|
||||
local _name = fmt("_%s", name)
|
||||
local pos
|
||||
|
@ -749,7 +752,7 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||
fs("image", X, Y - 0.11, bt_s, bt_s, PNG.slot)
|
||||
fs("item_image_button",
|
||||
X + 0.11, Y, i3.ITEM_BTN_SIZE, i3.ITEM_BTN_SIZE,
|
||||
fmt("%s %u", name, count * (is_recipe and data.scrbar_rcp or data.scrbar_usg or 1)),
|
||||
fmt("%s %u %u", name, count * (is_recipe and data.scrbar_rcp or data.scrbar_usg or 1), wear),
|
||||
_name, "")
|
||||
end
|
||||
|
||||
|
@ -777,7 +780,6 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||
fs(get_tooltip(_name, infos, pos))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function get_grid_fs(fs, data, rcp, is_recipe)
|
||||
local width = rcp.width or 1
|
||||
|
|
|
@ -6,6 +6,10 @@ local mt2 = ItemStack("dye:red")
|
|||
mt2:get_meta():set_string("description", "test red")
|
||||
mt2:get_meta():set_string("color", "#ff0")
|
||||
|
||||
local mt3 = ItemStack("default:pick_diamond")
|
||||
mt3:get_meta():set_string("description", "Worn Pick")
|
||||
mt3:set_wear(10000)
|
||||
|
||||
minetest.register_craft({
|
||||
output = mt:to_string(),
|
||||
type = "shapeless",
|
||||
|
@ -15,6 +19,15 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mt3:to_string(),
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
"default:pick_mese",
|
||||
"default:diamond",
|
||||
},
|
||||
})
|
||||
|
||||
i3.register_craft {
|
||||
url = "https://raw.githubusercontent.com/minetest-mods/i3/main/tests/test_online_recipe.json"
|
||||
}
|
||||
|
|
Ŝarĝante…
Reference in New Issue