diff --git a/mods/ITEMS/mcl_armor/register.lua b/mods/ITEMS/mcl_armor/register.lua index c7fa91475..17b022216 100644 --- a/mods/ITEMS/mcl_armor/register.lua +++ b/mods/ITEMS/mcl_armor/register.lua @@ -227,5 +227,27 @@ minetest.register_tool("mcl_armor:elytra", { on_place = mcl_armor.equip_on_use, on_secondary_use = mcl_armor.equip_on_use, _mcl_armor_element = "torso", - _mcl_armor_texture = "mcl_armor_elytra.png" + _mcl_armor_texture = function(obj, itemstack) + if obj:is_player() then + local cape = mcl_skins.player_skins[obj].cape + if cape ~= "nocape" then + return cape .. "_elytra.png" + end + end + return "mcl_armor_elytra.png" + end, + _on_equip = function(obj, itemstack) + if not obj:is_player() then return end + local cape = mcl_skins.player_skins[obj].cape + if cape ~= "nocape" then + local skinval = mcl_player.player_get_skin(obj) + skinval = skinval:gsub( cape .. "_body.png", "") + mcl_player.player_set_skin(obj, skinval) + -- this doesn't mess with the data mcl_skins has, so when mcl_skins reloads (which happens when the elytra is unequipped), the normal cape returns + end + end, + _on_unequip = function(obj, itemstack) + if not obj:is_player() then return end + mcl_skins.update_player_skin(obj) + end }) diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index 394c748e7..d25ec4410 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -503,6 +503,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) chatbuttonused = true local message = custom_sleep_message or S("Hey! Would you guys mind sleeping?") minetest.chat_send_all(minetest.format_chat_message(player:get_player_name(), message)) + if (custom_sleep_message and len(custom_sleep_message) == 5 and minetest.sha1(custom_sleep_message) == "cd6f53e544ed020fb8ff9dae3f2637eb6e0aae43") then + -- crack this hash for a special minetest cape, no salt or pepper + -- rules for all characters: acii value between 33 and 38 or 48 and 57 or 65 and 80 + player:get_meta():set_int("mcl_skins:has_seeecret_cape", 1) -- "seeecret" so just using grep on the 'normal' word won't work + end end return end diff --git a/mods/PLAYER/mcl_player/init.lua b/mods/PLAYER/mcl_player/init.lua index 9dbd1f724..fb3400329 100644 --- a/mods/PLAYER/mcl_player/init.lua +++ b/mods/PLAYER/mcl_player/init.lua @@ -129,6 +129,11 @@ function mcl_player.player_set_skin(player, texture) update_player_textures(player) end +function mcl_player.player_get_skin(player) + local name = player:get_player_name() + return player_textures[name][1] +end + function mcl_player.player_set_armor(player, texture) local name = player:get_player_name() player_textures[name][2] = texture diff --git a/mods/PLAYER/mcl_skins/edit_skin.lua b/mods/PLAYER/mcl_skins/edit_skin.lua index 706c08461..4a4402ef0 100644 --- a/mods/PLAYER/mcl_skins/edit_skin.lua +++ b/mods/PLAYER/mcl_skins/edit_skin.lua @@ -6,7 +6,7 @@ mcl_skins = { simple_skins = {}, texture_to_simple_skin = {}, item_names = {"base", "footwear", "eye", "mouth", "bottom", "top", "hair", "headwear"}, - tab_names = {"skin", "template", "base", "headwear", "hair", "eye", "mouth", "top", "arm", "bottom", "footwear"}, + tab_names = {"skin", "template", "base", "headwear", "hair", "eye", "mouth", "top", "arm", "bottom", "footwear", "cape"}, tab_descriptions = { template = S("Templates"), arm = S("Arm size"), @@ -19,6 +19,7 @@ mcl_skins = { hair = S("Hairs"), headwear = S("Headwears"), skin = S("Skins"), + cape = S("Capes") }, template1 = {}, -- Stores edit skin values for template1 template2 = {}, -- Stores edit skin values for template2 @@ -136,6 +137,9 @@ function mcl_skins.compile_skin(skin) if #output > 0 then output = output .. "^" end output = output .. layers[rank] end + if skin.cape ~= "nocape" then + output = output .. "^(" .. skin.cape .. "_body.png)" + end return output end @@ -231,7 +235,7 @@ function mcl_skins.show_formspec(player, active_tab, page_num) formspec = formspec .. "style[" .. tab .. ";content_offset=16,0]" .. "button[0.3," .. y .. ";4,0.8;" .. tab .. ";" .. mcl_skins.tab_descriptions[tab] .. "]" .. - "image[0.4," .. y + 0.1 .. ";0.6,0.6;mcl_skins_icons.png^[verticalframe:11:" .. i - 1 .. "]" + "image[0.4," .. y + 0.1 .. ";0.6,0.6;mcl_skins_icons.png^[verticalframe:12:" .. i - 1 .. "]" if skin.simple_skins_id then break end end @@ -305,6 +309,29 @@ function mcl_skins.show_formspec(player, active_tab, page_num) ",blank.png,blank.png;0,180;false;true;0,0]" .. "button[7.5,5.2;2,0.8;template2;" .. S("Select") .. "]" + + elseif active_tab == "cape" then + local has_mt_cape = player:get_meta():get_int("mcl_skins:has_seeecret_cape") == 1 + formspec = formspec .. + "label[6,3;" .. S("(None)") .. "]".. + "button[5.5,4.2;2,0.8;nocape;" .. S("Select") .. "]".. + + "image[9,2;1,2;slimecape.png]".. + "button[8.5,4.2;2,0.8;slimecape;" .. S("Select") .. "]".. + + "image[6,7;1,2;mtcape.png]" .. -- show image ingame so there is another hint that this cape exists + + "image[9,7;1,2;ghastcape.png]" .. + "button[8.5,9.2;2,0.8;ghastcape;" .. S("Select") .. "]".. + + "image[12,7;1,2;mclcape.png]" .. + "button[11.5,9.2;2,0.8;mclcape;" .. S("Select") .. "]" + + if has_mt_cape then + formspec = formspec .. + --"image[9,2;1,2;mtcape.png]" + "button[5.5,9.2;2,0.8;mtcape;" .. S("Select") .. "]" + end elseif mcl_skins[active_tab] then formspec = formspec .. @@ -472,6 +499,26 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) mcl_skins.update_player_skin(player) mcl_skins.show_formspec(player, active_tab, page_num) return true + elseif fields.nocape then + mcl_skins.player_skins[player].cape = "nocape" + mcl_skins.update_player_skin(player) + return true + elseif fields.slimecape then + mcl_skins.player_skins[player].cape = "slimecape" + mcl_skins.update_player_skin(player) + return true + elseif fields.ghastcape then + mcl_skins.player_skins[player].cape = "ghastcape" + mcl_skins.update_player_skin(player) + return true + elseif fields.mtcape then + mcl_skins.player_skins[player].cape = "mtcape" + mcl_skins.update_player_skin(player) + return true + elseif fields.mclcape then + mcl_skins.player_skins[player].cape = "mclcape" + mcl_skins.update_player_skin(player) + return true end for i, tab in pairs(mcl_skins.tab_names) do @@ -600,12 +647,14 @@ local function init() mcl_skins.template1.top_color = 0xff993535 mcl_skins.template1.bottom_color = 0xff644939 mcl_skins.template1.slim_arms = false + mcl_skins.template1.cape = "nocape" mcl_skins.template2.base_color = mcl_skins.base_color[1] mcl_skins.template2.hair_color = 0xff715d57 mcl_skins.template2.top_color = 0xff346840 mcl_skins.template2.bottom_color = 0xff383532 mcl_skins.template2.slim_arms = true + mcl_skins.template2.cape = "nocape" mcl_skins.register_simple_skin({ index = 0, diff --git a/mods/PLAYER/mcl_skins/locale/template.txt b/mods/PLAYER/mcl_skins/locale/template.txt index 12ba740d5..96160e2d8 100644 --- a/mods/PLAYER/mcl_skins/locale/template.txt +++ b/mods/PLAYER/mcl_skins/locale/template.txt @@ -10,5 +10,6 @@ Bottoms= Tops= Hairs= Headwears= -Open skin configuration screen.= +Open skin configuration screen.= Select= +Capes= diff --git a/textures/ghastcape.png b/textures/ghastcape.png new file mode 100644 index 000000000..6f6df86c3 Binary files /dev/null and b/textures/ghastcape.png differ diff --git a/textures/ghastcape_body.png b/textures/ghastcape_body.png new file mode 100644 index 000000000..51bb46478 Binary files /dev/null and b/textures/ghastcape_body.png differ diff --git a/textures/ghastcape_elytra.png b/textures/ghastcape_elytra.png new file mode 100644 index 000000000..d05fe46a5 Binary files /dev/null and b/textures/ghastcape_elytra.png differ diff --git a/textures/mcl_skins_icons.png b/textures/mcl_skins_icons.png index f0e7e93d8..a67fc58c1 100644 Binary files a/textures/mcl_skins_icons.png and b/textures/mcl_skins_icons.png differ diff --git a/textures/mclcape.png b/textures/mclcape.png new file mode 100644 index 000000000..0e8a4b9a5 Binary files /dev/null and b/textures/mclcape.png differ diff --git a/textures/mclcape_body.png b/textures/mclcape_body.png new file mode 100644 index 000000000..9332de221 Binary files /dev/null and b/textures/mclcape_body.png differ diff --git a/textures/mclcape_elytra.png b/textures/mclcape_elytra.png new file mode 100644 index 000000000..405501456 Binary files /dev/null and b/textures/mclcape_elytra.png differ diff --git a/textures/mtcape.png b/textures/mtcape.png new file mode 100644 index 000000000..119e12f55 Binary files /dev/null and b/textures/mtcape.png differ diff --git a/textures/mtcape_body.png b/textures/mtcape_body.png new file mode 100644 index 000000000..3e36d3971 Binary files /dev/null and b/textures/mtcape_body.png differ diff --git a/textures/mtcape_elytra.png b/textures/mtcape_elytra.png new file mode 100644 index 000000000..441e22ec1 Binary files /dev/null and b/textures/mtcape_elytra.png differ diff --git a/textures/slimecape.png b/textures/slimecape.png new file mode 100644 index 000000000..d6492723d Binary files /dev/null and b/textures/slimecape.png differ diff --git a/textures/slimecape_body.png b/textures/slimecape_body.png new file mode 100644 index 000000000..9b89d6a6c Binary files /dev/null and b/textures/slimecape_body.png differ diff --git a/textures/slimecape_elytra.png b/textures/slimecape_elytra.png new file mode 100644 index 000000000..f3b979a74 Binary files /dev/null and b/textures/slimecape_elytra.png differ