Cauldron leather armor washing
parent
3d799266c3
commit
3fa4cf6d52
|
@ -103,10 +103,10 @@ local function get_armor_texture(textures, name, modname, itemname, itemstring)
|
||||||
end
|
end
|
||||||
|
|
||||||
if overlay == "" then return core_armor_texture end -- key not present; armor not trimmed
|
if overlay == "" then return core_armor_texture end -- key not present; armor not trimmed
|
||||||
|
|
||||||
return core_armor_texture .. overlay
|
return core_armor_texture .. overlay
|
||||||
end
|
end
|
||||||
|
|
||||||
return func
|
return func
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -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]
|
||||||
|
@ -326,12 +327,12 @@ end
|
||||||
tt.register_snippet(function(itemstring, toolcaps, stack)
|
tt.register_snippet(function(itemstring, toolcaps, stack)
|
||||||
if not stack then return nil end
|
if not stack then return nil end
|
||||||
local meta = stack:get_meta()
|
local meta = stack:get_meta()
|
||||||
if not mcl_armor.is_trimmed(stack) then return nil end
|
if not mcl_armor.is_trimmed(stack) then return nil end
|
||||||
-- we need to get the part of the overlay image between the overlay begin ( and the trim name end _
|
-- we need to get the part of the overlay image between the overlay begin ( and the trim name end _
|
||||||
-- we COULD easily store this info in meta, but that would bloat the meta storage, as the same few values would be stored over and over again on every trimmed item
|
-- we COULD easily store this info in meta, but that would bloat the meta storage, as the same few values would be stored over and over again on every trimmed item
|
||||||
-- this is fine here as this code gets only executed when you put armor and a trim in a smithing table
|
-- this is fine here as this code gets only executed when you put armor and a trim in a smithing table
|
||||||
local full_overlay = meta:get_string("mcl_armor:trim_overlay")
|
local full_overlay = meta:get_string("mcl_armor:trim_overlay")
|
||||||
local trim_name = full_overlay:match("%((.-)%_")
|
local trim_name = full_overlay:match("%((.-)%_")
|
||||||
return "Upgrade:\n " .. trim_name:gsub("^%l", string.upper) .. " Armor Trim"
|
return "Upgrade:\n " .. trim_name:gsub("^%l", string.upper) .. " Armor Trim"
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -339,4 +340,4 @@ function mcl_armor.is_trimmed(itemstack)
|
||||||
-- this meta value will be there for every trimmed armor piece
|
-- this meta value will be there for every trimmed armor piece
|
||||||
-- remember, get_string returns "" if the key doesn't exist
|
-- remember, get_string returns "" if the key doesn't exist
|
||||||
return itemstack:get_meta():get_string("mcl_armor:trim_overlay") ~= ""
|
return itemstack:get_meta():get_string("mcl_armor:trim_overlay") ~= ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue