Revert "Update leather.lua"

This reverts commit a01813e421.
This commit is contained in:
AFCMS 2021-03-29 21:33:46 +02:00
parent a01813e421
commit c1ea059a14
1 changed files with 26 additions and 39 deletions

View File

@ -1,41 +1,28 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local colorize_value = 125 local colorize_value = 50
local str = string
local longdesc = S("This is a piece of equippable armor which reduces the amount of damage you receive.") local longdesc = S("This is a piece of equippable armor which reduces the amount of damage you receive.")
local usage = S("To equip it, put it on the corresponding armor slot in your inventory menu.") local usage = S("To equip it, put it on the corresponding armor slot in your inventory menu.")
local colors = { local colors = {
-- { ID, decription, wool, dye } -- { ID, decription, wool, dye }
{ "red", "Red", "mcl_dye:red", "#951d1d" }, { "red", "Red", "mcl_dye:red" },
{ "blue", "Blue", "mcl_dye:blue", "#2a2c94" }, { "blue", "Blue", "mcl_dye:blue" },
{ "cyan", "Cyan", "mcl_dye:cyan", "#0d7d8e" }, { "cyan", "Cyan", "mcl_dye:cyan" },
{ "grey", "Grey", "mcl_dye:dark_grey", "#363a3f" }, { "grey", "Grey", "mcl_dye:dark_grey" },
{ "silver", "Light Grey", "mcl_dye:grey", "#818177" }, { "silver", "Light Grey", "mcl_dye:grey" },
{ "black", "Black", "mcl_dye:black", "#020307" }, { "black", "Black", "mcl_dye:black" },
{ "yellow", "Yellow", "mcl_dye:yellow", "#f2b410" }, { "yellow", "Yellow", "mcl_dye:yellow" },
{ "green", "Green", "mcl_dye:dark_green", "#495d20" }, { "green", "Green", "mcl_dye:dark_green" },
{ "magenta", "Magenta", "mcl_dye:magenta", "#ae2ea4" }, { "magenta", "Magenta", "mcl_dye:magenta" },
{ "orange", "Orange", "mcl_dye:orange", "#e36501" }, { "orange", "Orange", "mcl_dye:orange" },
{ "purple", "Purple", "mcl_dye:violet", "#681ba1" }, { "purple", "Purple", "mcl_dye:violet" },
{ "brown", "Brown", "mcl_dye:brown", "#623b1a" }, { "brown", "Brown", "mcl_dye:brown" },
{ "pink", "Pink", "mcl_dye:pink", "#d66691" }, { "pink", "Pink", "mcl_dye:pink" },
{ "lime", "Lime", "mcl_dye:green", "#60ad13" }, { "lime", "Lime", "mcl_dye:green" },
{ "light_blue", "Light Blue", "mcl_dye:lightblue", "#1f8eca" }, { "light_blue", "Light Blue", "mcl_dye:lightblue" },
{ "white", "White", "mcl_dye:white", "#d1d7d8" }, { "white", "White", "mcl_dye:white" },
} }
--local function get_color_rgb(color)
-- return tonumber(str.sub(first, 2, 3)), tonumber(str.sub(first, 4, 5)), tonumber(str.sub(first, 6, 7))
--end
local function calculate_color(first, last)
--local first_r = tonumber(str.sub(first, 2, 3))
--local first_g = tonumber(str.sub(first, 4, 5))
return tonumber(first)*tonumber(last)
end
local function get_on_armor_leather_use(itemname, raw) local function get_on_armor_leather_use(itemname, raw)
local function on_armor_leather_use(itemstack, user, pointed_thing) local function on_armor_leather_use(itemstack, user, pointed_thing)
if not user or user:is_player() == false then if not user or user:is_player() == false then
@ -105,8 +92,8 @@ for _,first_color in ipairs(colors) do
description = S("Leather Cap "..first_color[2]), description = S("Leather Cap "..first_color[2]),
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usage, _doc_items_usagehelp = usage,
inventory_image = "mcl_armor_inv_helmet_leather.png^[colorize:"..first_color[4]..":"..colorize_value, inventory_image = "mcl_armor_inv_helmet_leather.png^[colorize:"..first_color[1]..":"..colorize_value,
texture = "mcl_armor_helmet_leather.png^[colorize:"..first_color[4]..":"..colorize_value, texture = "mcl_armor_helmet_leather.png^[colorize:"..first_color[1]..":"..colorize_value,
groups = {armor_head=1, mcl_armor_points=1, mcl_armor_uses=56, enchantability=15}, --TODO: add not_in_creative_inventory=1 groups = {armor_head=1, mcl_armor_points=1, mcl_armor_uses=56, enchantability=15}, --TODO: add not_in_creative_inventory=1
_repair_material = "mcl_mobitems:leather", _repair_material = "mcl_mobitems:leather",
sounds = { sounds = {
@ -121,8 +108,8 @@ for _,first_color in ipairs(colors) do
description = S("Leather Tunic "..first_color[2]), description = S("Leather Tunic "..first_color[2]),
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usage, _doc_items_usagehelp = usage,
inventory_image = "mcl_armor_inv_chestplate_leather.png^[colorize:"..first_color[4]..":"..colorize_value, inventory_image = "mcl_armor_inv_chestplate_leather.png^[colorize:"..first_color[1]..":"..colorize_value,
texture = "mcl_armor_chestplate_leather.png^[colorize:"..first_color[4]..":"..colorize_value, texture = "mcl_armor_chestplate_leather.png^[colorize:"..first_color[1]..":"..colorize_value,
groups = {armor_torso=1, mcl_armor_points=3, mcl_armor_uses=81, enchantability=15 }, groups = {armor_torso=1, mcl_armor_points=3, mcl_armor_uses=81, enchantability=15 },
_repair_material = "mcl_mobitems:leather", _repair_material = "mcl_mobitems:leather",
sounds = { sounds = {
@ -137,8 +124,8 @@ for _,first_color in ipairs(colors) do
description = S("Leather Pants "..first_color[2]), description = S("Leather Pants "..first_color[2]),
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usage, _doc_items_usagehelp = usage,
inventory_image = "mcl_armor_inv_leggings_leather.png^[colorize:"..first_color[4]..":"..colorize_value, inventory_image = "mcl_armor_inv_leggings_leather.png^[colorize:"..first_color[1]..":"..colorize_value,
texture = "mcl_armor_leggings_leather.png^[colorize:"..first_color[4]..":"..colorize_value, texture = "mcl_armor_leggings_leather.png^[colorize:"..first_color[1]..":"..colorize_value,
groups = {armor_legs=1, mcl_armor_points=2, mcl_armor_uses=76, enchantability=15 }, groups = {armor_legs=1, mcl_armor_points=2, mcl_armor_uses=76, enchantability=15 },
_repair_material = "mcl_mobitems:leather", _repair_material = "mcl_mobitems:leather",
sounds = { sounds = {
@ -153,8 +140,8 @@ for _,first_color in ipairs(colors) do
description = S("Leather Boots "..first_color[2]), description = S("Leather Boots "..first_color[2]),
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usage, _doc_items_usagehelp = usage,
inventory_image = "mcl_armor_inv_boots_leather.png^[colorize:"..first_color[4]..":"..colorize_value, inventory_image = "mcl_armor_inv_boots_leather.png^[colorize:"..first_color[1]..":"..colorize_value,
texture = "mcl_armor_boots_leather.png^[colorize:"..first_color[4]..":"..colorize_value, texture = "mcl_armor_boots_leather.png^[colorize:"..first_color[1]..":"..colorize_value,
groups = {armor_feet=1, mcl_armor_points=1, mcl_armor_uses=66, enchantability=15 }, groups = {armor_feet=1, mcl_armor_points=1, mcl_armor_uses=66, enchantability=15 },
_repair_material = "mcl_mobitems:leather", _repair_material = "mcl_mobitems:leather",
sounds = { sounds = {
@ -274,4 +261,4 @@ end
-- minetest.chat_send_all(itemcount) -- minetest.chat_send_all(itemcount)
--end) --end)
minetest.log("info", "[mcl_armor] "..itemcount.." leather armor pieces have been registered") minetest.log("info", "[mcl_armor] "..itemcount.." leather armor pieces have been registered")