diff --git a/3d_armor/README.txt b/3d_armor/README.txt index 2515832..0784b59 100644 --- a/3d_armor/README.txt +++ b/3d_armor/README.txt @@ -1,12 +1,13 @@ [mod] Visible Player Armor [3d_armor] ===================================== -depends: default, inventory_plus, unified_skins +depends: default, inventory_plus -Adds craftable armor that is visible to other players. Each armor item worn contibutes to +Adds craftable armor that is visible to other players. Each armor item worn contributes to a player's armor group level making them less vulnerable to weapons. Armor takes damage when a player is hurt but also offers a percentage chance of healing. +Overall level is boosted by 10% when wearing a full matching set. default settings: [minetest.conf] diff --git a/3d_armor/armor.lua b/3d_armor/armor.lua index 5cde3ce..23f627d 100644 --- a/3d_armor/armor.lua +++ b/3d_armor/armor.lua @@ -14,36 +14,64 @@ armor = { .."list[detached:player_name_armor;armor_torso;3,1;1,1;]" .."list[detached:player_name_armor;armor_legs;3,2;1,1;]" .."list[detached:player_name_armor;armor_feet;3,3;1,1;]", + textures = {}, + default_skin = "character.png", } +-- armor.def - Added by BlockMen for HUD integration + armor.def = { state = 0, - count = 0 + count = 0, } +armor.update_player_visuals = function(self, player) + if not player then + return + end + local name = player:get_player_name() + if self.textures[name] then + default.player_set_textures(player, { + self.textures[name].skin, + self.textures[name].armor, + self.textures[name].wielditem, + }) + end +end + armor.set_player_armor = function(self, player) if not player then return end local name = player:get_player_name() local player_inv = player:get_inventory() - local armor_texture = uniskins.default_texture + local armor_texture = "3d_armor_trans.png" local armor_level = 0 local state = 0 local items = 0 local textures = {} - for _,v in ipairs(self.elements) do + local elements = {} + for i, v in ipairs(self.elements) do local stack = player_inv:get_stack("armor_"..v, 1) local level = stack:get_definition().groups["armor_"..v] + local item = stack:get_name() + elements[i] = string.match(item, "%:.+_(.+)$") if level then - local item = stack:get_name() table.insert(textures, item:gsub("%:", "_")..".png") armor_level = armor_level + level state = state + stack:get_wear() - items = items+1 - end + items = items + 1 + end end - if table.getn(textures) > 0 then + if minetest.get_modpath("shields") then + armor_level = armor_level * 0.9 + end + if elements[1] == elements[2] and + elements[1] == elements[3] and + elements[1] == elements[4] then + armor_level = armor_level * 1.1 + end + if #textures > 0 then armor_texture = table.concat(textures, "^") end local armor_groups = {fleshy=100} @@ -52,10 +80,10 @@ armor.set_player_armor = function(self, player) armor_groups.fleshy = 100 - armor_level end player:set_armor_groups(armor_groups) - uniskins.armor[name] = armor_texture - uniskins:update_player_visuals(player) - armor.def[name].state = state - armor.def[name].count = items + self.textures[name].armor = armor_texture + self.def[name].state = state + self.def[name].count = items + self:update_player_visuals(player) end armor.update_armor = function(self, player) @@ -86,27 +114,46 @@ armor.update_armor = function(self, player) armor_inv:set_stack("armor_"..v, 1, stack) player_inv:set_stack("armor_"..v, 1, stack) state = state + stack:get_wear() - items = items+1 + items = items + 1 if stack:get_count() == 0 then local desc = minetest.registered_items[item].description if desc then minetest.chat_send_player(name, "Your "..desc.." got destroyed!") - end + end self:set_player_armor(player) end heal_max = heal_max + heal end end - armor.def[name].state = state - armor.def[name].count = items + self.def[name].state = state + self.def[name].count = items if heal_max > math.random(100) then player:set_hp(self.player_hp[name]) return - end + end end self.player_hp[name] = hp end +-- Register Player Model + +default.player_register_model("3d_armor_character.x", { + animation_speed = 30, + textures = { + armor.default_skin, + "3d_armor_trans.png", + "3d_armor_trans.png", + }, + animations = { + stand = {x=0, y=79}, + lay = {x=162, y=166}, + walk = {x=168, y=187}, + mine = {x=189, y=198}, + walk_mine = {x=200, y=219}, + sit = {x=81, y=160}, + }, +}) + -- Register Callbacks minetest.register_on_player_receive_fields(function(player, formname, fields) @@ -117,16 +164,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) return end for field, _ in pairs(fields) do - if string.sub(field,0,string.len("skins_set_")) == "skins_set_" then + if string.find(field, "^skins_set_") then minetest.after(0, function(player) - uniskins.skin[name] = skins.skins[name]..".png" - uniskins:update_player_visuals(player) + armor.textures[name].skin = skins.skins[name]..".png" + armor:update_player_visuals(player) end, player) end end end) minetest.register_on_joinplayer(function(player) + default.player_set_model(player, "3d_armor_character.x") inventory_plus.register_button(player,"armor", "Armor") local player_inv = player:get_inventory() local name = player:get_player_name() @@ -158,14 +206,33 @@ minetest.register_on_joinplayer(function(player) armor_inv:set_size(list, 1) armor_inv:set_stack(list, 1, player_inv:get_stack(list, 1)) end - armor.player_hp[name] = 0 + armor.player_hp[name] = 0 armor.def[name] = { - state = 0, - count = 0 + state = 0, + count = 0, } + armor.textures[name] = { + skin = armor.default_skin, + armor = "3d_armor_trans.png", + wielditem = "3d_armor_trans.png", + } + if minetest.get_modpath("skins") then + local skin = skins.skins[name] + if skin and skins.get_type(skin) == skins.type.MODEL then + armor.textures[name].skin = skin..".png" + end + end + if minetest.get_modpath("player_textures") then + local filename = minetest.get_modpath("player_textures").."/textures/player_"..name + local f = io.open(filename..".png") + if f then + f:close() + armor.textures[name].skin = "player_"..name..".png" + end + end minetest.after(0, function(player) armor:set_player_armor(player) - end, player) + end, player) end) minetest.register_globalstep(function(dtime) diff --git a/3d_armor/crafting_guide.txt b/3d_armor/crafting_guide.txt index 0d091e9..89bff0b 100644 --- a/3d_armor/crafting_guide.txt +++ b/3d_armor/crafting_guide.txt @@ -15,6 +15,7 @@ Helmets: [3d_armor:helmet_steel] X = [default:steel_ingot] [3d_armor:helmet_bronze] X = [default:bronze_ingot] [3d_armor:helmet_diamond] X = [default:diamond] +[3d_armor:helmet_mithril] X = [moreores:mithril_ingot] * Chestplates: @@ -30,6 +31,7 @@ Chestplates: [3d_armor:chestplate_steel] X = [default:steel_ingot] [3d_armor:chestplate_bronze] X = [default:bronze_ingot] [3d_armor:chestplate_diamond] X = [default:diamond] +[3d_armor:chestplate_mithril] X = [moreores:mithril_ingot] * Leggings: @@ -45,6 +47,7 @@ Leggings: [3d_armor:leggings_steel] X = [default:steel_ingot] [3d_armor:leggings_bronze] X = [default:bronze_ingot] [3d_armor:leggings_diamond] X = [default:diamond] +[3d_armor:leggings_mithril] X = [moreores:mithril_ingot] * Boots: @@ -58,4 +61,7 @@ Boots: [3d_armor:boots_steel] X = [default:steel_ingot] [3d_armor:boots_bronze] X = [default:bronze_ingot [3d_armor:boots_diamond] X = [default:diamond] +[3d_armor:boots_mithril] X = [moreores:mithril_ingot] * + +* Requires moreores mod by Calinou - https://forum.minetest.net/viewtopic.php?id=549 diff --git a/3d_armor/depends.txt b/3d_armor/depends.txt index db2f71a..5a6e76d 100644 --- a/3d_armor/depends.txt +++ b/3d_armor/depends.txt @@ -1,3 +1,3 @@ default inventory_plus -unified_skins + diff --git a/3d_armor/init.lua b/3d_armor/init.lua index 93561f0..ab58ba9 100644 --- a/3d_armor/init.lua +++ b/3d_armor/init.lua @@ -1,4 +1,5 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/armor.lua") +local use_moreores = minetest.get_modpath("moreores") -- Regisiter Head Armor @@ -30,6 +31,14 @@ minetest.register_tool("3d_armor:helmet_diamond", { wear = 0, }) +if use_moreores then + minetest.register_tool("3d_armor:helmet_mithril", { + description = "Mithril Helmet", + inventory_image = "3d_armor_inv_helmet_mithril.png", + groups = {armor_head=15, armor_heal=12, armor_use=50}, + wear = 0, + }) +end -- Regisiter Torso Armor @@ -61,6 +70,14 @@ minetest.register_tool("3d_armor:chestplate_diamond", { wear = 0, }) +if use_moreores then + minetest.register_tool("3d_armor:chestplate_mithril", { + description = "Mithril Chestplate", + inventory_image = "3d_armor_inv_chestplate_mithril.png", + groups = {armor_torso=20, armor_heal=12, armor_use=50}, + wear = 0, + }) +end -- Regisiter Leg Armor @@ -92,6 +109,15 @@ minetest.register_tool("3d_armor:leggings_diamond", { wear = 0, }) +if use_moreores then + minetest.register_tool("3d_armor:leggings_mithril", { + description = "Mithril Leggings", + inventory_image = "3d_armor_inv_leggings_mithril.png", + groups = {armor_legs=20, armor_heal=12, armor_use=50}, + wear = 0, + }) +end + -- Regisiter Boots minetest.register_tool("3d_armor:boots_wood", { @@ -122,6 +148,15 @@ minetest.register_tool("3d_armor:boots_diamond", { wear = 0, }) +if use_moreores then + minetest.register_tool("3d_armor:boots_mithril", { + description = "Mithril Boots", + inventory_image = "3d_armor_inv_boots_mithril.png", + groups = {armor_feet=15, armor_heal=12, armor_use=50}, + wear = 0, + }) +end + -- Register Craft Recipies local craft_ingreds = { @@ -129,7 +164,11 @@ local craft_ingreds = { steel = "default:steel_ingot", bronze = "default:bronze_ingot", diamond = "default:diamond", -} +} + +if use_moreores then + craft_ingreds.mithril = "moreores:mithril_ingot" +end for k, v in pairs(craft_ingreds) do minetest.register_craft({ @@ -165,4 +204,3 @@ for k, v in pairs(craft_ingreds) do }) end - diff --git a/3d_armor/models/3d_armor_character.blend b/3d_armor/models/3d_armor_character.blend new file mode 100644 index 0000000..cf638e1 Binary files /dev/null and b/3d_armor/models/3d_armor_character.blend differ diff --git a/unified_skins/models/uniskins_character.x b/3d_armor/models/3d_armor_character.x similarity index 99% rename from unified_skins/models/uniskins_character.x rename to 3d_armor/models/3d_armor_character.x index ffa0cf4..4579bab 100644 --- a/unified_skins/models/uniskins_character.x +++ b/3d_armor/models/3d_armor_character.x @@ -1998,30 +1998,30 @@ Frame Root { 0.625000; 0.625000;, 0.625000; 1.000000;, 0.500000; 1.000000;, - 0.625000; 0.250000;, - 0.625000; 0.500000;, - 0.500000; 0.500000;, - 0.500000; 0.250000;, - 0.625000; 0.250000;, - 0.625000; 0.000000;, - 0.750000; 0.000000;, - 0.750000; 0.250000;, - 0.750000; 0.250000;, - 0.750000; 0.000000;, - 0.875000; 0.000000;, - 0.875000; 0.250000;, - 0.750000; 0.500000;, - 0.625000; 0.500000;, - 0.625000; 0.250000;, - 0.750000; 0.250000;, - 0.875000; 0.500000;, - 0.750000; 0.500000;, - 0.750000; 0.250000;, - 0.875000; 0.250000;, - 1.000000; 0.500000;, - 0.875000; 0.500000;, - 0.875000; 0.250000;, - 1.000000; 0.250000;, + 0.622025; 0.250000;, + 0.622025; 0.500000;, + 0.497025; 0.500000;, + 0.497025; 0.250000;, + 0.622025; 0.250000;, + 0.622025; 0.000000;, + 0.747025; 0.000000;, + 0.747025; 0.250000;, + 0.747025; 0.250000;, + 0.747025; 0.000000;, + 0.872025; 0.000000;, + 0.872025; 0.250000;, + 0.747025; 0.500000;, + 0.622025; 0.500000;, + 0.622025; 0.250000;, + 0.747025; 0.250000;, + 0.872025; 0.500000;, + 0.747025; 0.500000;, + 0.747025; 0.250000;, + 0.872025; 0.250000;, + 0.997025; 0.500000;, + 0.872025; 0.500000;, + 0.872025; 0.250000;, + 0.997025; 0.250000;, 0.812500; 0.625000;, 0.812500; 0.500000;, 0.750000; 0.500000;, @@ -2181,8 +2181,8 @@ Frame Root { 0.250000; 0.500000;, 0.250000; 0.000000;, 0.000000; 0.000000;, - 0.000000; 0.500000;, - 0.000000; 0.500000;, + -0.000000; 0.500000;, + -0.000000; 0.500000;, 0.000000; 0.000000;, 0.250000; 0.000000;, 0.250000; 0.500000;, diff --git a/3d_armor/textures/3d_armor_boots_mithril.png b/3d_armor/textures/3d_armor_boots_mithril.png new file mode 100644 index 0000000..fa0b504 Binary files /dev/null and b/3d_armor/textures/3d_armor_boots_mithril.png differ diff --git a/3d_armor/textures/3d_armor_chestplate_mithril.png b/3d_armor/textures/3d_armor_chestplate_mithril.png new file mode 100644 index 0000000..cedf0d9 Binary files /dev/null and b/3d_armor/textures/3d_armor_chestplate_mithril.png differ diff --git a/3d_armor/textures/3d_armor_helmet_mithril.png b/3d_armor/textures/3d_armor_helmet_mithril.png new file mode 100644 index 0000000..f7c6cae Binary files /dev/null and b/3d_armor/textures/3d_armor_helmet_mithril.png differ diff --git a/3d_armor/textures/3d_armor_inv_boots_mithril.png b/3d_armor/textures/3d_armor_inv_boots_mithril.png new file mode 100644 index 0000000..f15bbe6 Binary files /dev/null and b/3d_armor/textures/3d_armor_inv_boots_mithril.png differ diff --git a/3d_armor/textures/3d_armor_inv_chestplate_mithril.png b/3d_armor/textures/3d_armor_inv_chestplate_mithril.png new file mode 100644 index 0000000..367e442 Binary files /dev/null and b/3d_armor/textures/3d_armor_inv_chestplate_mithril.png differ diff --git a/3d_armor/textures/3d_armor_inv_helmet_mithril.png b/3d_armor/textures/3d_armor_inv_helmet_mithril.png new file mode 100644 index 0000000..edb8fef Binary files /dev/null and b/3d_armor/textures/3d_armor_inv_helmet_mithril.png differ diff --git a/3d_armor/textures/3d_armor_inv_leggings_mithril.png b/3d_armor/textures/3d_armor_inv_leggings_mithril.png new file mode 100644 index 0000000..6635f8a Binary files /dev/null and b/3d_armor/textures/3d_armor_inv_leggings_mithril.png differ diff --git a/3d_armor/textures/3d_armor_leggings_mithril.png b/3d_armor/textures/3d_armor_leggings_mithril.png new file mode 100644 index 0000000..96fbf35 Binary files /dev/null and b/3d_armor/textures/3d_armor_leggings_mithril.png differ diff --git a/unified_skins/textures/uniskins_trans.png b/3d_armor/textures/3d_armor_trans.png similarity index 100% rename from unified_skins/textures/uniskins_trans.png rename to 3d_armor/textures/3d_armor_trans.png diff --git a/README.md b/README.md index 0ac2c29..d41e76f 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,26 @@ -Modpack - 3d Armor -================== - -[mod] Unified Skins [unified_skins] ------------------------------------ - -depends: default - -A 3d character model re-texturing api used as the framework for this modpack. - -Compatible with player skins mod [skins] by Zeg9 and Player Textures [player_textures] by sdzen. - -Note: Currently only supports 64x32px player skins. - -[mod] Visible Wielded Items [wieldview] ---------------------------------------- - -depends: unified_skins - -Makes hand wielded items visible to other players. - -Note: Currently only supports 16x16px texture packs, sorry! +Modpack - 3d Armor [0.4.0] +========================== [mod] Visible Player Armor [3d_armor] ------------------------------------- -depends: unified_skins, inventory_plus +depends: default, inventory_plus Adds craftable armor that is visible to other players. Each armor item worn contributes to a player's armor group level making them less vulnerable to weapons. Armor takes damage when a player is hurt, however, many armor items offer a 'stackable' -percentage chance of restoring the lost health points. +percentage chance of restoring the lost health points. Overall armor level is boosted by 10% +when wearing a full matching set (helmet, chestplate, leggings and boots of the same material) + +Compatible with player skins [skins] by Zeg9 and Player Textures [player_textures] by PilzAdam. + +[mod] Visible Wielded Items [wieldview] +--------------------------------------- + +depends: 3d_armor + +Makes hand wielded items visible to other players. [mod] Shields [shields] ------------------------------------- @@ -39,3 +29,4 @@ depends: 3d_armor Originally a part of 3d_armor, shields have been re-included as an optional extra. If you do not want shields then simply remove the shields folder from the modpack. + diff --git a/shields/depends.txt b/shields/depends.txt index 5e62c74..585cc7a 100644 --- a/shields/depends.txt +++ b/shields/depends.txt @@ -1,3 +1,2 @@ default -inventory_plus 3d_armor diff --git a/shields/init.lua b/shields/init.lua index 23d7f60..f7845a3 100644 --- a/shields/init.lua +++ b/shields/init.lua @@ -1,3 +1,5 @@ +local use_moreores = minetest.get_modpath("moreores") + -- Regisiter Shields minetest.register_tool("shields:shield_wood", { @@ -28,6 +30,14 @@ minetest.register_tool("shields:shield_diamond", { wear = 0, }) +if use_moreores then + minetest.register_tool("shields:shield_mithril", { + description = "Mithril Shield", + inventory_image = "shields_inv_shield_mithril.png", + groups = {armor_shield=15, armor_heal=12, armor_use=50}, + wear = 0, + }) +end local craft_ingreds = { wood = "default:wood", @@ -36,6 +46,10 @@ local craft_ingreds = { diamond = "default:diamond", } +if has_moreores then + craft_ingreds.mithril = "moreores:mithril_ingot" +end + for k, v in pairs(craft_ingreds) do minetest.register_craft({ output = "shields:shield_"..k, @@ -56,6 +70,5 @@ minetest.after(0, function() .."list[detached:player_name_armor;armor_legs;3,2;1,1;]" .."list[detached:player_name_armor;armor_feet;3,3;1,1;]" .."list[detached:player_name_armor;armor_shield;4,1;1,1;]" -end) - +end) diff --git a/shields/textures/shields_inv_shield_mithril.png b/shields/textures/shields_inv_shield_mithril.png new file mode 100644 index 0000000..7c1d7d3 Binary files /dev/null and b/shields/textures/shields_inv_shield_mithril.png differ diff --git a/shields/textures/shields_shield_mithril.png b/shields/textures/shields_shield_mithril.png new file mode 100644 index 0000000..13666d1 Binary files /dev/null and b/shields/textures/shields_shield_mithril.png differ diff --git a/unified_skins/README.txt b/unified_skins/README.txt deleted file mode 100644 index 4e99288..0000000 --- a/unified_skins/README.txt +++ /dev/null @@ -1,7 +0,0 @@ -A 3d character model re-texturing api used as the framework for this modpack. - -depends: default - -Compatible with player skins mod [skins] by Zeg9 and Player Textures [player_textures] by sdzen. - -Note: Currently only 64x32px player skins. diff --git a/unified_skins/depends.txt b/unified_skins/depends.txt deleted file mode 100644 index 4ad96d5..0000000 --- a/unified_skins/depends.txt +++ /dev/null @@ -1 +0,0 @@ -default diff --git a/unified_skins/init.lua b/unified_skins/init.lua deleted file mode 100644 index dbfbe86..0000000 --- a/unified_skins/init.lua +++ /dev/null @@ -1,47 +0,0 @@ - -uniskins = { - skin = {}, - armor = {}, - wielditem = {}, - default_skin = "character.png", - default_texture = "uniskins_trans.png", -} - -uniskins.update_player_visuals = function(self, player) - if not player then - return - end - local name = player:get_player_name() - player:set_properties({ - visual = "mesh", - mesh = "uniskins_character.x", - textures = { - self.skin[name], - self.armor[name], - self.wielditem[name] - }, - visual_size = {x=1, y=1}, - }) -end - -minetest.register_on_joinplayer(function(player) - local name = player:get_player_name() - uniskins.skin[name] = uniskins.default_skin - uniskins.armor[name] = uniskins.default_texture - uniskins.wielditem[name] = uniskins.default_texture - if minetest.get_modpath("player_textures") then - local filename = minetest.get_modpath("player_textures").."/textures/player_"..name - local f = io.open(filename..".png") - if f then - f:close() - uniskins.skin[name] = "player_"..name..".png" - end - end - if minetest.get_modpath("skins") then - local skin = skins.skins[name] - if skin and skins.get_type(skin) == skins.type.MODEL then - uniskins.skin[name] = skin..".png" - end - end -end) - diff --git a/unified_skins/models/uniskins_character.blend b/unified_skins/models/uniskins_character.blend deleted file mode 100644 index 79be076..0000000 Binary files a/unified_skins/models/uniskins_character.blend and /dev/null differ diff --git a/wieldview/README.txt b/wieldview/README.txt index 21f4194..cffae46 100644 --- a/wieldview/README.txt +++ b/wieldview/README.txt @@ -1,11 +1,9 @@ [mod] visible wielded items [wieldview] ======================================= -depends: default, unified_skins +depends: default, 3d_armor -Makes hand wielded items visible to other players. Compatible with player skins mod [skins]. - -Note: Currently only supports 16x16px texture packs, sorry! +Makes hand wielded items visible to other players. default settings: [minetest.conf] diff --git a/wieldview/depends.txt b/wieldview/depends.txt index e5dc742..585cc7a 100644 --- a/wieldview/depends.txt +++ b/wieldview/depends.txt @@ -1,2 +1,2 @@ default -unified_skins +3d_armor diff --git a/wieldview/init.lua b/wieldview/init.lua index 13da170..69a3bd9 100644 --- a/wieldview/init.lua +++ b/wieldview/init.lua @@ -10,14 +10,15 @@ if not node_tiles then minetest.setting_set("wieldview_node_tiles", "false") end -dofile(minetest.get_modpath(minetest.get_current_modname()).."/transform.lua") - wieldview = { wielded_item = {}, + transform = {}, } +dofile(minetest.get_modpath(minetest.get_current_modname()).."/transform.lua") + wieldview.get_item_texture = function(self, item) - local texture = uniskins.default_texture + local texture = "3d_armor_trans.png" if item ~= "" then if minetest.registered_items[item] then if minetest.registered_items[item].inventory_image ~= "" then @@ -26,8 +27,8 @@ wieldview.get_item_texture = function(self, item) texture = minetest.registered_items[item].tiles[1] end end - if wieldview_transform[item] then - texture = texture.."^[transform"..wieldview_transform[item] + if wieldview.transform[item] then + texture = texture.."^[transform"..wieldview.transform[item] end end return texture @@ -47,8 +48,8 @@ wieldview.update_wielded_item = function(self, player) if self.wielded_item[name] == item then return end - uniskins.wielditem[name] = self:get_item_texture(item) - uniskins:update_player_visuals(player) + armor.textures[name].wielditem = self:get_item_texture(item) + armor:update_player_visuals(player) end self.wielded_item[name] = item end diff --git a/wieldview/transform.lua b/wieldview/transform.lua index cdf8a05..4d5133e 100644 --- a/wieldview/transform.lua +++ b/wieldview/transform.lua @@ -1,6 +1,6 @@ -- Wielded Item Transformations - http://dev.minetest.net/texture -wieldview_transform = { +wieldview.transform = { ["default:torch"]="R270", ["default:sapling"]="R270", ["flowers:dandelion_white"]="R270",