add basic tooltip to colored armor

This commit is contained in:
AFCMS 2022-05-01 00:52:25 +02:00
parent d9fef2966f
commit 459f142fc5
No known key found for this signature in database
GPG key ID: 8720389A25B652E3
2 changed files with 15 additions and 1 deletions

View file

@ -82,8 +82,21 @@ mcl_armor.register_set({
feet = "mcl_armor_inv_boots_leather.png", feet = "mcl_armor_inv_boots_leather.png",
}, },
repair_material = "mcl_mobitems:leather", repair_material = "mcl_mobitems:leather",
groups = {armor_leather_colored = 1},
}) })
tt.register_priority_snippet(function(_, _, itemstack)
if not itemstack or not itemstack:get_definition().groups.armor_leather_colored == 1 then
return
end
local color = itemstack:get_meta():get_string("color")
if color and color ~= "" then
local text = "Color: "..color
return text, false
end
end)
-- This command is only temporary -- This command is only temporary
minetest.register_chatcommand("color_leather", { minetest.register_chatcommand("color_leather", {
@ -94,6 +107,7 @@ minetest.register_chatcommand("color_leather", {
if player then if player then
local item = player:get_wielded_item() local item = player:get_wielded_item()
item:get_meta():set_string("color", param) item:get_meta():set_string("color", param)
tt.reload_itemstack_description(item)
player:set_wielded_item(item) player:set_wielded_item(item)
return true, "Done." return true, "Done."
else else

View file

@ -1,5 +1,5 @@
name = mcl_armor name = mcl_armor
author = stu author = stu
description = Adds craftable armor that is visible to other players. description = Adds craftable armor that is visible to other players.
depends = mcl_core, mcl_player, mcl_enchanting, mcl_damage depends = mcl_core, mcl_player, mcl_enchanting, mcl_damage, tt
optional_depends = mcl_fire, ethereal, bakedclay optional_depends = mcl_fire, ethereal, bakedclay