Add unified_skins and update for game changes.

This commit is contained in:
stujones11 2013-04-11 20:56:35 +01:00
parent 86856a2a4a
commit a4414820ae
23 changed files with 307 additions and 355 deletions

@ -1,8 +1,15 @@
[mod] Visible Player Armor [3d_armor]
=====================================
depends: default, inventory_plus, wieldview
depends: default, inventory_plus, unified_skins
Adds craftable armor that is visible to other players. Armor takes damage when a player is hurt
but also offers a percentage chance of healing.
Adds craftable armor that is visible to other players. Each armor item worn contibutes 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.
default settings: [minetest.conf]
# Set number of seconds between armor updates.
3d_armor_update_time = 1

@ -1,46 +1,50 @@
armor_api = {
player_hp = {},
fleshy_max = 20
}
armor_api.get_player_armor = function(self, player)
armor_api.get_armor_textures = function(self, player)
if not player then
return
end
local name = player:get_player_name()
local texture = ""
local textures = {}
local player_inv = player:get_inventory()
local armor = {head, torso, legs, shield}
for _,v in ipairs({"head", "torso", "legs"}) do
local stack = player_inv:get_stack("armor_"..v, 1)
armor[v] = stack:get_definition().groups["armor_"..v] or 0
if armor[v] > 0 then
item = stack:get_name()
texture = texture.."^[combine:64x64:0,32="..item:gsub("%:", "_")..".png"
if stack:get_definition().groups["armor_"..v] then
local item = stack:get_name()
textures[v] = item:gsub("%:", "_")..".png"
end
end
local stack = player_inv:get_stack("armor_shield", 1)
armor["shield"] = stack:get_definition().groups["armor_shield"] or 0
if armor["shield"] > 0 then
item = stack:get_name()
texture = texture.."^[combine:64x64:16,0="..minetest.registered_items[item].inventory_image
if stack:get_definition().groups["armor_shield"] then
local item = stack:get_name()
textures["shield"] = minetest.registered_items[item].inventory_image
end
local armor_level = math.floor(
(.2*armor["head"]) +
(.3*armor["torso"]) +
(.2*armor["legs"]) +
(.3*armor["shield"])
)
local level = (armor_level / 2) + 0.5
local fleshy = 3 - (armor_level / 2)
if fleshy < 0 then
fleshy = 0
return textures
end
armor_api.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_level = 0
for _,v in ipairs({"head", "torso", "legs", "shield"}) do
local stack = player_inv:get_stack("armor_"..v, 1)
local armor = stack:get_definition().groups["armor_"..v] or 0
armor_level = armor_level + armor
end
local armor_groups = {fleshy=100}
if armor_level > 0 then
armor_groups.level = math.floor(armor_level / 20)
armor_groups.fleshy = 100 - armor_level
end
local armor_groups = {level=1, fleshy=3, snappy=1, choppy=1}
armor_groups.level = level
armor_groups.fleshy = fleshy
player:set_armor_groups(armor_groups)
return texture
uniskins:update_player_visuals(player)
end
armor_api.update_armor = function(self, player)
@ -73,7 +77,7 @@ armor_api.update_armor = function(self, player)
if desc then
minetest.chat_send_player(name, "Your "..desc.." got destroyed!")
end
wieldview:update_player_visuals(player)
self:set_player_armor(player)
end
heal_max = heal_max + heal
end

