some stuff

This commit is contained in:
AFCMS 2021-11-15 10:07:03 +01:00
parent 3312aa3201
commit 409444e3e0
3 changed files with 24 additions and 9 deletions

View File

@ -1,8 +1,7 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local colorize_value = 125 local modifier = "^[colorize:%s:".. 175
local modifier = "[colorize:<color>:"..colorize_value
local str = string local string = 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.")
@ -43,7 +42,7 @@ local function get_texture_function(texture)
if color == "" or color == nil then if color == "" or color == nil then
return texture return texture
else else
return texture.."[colorize:"..color..":"..colorize_value return texture .. string.format(modifier, color)
end end
end end
return get_texture return get_texture
@ -66,10 +65,10 @@ mcl_armor.register_set({
feet = 1, feet = 1,
}, },
textures = { textures = {
head = get_texture_function("mcl_armor_helmet_leather.png"), head = get_texture_function("mcl_armor_helmet_leather_colored.png"),
torso = get_texture_function("mcl_armor_chestplate_leather.png"), torso = get_texture_function("mcl_armor_chestplate_leather_colored.png"),
legs = get_texture_function("mcl_armor_leggings_leather.png"), legs = get_texture_function("mcl_armor_leggings_leather_colored.png"),
feet = get_texture_function("mcl_armor_boots_leather.png"), feet = get_texture_function("mcl_armor_boots_leather_colored.png"),
}, },
repair_material = "mcl_mobitems:leather", repair_material = "mcl_mobitems:leather",
}) })
@ -82,7 +81,23 @@ minetest.register_chatcommand("colort", {
if player then if player then
local item = player:get_wielded_item() local item = player:get_wielded_item()
item:get_meta():set_string("color", "#951d1d") item:get_meta():set_string("color", "#951d1d")
player:set_wielded_item(item)
mcl_armor.update(player) mcl_armor.update(player)
end end
end, end,
}) })
minetest.register_craft({
type = "shapeless",
output = "mcl_armor:leggings_leather_colored",
recipe = {
"mcl_armor:leggings_leather",
"mcl_dye:blue",
},
})
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
if itemstack:get_name() == "mcl_armor:leggings_leather_colored" then
return itemstack:get_meta():set_string("color", "#2a2c94")
end
end)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 5.1 KiB