Cauldron leather armor washing

This commit is contained in:
the-real-herowl 2024-01-25 11:56:54 +01:00 committed by the-real-herowl
parent 3d799266c3
commit 3fa4cf6d52
3 changed files with 22 additions and 10 deletions

View File

@ -129,6 +129,7 @@ function mcl_armor.register_set(def)
local groups = table.copy(groups) local groups = table.copy(groups)
groups["armor_" .. name] = 1 groups["armor_" .. name] = 1
groups["combat_armor_" .. name] = 1 groups["combat_armor_" .. name] = 1
groups["armor_" .. def.name] = 1
groups.armor = 1 groups.armor = 1
groups.combat_armor = 1 groups.combat_armor = 1
groups.mcl_armor_points = def.points[name] groups.mcl_armor_points = def.points[name]

View File

@ -53,10 +53,10 @@ local function get_texture_function(texture)
end end
if mcl_enchanting.is_enchanted(itemstack:get_name()) then if mcl_enchanting.is_enchanted(itemstack:get_name()) then
minetest.chat_send_all(out..mcl_enchanting.overlay) -- minetest.chat_send_all(out..mcl_enchanting.overlay) -- TODO remove
return out..mcl_enchanting.overlay return out..mcl_enchanting.overlay
else else
minetest.chat_send_all(out) -- minetest.chat_send_all(out) -- TODO remove
return out return out
end end
end end
@ -64,6 +64,9 @@ local function get_texture_function(texture)
end end
function mcl_armor.colorize_leather_armor(itemstack, colorstring) function mcl_armor.colorize_leather_armor(itemstack, colorstring)
if not itemstack or minetest.get_item_group(itemstack:get_name(), "armor_leather") == 0 then
return
end
local color = color_string_to_table(colorstring) local color = color_string_to_table(colorstring)
local meta = itemstack:get_meta() local meta = itemstack:get_meta()
local old_color = meta:get_string("mcl_armor:color") local old_color = meta:get_string("mcl_armor:color")
@ -83,7 +86,7 @@ function mcl_armor.colorize_leather_armor(itemstack, colorstring)
end end
function mcl_armor.wash_leather_armor(itemstack) function mcl_armor.wash_leather_armor(itemstack)
if not itemstack or not itemstack:get_definition().groups.armor_leather == 1 then if not itemstack or minetest.get_item_group(itemstack:get_name(), "armor_leather") == 0 then
return return
end end
local meta = itemstack:get_meta() local meta = itemstack:get_meta()
@ -119,7 +122,7 @@ mcl_armor.register_set({
}) })
tt.register_priority_snippet(function(_, _, itemstack) tt.register_priority_snippet(function(_, _, itemstack)
if not itemstack or not itemstack:get_definition().groups.armor_leather == 1 then if not itemstack or minetest.get_item_group(itemstack:get_name(), "armor_leather") == 0 then
return return
end end
local color = itemstack:get_meta():get_string("mcl_armor:color") local color = itemstack:get_meta():get_string("mcl_armor:color")
@ -137,7 +140,7 @@ minetest.register_chatcommand("color_leather", {
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
if player then if player then
local item = player:get_wielded_item() local item = player:get_wielded_item()
if not item or not item:get_definition().groups.armor_leather == 1 then if not item or minetest.get_item_group(item:get_name(), "armor_leather") == 0 then
return false, "Not leather armor." return false, "Not leather armor."
end end
if param == "wash" then if param == "wash" then

View File

@ -94,6 +94,14 @@ local function register_filled_cauldron(water_level, description, liquid)
drop = "mcl_cauldrons:cauldron", drop = "mcl_cauldrons:cauldron",
_mcl_hardness = 2, _mcl_hardness = 2,
_mcl_blast_resistance = 2, _mcl_blast_resistance = 2,
on_rightclick = function(pos, node, player, itemstack)
local outcome = mcl_armor.wash_leather_armor(itemstack)
if outcome then
minetest.sound_play("mcl_potions_bottle_pour",
{pos=pos, gain=0.5, max_hear_range=16},true)
end
return outcome
end,
}) })
-- Add entry aliases for the Help -- Add entry aliases for the Help