@ -1,84 +1,74 @@
3D Armor -- Visible Player Armor
--------------------------------
3d_armor -- Crafting Guide
--------------------------
Crafting Guide
--------------
S = Steel Ingot [default:steel_ingot], W = Wood [default:wood]
Steel Helmet [3d_armor:helmet_steel]
Helmets:
+---+---+---+
| S | S | S |
| X | X | X |
+---+---+---+
| S | | S |
| X | | X |
+---+---+---+
| | | |
+---+---+---+
Steel Chestplate [3d_armor:chestplate_steel]
[3d_armor:helmet_wood] X = [default:wood]
[3d_armor:helmet_steel] X = [default:steel_ingot]
[3d_armor:helmet_bronze] X = [default:bronze_ingot]
Chestplates:
+---+---+---+
| S | | S |
| X | | X |
+---+---+---+
| S | S | S |
| X | X | X |
+---+---+---+
| S | S | S |
| X | X | X |
+---+---+---+
Steel Leggings [3d_armor:leggings_steel]
[3d_armor:chestplate_wood] X = [default:wood]
[3d_armor:chestplate_steel] X = [default:steel_ingot]
[3d_armor:chestplate_bronze] X = [default:bronze_ingot]
Leggings:
+---+---+---+
| S | S | S |
| X | X | X |
+---+---+---+
| S | | S |
| X | | X |
+---+---+---+
| S | | S |
| X | | X |
+---+---+---+
Steel Shield [3d_armor:shield_steel]
[3d_armor:leggings_wood] X = [default:wood]
[3d_armor:leggings_steel] X = [default:steel_ingot]
[3d_armor:leggings_bronze] X = [default:bronze_ingot]
Shields:
+---+---+---+
| S | S | S |
| X | X | X |
+---+---+---+
| S | S | S |
| X | X | X |
+---+---+---+
| | S | |
| | X | |
+---+---+---+
Wooden Shield [3d_armor:shield_wood]
+---+---+---+
| W | W | W |
+---+---+---+
| w | W | W |
+---+---+---+
| | W | |
+---+---+---+
Enhanced Wooden Shield [3d_armor:shield_enhanced_wood]
+---+---+---+
| S | W | S |
+---+---+---+
| W | S | W |
+---+---+---+
| | W | |
+---+---+---+
[3d_armor:shield_wood] X = [default:wood]
[3d_armor:shield_steel] X = [default:steel_ingot]
[3d_armor:shield_bronze] X = [default:bronze_ingot
Enhanced Wooden Shield:
SI = [default:steel_ingot]
WS = [3d_armor:shield_wood]
+----+
| SI |
+----+
| WS |
+----+
| SI |
+----+
[3d_armor:shield_enhanced_wood]

@ -1,3 +1,3 @@
default
inventory_plus
wieldview
unified_skins

@ -1,38 +1,34 @@
dofile(minetest.get_modpath(minetest.get_current_modname()).."/armor_api.lua")
local time = 0
local update_time = tonumber(minetest.setting_get("3d_armor_update_time"))
if not update_time then
update_time = 1
minetest.setting_set("3d_armor_update_time", tostring(update_time))
end
-- Regisiter Head Armor
minetest.register_tool("3d_armor:helmet_wood", {
description = "Wood Helmet",
inventory_image = "3d_armor_inv_helmet_wood.png",
groups = {armor_head=2, armor_heal=10, armor_use=5000},
groups = {armor_head=5, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:helmet_steel", {
description = "Steel Helmet",
inventory_image = "3d_armor_inv_helmet_steel.png",
groups = {armor_head=3, armor_heal=15, armor_use=1000},
groups = {armor_head=10, armor_heal=5, armor_use=250},
wear = 0,
})
minetest.register_craft({
output = "3d_armor:helmet_wood",
recipe = {
{"default:wood", "default:wood", "default:wood"},
{"default:wood", "", "default:wood"},
{"", "", ""},
},
})
minetest.register_craft({
output = "3d_armor:helmet_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
{"", "", ""},
},
minetest.register_tool("3d_armor:helmet_bronze", {
description = "Bronze Helmet",
inventory_image = "3d_armor_inv_helmet_bronze.png",
groups = {armor_head=15, armor_heal=10, armor_use=100},
wear = 0,
})
-- Regisiter Torso Armor
@ -40,33 +36,22 @@ minetest.register_craft({
minetest.register_tool("3d_armor:chestplate_wood", {
description = "Wood Chestplate",
inventory_image = "3d_armor_inv_chestplate_wood.png",
groups = {armor_torso=2, armor_heal=10, armor_use=5000},
groups = {armor_torso=10, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:chestplate_steel", {
description = "Steel Chestplate",
inventory_image = "3d_armor_inv_chestplate_steel.png",
groups = {armor_torso=3, armor_heal=15, armor_use=2500},
groups = {armor_torso=15, armor_heal=5, armor_use=250},
wear = 0,
})
minetest.register_craft({
output = "3d_armor:chestplate_wood",
recipe = {
{"default:wood", "", "default:wood"},
{"default:wood", "default:wood", "default:wood"},
{"default:wood", "default:wood", "default:wood"},
},
})
minetest.register_craft({
output = "3d_armor:chestplate_steel",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
},
minetest.register_tool("3d_armor:chestplate_bronze", {
description = "Bronze Chestplate",
inventory_image = "3d_armor_inv_chestplate_bronze.png",
groups = {armor_torso=25, armor_heal=10, armor_use=100},
wear = 0,
})
-- Regisiter Leg Armor
@ -74,33 +59,22 @@ minetest.register_craft({
minetest.register_tool("3d_armor:leggings_wood", {
description = "Wood Leggings",
inventory_image = "3d_armor_inv_leggings_wood.png",
groups = {armor_legs=2, armor_heal=10, armor_use=5000},
groups = {armor_legs=5, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_steel", {
description = "Steel Leggings",
inventory_image = "3d_armor_inv_leggings_steel.png",
groups = {armor_legs=3, armor_heal=15, armor_use=1500},
groups = {armor_legs=10, armor_heal=5, armor_use=250},
wear = 0,
})
minetest.register_craft({
output = "3d_armor:leggings_wood",
recipe = {
{"default:wood", "default:wood", "default:wood"},
{"default:wood", "", "default:wood"},
{"default:wood", "", "default:wood"},
},
})
minetest.register_craft({
output = "3d_armor:leggings_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
},
minetest.register_tool("3d_armor:leggings_bronze", {
description = "Bronze Leggings",
inventory_image = "3d_armor_inv_leggings_bronze.png",
groups = {armor_legs=15, armor_heal=10, armor_use=100},
wear = 0,
})
-- Regisiter Shields
@ -108,48 +82,80 @@ minetest.register_craft({
minetest.register_tool("3d_armor:shield_wood", {
description = "Wooden Shield",
inventory_image = "3d_armor_inv_shield_wood.png",
groups = {armor_shield=1, armor_heal=10, armor_use=10000},
groups = {armor_shield=10, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:shield_enhanced_wood", {
description = "Enhanced Wooden Shield",
inventory_image = "3d_armor_inv_shield_enhanced_wood.png",
groups = {armor_shield=2, armor_heal=15, armor_use=3000},
groups = {armor_shield=15, armor_heal=5, armor_use=500},
wear = 0,
})
minetest.register_tool("3d_armor:shield_steel", {
description = "Steel Shield",
inventory_image = "3d_armor_inv_shield_steel.png",
groups = {armor_shield=3, armor_heal=20, armor_use=1500},
groups = {armor_shield=20, armor_heal=5, armor_use=250},
wear = 0,
})
minetest.register_tool("3d_armor:shield_bronze", {
description = "Bronze Shield",
inventory_image = "3d_armor_inv_shield_bronze.png",
groups = {armor_shield=25, armor_heal=10, armor_use=100},
wear = 0,
})
-- Register Craft Recipies
local craft_ingreds = {
wood = "default:wood",
steel = "default:steel_ingot",
bronze = "default:bronze_ingot",
}
for k, v in ipairs({"wood", "steel", "bronze"}) do
minetest.register_craft({
output = "3d_armor:shield_wood",
output = "3d_armor:helmet_"..k,
recipe = {
{"default:wood", "default:wood", "default:wood"},
{"default:wood", "default:wood", "default:wood"},
{"", "default:wood", ""},
{v, v, v},
{v, "", v},
{"", "", ""},
},
})
minetest.register_craft({
output = "3d_armor:chestplate_"..k,
recipe = {
{v, "", v},
{v, v, v},
{v, v, v},
},
})
minetest.register_craft({
output = "3d_armor:leggings_"..k,
recipe = {
{v, v, v},
{v, "", v},
{v, "", v},
},
})
minetest.register_craft({
output = "3d_armor:shield_"..k,
recipe = {
{v, v, v},
{v, v, v},
{"", v, ""},
},
})
end
minetest.register_craft({
output = "3d_armor:shield_enhanced_wood",
recipe = {
{"default:steel_ingot", "default:wood", "default:steel_ingot"},
{"default:wood", "default:steel_ingot", "default:wood"},
{"", "default:wood", ""},
},
})
minetest.register_craft({
output = "3d_armor:shield_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"", "default:steel_ingot", ""},
{"default:steel_ingot"},
{"3d_armor:shield_wood"},
{"default:steel_ingot"},
},
})
@ -169,8 +175,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
for field, _ in pairs(fields) do
if string.sub(field,0,string.len("skins_set_")) == "skins_set_" then
minetest.after(1, function(player)
wieldview:update_player_visuals(player)
minetest.after(0, function(player)
armor_api:set_player_armor(player)
end, player)
end
end
@ -183,11 +189,11 @@ minetest.register_on_joinplayer(function(player)
local armor_inv = minetest.create_detached_inventory(name.."_outfit",{
on_put = function(inv, listname, index, stack, player)
player:get_inventory():set_stack(listname, index, stack)
wieldview:update_player_visuals(player)
armor_api:set_player_armor(player)
end,
on_take = function(inv, listname, index, stack, player)
player:get_inventory():set_stack(listname, index, nil)
wieldview:update_player_visuals(player)
armor_api:set_player_armor(player)
end,
allow_put = function(inv, listname, index, stack, player)
if inv:is_empty(listname) then
@ -209,5 +215,18 @@ minetest.register_on_joinplayer(function(player)
armor_inv:set_stack(armor, 1, player_inv:get_stack(armor, 1))
end
armor_api.player_hp[name] = 0
minetest.after(0, function(player)
armor_api:set_player_armor(player)
end, player)
end)
minetest.register_globalstep(function(dtime)
time = time + dtime
if time > update_time then
for _,player in ipairs(minetest.get_connected_players()) do
armor_api:update_armor(player)
end
time = 0
end
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

@ -1,26 +1,41 @@
Modpack - 3d Armor
==================
[mod] Unified Skins [unified_skins]
-----------------------------------
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 64x32px player skins.
[mod] Visible Wielded Items [wieldview]
=======================================
---------------------------------------
depends: default
depends: default, unified_skins
Makes hand wielded items visible to other players. Compatible with player skins mod [skins].
Makes hand wielded items visible to other players.
note: currently only supports 16x16px texture packs and 64x32px player skins, sorry!
Note: Currently only supports 16x16px texture packs, sorry!
[mod] Visible Player Armor [3d_armor]
=====================================
-------------------------------------
depends: default, inventory_plus, wieldview
depends: default, unified_skins, inventory_plus
Adds craftable armor that is visible to other players. Armor takes damage when a player is hurt
but also offers a percentage chance of healing.
Adds craftable armor that is visible to other players. Each armor item worn contibutes 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.
[mod] Moreores Armor [more_armor]
========================================
---------------------------------
depends: default, 3d_armor
Now included for legacy support only! Unless you are using a customized ore system, this
mod is not really recommended and will most likely be removed from future versions.
Adds Bronze and Mithril armor sets, upgrades moreores weapons.
depends: default, moreores, 3d_armor
Adds Mithril armor and upgrades moreores Mithril Sword.

@ -1,52 +1,9 @@
3D Armor -- Moreores Armor
--------------------------
more_armor -- Crafting Guide
----------------------------
Crafting Guide
--------------
M = Mithril Ingot [moreores:mithril_ingot]
B = Bronze Ingot [moreores:bronze_ingot], M = Mithril Ingot [moreores:mithril_ingot]
Bronze Helmet [more_armor:helmet_bronze]
+---+---+---+
| B | B | B |
+---+---+---+
| B | | B |
+---+---+---+
| | | |
+---+---+---+
Bronze Chestplate [more_armor:chestplate_bronze]
+---+---+---+
| B | | B |
+---+---+---+
| B | B | B |
+---+---+---+
| B | B | B |
+---+---+---+
Bronze Leggings [more_armor:leggings_bronze]
+---+---+---+
| B | B | B |
+---+---+---+
| B | | B |
+---+---+---+
| B | | B |
+---+---+---+
Bronze Shield [more_armor:shield_bronze]
+---+---+---+
| B | B | B |
+---+---+---+
| B | B | B |
+---+---+---+
| | B | |
+---+---+---+
Mithril Helmet [more_armor:helmet_mithril]
Mithril Helmet: [more_armor:helmet_mithril]
+---+---+---+
| M | M | M |
@ -56,7 +13,7 @@ Mithril Helmet [more_armor:helmet_mithril]
| | | |
+---+---+---+
Mithril Chestplate [more_armor:chestplate_mithril]
Mithril Chestplate: [more_armor:chestplate_mithril]
+---+---+---+
| M | | M |
@ -66,7 +23,7 @@ Mithril Chestplate [more_armor:chestplate_mithril]
| M | M | M |
+---+---+---+
Mithril Leggings [more_armor:leggings_mithril]
Mithril Leggings: [more_armor:leggings_mithril]
+---+---+---+
| M | M | M |
@ -76,7 +33,7 @@ Mithril Leggings [more_armor:leggings_mithril]
| M | | M |
+---+---+---+
Mithril Shield [more_armor:shield_mithril]
Mithril Shield: [more_armor:shield_mithril]
+---+---+---+
| M | M | M |

@ -1,20 +1,6 @@
-- Override moreores weapons (make them more powerful)
minetest.register_tool(":moreores:sword_bronze", {
description = "Bronze Sword",
inventory_image = "moreores_tool_bronzesword.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
fleshy={times={[1]=1.00, [2]=0.80, [3]=0.40}, uses=25, maxlevel=2},
snappy={times={[2]=0.70, [3]=0.25}, uses=100, maxlevel=1},
choppy={times={[3]=0.65}, uses=50, maxlevel=0}
}
}
})
minetest.register_tool(":moreores:sword_mithril", {
description = "Mithril Sword",
inventory_image = "moreores_tool_mithrilsword.png",
@ -31,29 +17,13 @@ minetest.register_tool(":moreores:sword_mithril", {
-- Regisiter Head Armor
minetest.register_tool("more_armor:helmet_bronze", {
description = "Bronze Helmet",
inventory_image = "more_armor_inv_helmet_bronze.png",
groups = {armor_head=4, armor_heal=15, armor_use=500},
wear = 0,
})
minetest.register_tool("more_armor:helmet_mithril", {
description = "Mithril Helmet",
inventory_image = "more_armor_inv_helmet_mithril.png",
groups = {armor_head=5, armor_heal=20, armor_use=100},
groups = {armor_head=15, armor_heal=15, armor_use=50},
wear = 0,
})
minetest.register_craft({
output = "more_armor:helmet_bronze",
recipe = {
{"moreores:bronze_ingot", "moreores:bronze_ingot", "moreores:bronze_ingot"},
{"moreores:bronze_ingot", "", "moreores:bronze_ingot"},
{"", "", ""},
},
})
minetest.register_craft({
output = "more_armor:helmet_mithril",
recipe = {
@ -65,29 +35,13 @@ minetest.register_craft({
-- Regisiter Torso Armor
minetest.register_tool("more_armor:chestplate_bronze", {
description = "Bronze Chestplate",
inventory_image = "more_armor_inv_chestplate_bronze.png",
groups = {armor_torso=4, armor_heal=20, armor_use=1000},
wear = 0,
})
minetest.register_tool("more_armor:chestplate_mithril", {
description = "Mithril Chestplate",
inventory_image = "more_armor_inv_chestplate_mithril.png",
groups = {armor_torso=5, armor_heal=25, armor_use=250},
groups = {armor_torso=25, armor_heal=15, armor_use=50},
wear = 0,
})
minetest.register_craft({
output = "more_armor:chestplate_bronze",
recipe = {
{"moreores:bronze_ingot", "", "moreores:bronze_ingot"},
{"moreores:bronze_ingot", "moreores:bronze_ingot", "moreores:bronze_ingot"},
{"moreores:bronze_ingot", "moreores:bronze_ingot", "moreores:bronze_ingot"},
},
})
minetest.register_craft({
output = "more_armor:chestplate_mithril",
recipe = {
@ -99,29 +53,13 @@ minetest.register_craft({
-- Regisiter Leg Armor
minetest.register_tool("more_armor:leggings_bronze", {
description = "Bronze Leggings",
inventory_image = "more_armor_inv_leggings_bronze.png",
groups = {armor_legs=4, armor_heal=15, armor_use=500},
wear = 0,
})
minetest.register_tool("more_armor:leggings_mithril", {
description = "Mithril Leggings",
inventory_image = "more_armor_inv_leggings_mithril.png",
groups = {armor_legs=5, armor_heal=20, armor_use=100},
groups = {armor_legs=20, armor_heal=15, armor_use=50},
wear = 0,
})
minetest.register_craft({
output = "more_armor:leggings_bronze",
recipe = {
{"moreores:bronze_ingot", "moreores:bronze_ingot", "moreores:bronze_ingot"},
{"moreores:bronze_ingot", "", "moreores:bronze_ingot"},
{"moreores:bronze_ingot", "", "moreores:bronze_ingot"},
},
})
minetest.register_craft({
output = "more_armor:leggings_mithril",
recipe = {
@ -133,29 +71,13 @@ minetest.register_craft({
-- Regisiter Shields
minetest.register_tool("more_armor:shield_bronze", {
description = "Bronze Shield",
inventory_image = "more_armor_inv_shield_bronze.png",
groups = {armor_shield=4, armor_heal=20, armor_use=500},
wear = 0,
})
minetest.register_tool("more_armor:shield_mithril", {
description = "Mithril Shield",
inventory_image = "more_armor_inv_shield_mithril.png",
groups = {armor_shield=5, armor_heal=25, armor_use=100},
groups = {armor_shield=25, armor_heal=15, armor_use=50},
wear = 0,
})
minetest.register_craft({
output = "more_armor:shield_bronze",
recipe = {
{"moreores:bronze_ingot", "moreores:bronze_ingot", "moreores:bronze_ingot"},
{"moreores:bronze_ingot", "moreores:bronze_ingot", "moreores:bronze_ingot"},
{"", "moreores:bronze_ingot", ""},
},
})
minetest.register_craft({
output = "more_armor:shield_mithril",
recipe = {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

5
unified_skins/README.txt Normal file

@ -0,0 +1,5 @@
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 64x32px player skins.

67
unified_skins/init.lua Normal file

@ -0,0 +1,67 @@
uniskins = {
skins = {},
default_character_skin = "character.png",
}
uniskins.get_player_skin = function(self, name)
if minetest.get_modpath("skins") then
local skin = skins.skins[name]
if skin then
if skins.get_type(skin) == skins.type.MODEL then
return skin..".png"
end
end
end
if self.skins[name] then
return self.skins[name]
end
return self.default_character_skin
end
uniskins.update_player_visuals = function(self, player)
if not player then
return
end
local name = player:get_player_name()
local texture = self:get_player_skin(name)
local has_wieldview = minetest.get_modpath("wieldview")
if has_wieldview then
texture = "wieldview_character_bg.png^[combine:64x64:0,32="..texture
local wielded_item_texture = wieldview:get_wielded_item_texture(player)
if wielded_item_texture then
texture = texture.."^[combine:64x64:0,0="..wielded_item_texture
end
end
if minetest.get_modpath("3d_armor") then
local textures = armor_api:get_armor_textures(player)
for _,v in ipairs({"head", "torso", "legs"}) do
if textures[v] then
texture = texture.."^"
if has_wieldview then
texture = texture.."[combine:64x64:0,32="
end
texture = texture..textures[v]
end
end
if has_wieldview and textures["shield"] then
texture = texture.."^[combine:64x64:16,0="..textures["shield"]
end
end
player:set_properties({
visual = "mesh",
textures = {texture},
visual_size = {x=1, y=1},
})
end
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
local filename = minetest.get_modpath("player_textures").."/textures/player_"..name
local f = io.open(filename..".png")
if f then
f:close()
uniskins.skins[name] = "player_"..player:get_player_name()..".png"
end
end)

@ -1,9 +1,15 @@
[mod] visible wielded items [wieldview]
=======================================
depends: default
depends: default, unified_skins
Makes hand wielded items visible to other players. Compatible with player skins mod [skins].
note: currently only supports 16x16px texture packs and 64x32px player skins, sorry!
Note: Currently only supports 16x16px texture packs, sorry!
default settings: [minetest.conf]
# Set number of seconds between visible wielded item updates.
wieldview_update_time = 2

@ -1,2 +1,2 @@
default
unified_skins

@ -1,28 +1,14 @@
local time = 0
local update_time = tonumber(minetest.setting_get("wieldview_update_time"))
if update_time == nil then
if not update_time then
update_time = 2
minetest.setting_set("wieldview_update_time", tostring(update_time))
end
wieldview = {
default_character_skin = "character.png",
wielded_items = {},
}
wieldview.get_player_skin = function(self, name)
local mod_path = minetest.get_modpath("skins")
if mod_path then
local skin = skins.skins[name]
if skin then
if skins.get_type(skin) == skins.type.MODEL then
return skin..".png"
end
end
end
return self.default_character_skin
end
wieldview.get_wielded_item_texture = function(self, player)
if not player then
return nil
@ -45,28 +31,6 @@ wieldview.get_wielded_item_texture = function(self, player)
return texture
end
wieldview.update_player_visuals = function(self, player)
if not player then
return
end
local name = player:get_player_name()
local texture = "wieldview_character_bg.png^[combine:64x64:0,32="..self:get_player_skin(name)
local player_inv = player:get_inventory()
local wielded_item_texture = self:get_wielded_item_texture(player)
if wielded_item_texture then
texture = texture.."^[combine:64x64:0,0="..wielded_item_texture
end
local mod_path = minetest.get_modpath("3d_armor")
if mod_path then
texture = texture..armor_api:get_player_armor(player)
end
player:set_properties({
visual = "mesh",
textures = {texture},
visual_size = {x=1, y=1},
})
end
wieldview.update_wielded_item = function(self, player)
if not player then
return
@ -81,33 +45,29 @@ wieldview.update_wielded_item = function(self, player)
if self.wielded_items[name] == item then
return
end
self:update_player_visuals(player)
uniskins:update_player_visuals(player)
end
self.wielded_items[name] = item
end
minetest.register_on_joinplayer(function(player)
local texture = wieldview:get_player_skin(name)
local texture = uniskins:get_player_skin(name)
player:set_properties({
visual = "mesh",
mesh = "wieldview_character.x",
textures = {texture},
visual_size = {x=1, y=1},
})
minetest.after(1, function(player)
wieldview:update_player_visuals(player)
minetest.after(0, function(player)
uniskins:update_player_visuals(player)
end, player)
end)
minetest.register_globalstep(function(dtime)
time = time + dtime
if time > update_time then
local mod_path = minetest.get_modpath("3d_armor")
for _,player in ipairs(minetest.get_connected_players()) do
wieldview:update_wielded_item(player)
if mod_path then
armor_api:update_armor(player)
end
end
time = 0
end