1
0
Fork 0

add basic tooltip to colored armor

This commit is contained in:
AFCMS 2022-05-01 00:52:25 +02:00
parent d9fef2966f
commit 459f142fc5
Signed by untrusted user: AFCMS
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",
},
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
minetest.register_chatcommand("color_leather", {
@ -94,6 +107,7 @@ minetest.register_chatcommand("color_leather", {
if player then
local item = player:get_wielded_item()
item:get_meta():set_string("color", param)
tt.reload_itemstack_description(item)
player:set_wielded_item(item)
return true, "Done."
else

View File

@ -1,5 +1,5 @@
name = mcl_armor
author = stu
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