~jadedctrl/gem-xwx-moe
Showing details for patch e031bf44b9947859b7d7553c739deb090f36c369.
diff -rN -u old-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/COPYING new-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/COPYING --- old-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/COPYING 1970-01-01 00:00:00.000000000 +0000 +++ new-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/COPYING 2024-12-22 11:06:59.786412090 +0000 @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020-2024 Jaidyn Ann, Jean-Patrick Guerrero. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff -rN -u old-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/init.lua new-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/init.lua --- old-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/init.lua 1970-01-01 00:00:00.000000000 +0000 +++ new-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/init.lua 2024-12-22 11:06:59.786412090 +0000 @@ -0,0 +1,52 @@ +-- Overrides 3d_armor’s get_armor_formspec function, replacing the preview image +-- with a 3d mesh of the player, where possible. +armor.get_armor_formspec = function(self, name, listring) + local formspec = armor.formspec.. + "list[detached:"..name.."_armor;armor;0,0.5;2,3;]" + if listring == true then + formspec = formspec.."listring[current_player;main]".. + "listring[detached:"..name.."_armor;armor]" + end + + local model = player_model_fs(minetest.get_player_by_name(name), "armor_preview", 2.5, .2, 3, 4) + if model then + formspec = formspec:gsub("image%[.*;armor_preview%]", model) + else + formspec = formspec:gsub("armor_preview", armor.textures[name].preview) + end + + formspec = formspec:gsub("armor_level", armor.def[name].level) + + for _, attr in pairs(self.attributes) do + formspec = formspec:gsub("armor_attr_"..attr, armor.def[name][attr]) + end + for group, _ in pairs(self.registered_groups) do + formspec = formspec:gsub("armor_group_"..group, + armor.def[name].groups[group]) + end + return formspec +end + + +-- Creates a formspecs mesh of the player-model. +-- Borrowed from i3 by Jean-Patrick Guerrero: +-- https://github.com/minetest-mods/i3 +function player_model_fs(player, name, x, y, w, h) + local props = player:get_properties() + if props.mesh ~= "" then + local t = {} + local anim = player:get_local_animation() + + for _, v in ipairs(props.textures) do + table.insert(t, (v:gsub(",", "!") and v)) + end + local textures = table.concat(t, ","):gsub("!", ",") + + return string.format( + "model[%f,%f;%f,%f;%s;%s;%s;%s;%s;%s;%s]", + x, y, w, h, + name, props.mesh, textures, "0,-150", "false", "false", + type(anim) == "table" and string.format("%u,%u;30", anim.x, anim.y) or "") + end + return nil +end diff -rN -u old-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/mod.conf new-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/mod.conf --- old-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/mod.conf 1970-01-01 00:00:00.000000000 +0000 +++ new-gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/3d_3d_armor_fs/mod.conf 2024-12-22 11:06:59.786412090 +0000 @@ -0,0 +1,2 @@ +name = 3d_3d_armor_fs +depends = 3d_armor_sfinv, sfinv, default, 3d_armor \ No newline at end of file