Compare commits

...

24 Commits

Author SHA1 Message Date
AFCMS 409444e3e0 some stuff 2021-11-15 10:07:03 +01:00
AFCMS 3312aa3201 some work on colored leathered armors 2021-11-14 18:28:57 +01:00
AFCMS c49c5dec67 Merge branch 'master' into dyable-leather-armor 2021-11-14 18:01:06 +01:00
AFCMS 45ca8dfbfb Merge branch 'master' into dyable-leather-armor 2021-05-27 09:09:52 +02:00
AFCMS 39481d8b10 Merge branch 'master' into dyable-leather-armor 2021-05-19 00:19:58 +02:00
AFCMS 422d48f658 Merge branch 'master' into dyable-leather-armor 2021-05-10 09:39:20 +02:00
AFCMS c1eefab8d6 Merge branch 'master' into dyable-leather-armor 2021-05-04 10:30:10 +02:00
AFCMS e573dd25e1 Merge branch 'master' into dyable-leather-armor 2021-05-03 23:26:05 +02:00
AFCMS 98226d677c not working implementation of colored leather armors 2021-04-29 16:47:18 +02:00
AFCMS 547291c333 restart form scratch 2021-04-29 16:24:34 +02:00
AFCMS 5637b649e8 fix merge 2021-04-29 16:23:24 +02:00
AFCMS 16b4a6e5c2 Merge branch 'master' into dyable-leather-armor 2021-04-29 16:22:32 +02:00
AFCMS fb0a687bdc Merge branch 'master' into dyable-leather-armor 2021-04-16 13:45:05 +02:00
AFCMS 2aa7218126 Merge branch 'master' into dyable-leather-armor 2021-04-13 12:12:00 +02:00
AFCMS e0aa16cf06 Merge branch 'master' into dyable-leather-armor 2021-03-31 20:33:28 +02:00
AFCMS 69629d4ca3 Merge branch 'master' into dyable-leather-armor 2021-03-31 16:15:44 +02:00
AFCMS e7166430d7 Merge branch 'master' into dyable-leather-armor 2021-03-30 22:28:25 +02:00
AFCMS 31027aca2e Avoid unnecessary registration 2021-03-29 21:39:04 +02:00
AFCMS 9990db92b4 Revert "Revert "Update leather.lua""
This reverts commit c1ea059a14.
2021-03-29 21:35:15 +02:00
AFCMS c1ea059a14 Revert "Update leather.lua"
This reverts commit a01813e421.
2021-03-29 21:33:46 +02:00
AFCMS a01813e421 Update leather.lua 2021-03-29 21:33:27 +02:00
AFCMS d7ae8c62db Merge branch 'master' into dyable-leather-armor 2021-03-29 18:50:52 +02:00
AFCMS 2d585c9517 basic dyable armors 2021-03-29 18:39:23 +02:00
AFCMS 896b213f17 optimisation 2021-03-27 08:02:50 +01:00
5 changed files with 105 additions and 1 deletions

View File

@ -1,4 +1,5 @@
local S = minetest.get_translator(minetest.get_current_modname())
local modpath = minetest.get_modpath(minetest.get_current_modname())
mcl_armor = {
longdesc = S("This is a piece of equippable armor which reduces the amount of damage you receive."),
@ -59,10 +60,10 @@ mcl_armor = {
player_view_range_factors = {},
}
local modpath = minetest.get_modpath("mcl_armor")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/player.lua")
dofile(modpath .. "/damage.lua")
dofile(modpath .. "/register.lua")
dofile(modpath .. "/alias.lua")
dofile(modpath .. "/leather.lua")

View File

@ -0,0 +1,103 @@
local S = minetest.get_translator(minetest.get_current_modname())
local modifier = "^[colorize:%s:".. 175
local string = string
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 colors = {
-- { ID, decription, wool, dye }
{ "red", "Red", "mcl_dye:red", "#951d1d" },
{ "blue", "Blue", "mcl_dye:blue", "#2a2c94" },
{ "cyan", "Cyan", "mcl_dye:cyan", "#0d7d8e" },
{ "grey", "Grey", "mcl_dye:dark_grey", "#363a3f" },
{ "silver", "Light Grey", "mcl_dye:grey", "#818177" },
{ "black", "Black", "mcl_dye:black", "#020307" },
{ "yellow", "Yellow", "mcl_dye:yellow", "#f2b410" },
{ "green", "Green", "mcl_dye:dark_green", "#495d20" },
{ "magenta", "Magenta", "mcl_dye:magenta", "#ae2ea4" },
{ "orange", "Orange", "mcl_dye:orange", "#e36501" },
{ "purple", "Purple", "mcl_dye:violet", "#681ba1" },
{ "brown", "Brown", "mcl_dye:brown", "#623b1a" },
{ "pink", "Pink", "mcl_dye:pink", "#d66691" },
{ "lime", "Lime", "mcl_dye:green", "#60ad13" },
{ "light_blue", "Light Blue", "mcl_dye:lightblue", "#1f8eca" },
{ "white", "White", "mcl_dye:white", "#d1d7d8" },
}
--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_texture_function(texture)
local function get_texture(obj, itemstack)
local color = itemstack:get_meta():get_string("color")
if color == "" or color == nil then
return texture
else
return texture .. string.format(modifier, color)
end
end
return get_texture
end
mcl_armor.register_set({
name = "leather_colored",
description = "Colored Leather",
descriptions = {
head = "Cap",
torso = "Tunic",
legs = "Pants",
},
durability = 80,
enchantability = 15,
points = {
head = 1,
torso = 3,
legs = 2,
feet = 1,
},
textures = {
head = get_texture_function("mcl_armor_helmet_leather_colored.png"),
torso = get_texture_function("mcl_armor_chestplate_leather_colored.png"),
legs = get_texture_function("mcl_armor_leggings_leather_colored.png"),
feet = get_texture_function("mcl_armor_boots_leather_colored.png"),
},
repair_material = "mcl_mobitems:leather",
})
minetest.register_chatcommand("colort", {
params = "", -- Short parameter description
description = "Remove privilege from player", -- Full description
func = function(name, param)
local player = minetest.get_player_by_name(name)
if player then
local item = player:get_wielded_item()
item:get_meta():set_string("color", "#951d1d")
player:set_wielded_item(item)
mcl_armor.update(player)
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.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B