From 22083a0ff59d9bdd99ecad58be2e1fcf0b6efefd Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 2 Nov 2020 17:22:03 +0100 Subject: [PATCH] Armor textures support --- mods/CORE/mcl_enchanting/enchantments.lua | 2 +- mods/CORE/mcl_enchanting/engine.lua | 4 ++-- mods/CORE/mcl_enchanting/init.lua | 2 +- mods/ITEMS/mcl_armor/armor.lua | 8 +++++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mods/CORE/mcl_enchanting/enchantments.lua b/mods/CORE/mcl_enchanting/enchantments.lua index 07d302e3a..e48e84572 100644 --- a/mods/CORE/mcl_enchanting/enchantments.lua +++ b/mods/CORE/mcl_enchanting/enchantments.lua @@ -460,7 +460,7 @@ mcl_enchanting.enchantments.thorns = { requires_tool = false, } --- for tools & weapons implemented via on_enchant; for bows implemented in mcl_bows, unimplemented Armor and Fishing Rods +-- for tools & weapons implemented via on_enchant; for bows implemented in mcl_bows; for armor implemented in mcl_armor and mcl_tt; unimplemented for Fishing Rods mcl_enchanting.enchantments.unbreaking = { name = "Unbreaking", max_level = 3, diff --git a/mods/CORE/mcl_enchanting/engine.lua b/mods/CORE/mcl_enchanting/engine.lua index 349e8882a..ae04e3ed6 100644 --- a/mods/CORE/mcl_enchanting/engine.lua +++ b/mods/CORE/mcl_enchanting/engine.lua @@ -215,9 +215,9 @@ function mcl_enchanting.initialize() local new_name = itemname .. "_enchanted" minetest.override_item(itemname, {_mcl_enchanting_enchanted_tool = new_name}) local new_def = table.copy(itemdef) - new_def.inventory_image = itemdef.inventory_image .. "^[colorize:purple:50" + new_def.inventory_image = itemdef.inventory_image .. "^[brighten^[colorize:purple:50" if new_def.wield_image then - new_def.wield_image = new_def.wield_image .. "^[colorize:purple:50" + new_def.wield_image = new_def.wield_image .. "^[brighten^[colorize:purple:50" end new_def.groups.not_in_creative_inventory = 1 new_def.groups.enchanted = 1 diff --git a/mods/CORE/mcl_enchanting/init.lua b/mods/CORE/mcl_enchanting/init.lua index 2181ef978..2398dc8b4 100644 --- a/mods/CORE/mcl_enchanting/init.lua +++ b/mods/CORE/mcl_enchanting/init.lua @@ -5,7 +5,7 @@ mcl_enchanting = { book_offset = vector.new(0, 0.75, 0), roman_numerals = dofile(modpath .. "/roman_numerals.lua"), -- https://exercism.io/tracks/lua/exercises/roman-numerals/solutions/73c2fb7521e347209312d115f872fa49 enchantments = {}, - debug = true, + debug = false, } dofile(modpath .. "/engine.lua") diff --git a/mods/ITEMS/mcl_armor/armor.lua b/mods/ITEMS/mcl_armor/armor.lua index 5387aa701..6f95baa72 100644 --- a/mods/ITEMS/mcl_armor/armor.lua +++ b/mods/ITEMS/mcl_armor/armor.lua @@ -119,7 +119,7 @@ armor.set_player_armor = function(self, player) local textures = {} local physics_o = {speed=1,gravity=1,jump=1} local material = {type=nil, count=1} - local preview = armor:get_preview(name) or "character_preview.png" + local preview for _,v in ipairs(self.elements) do elements[v] = false end @@ -136,8 +136,9 @@ armor.set_player_armor = function(self, player) local level = def.groups["armor_"..k] if level then local texture = def.texture or item:gsub("%:", "_") - table.insert(textures, texture..".png") - preview = preview.."^"..texture.."_preview.png" + local enchanted = mcl_enchanting.is_enchanted_def(item) + table.insert(textures, "("..texture..".png"..(enchanted and "^[brighten^[colorize:purple:50" or "")..")") + preview = "(player.png^[opacity:0^"..texture.."_preview.png"..(enchanted and "^[brighten^[colorize:purple:50" or "")..")"..(preview and "^"..preview or "") armor_level = armor_level + level items = items + 1 mcl_armor_points = mcl_armor_points + (def.groups["mcl_armor_points"] or 0) @@ -161,6 +162,7 @@ armor.set_player_armor = function(self, player) end end end + preview = (armor:get_preview(name) or "character_preview.png")..(preview and "^"..preview or "") if minetest.get_modpath("shields") then armor_level = armor_level * 0.9 end