Add some armor textures.
This commit is contained in:
parent
0f2f3983df
commit
3bac48e1e2
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
#
|
||||
|
||||
*.xcf
|
||||
*.swp
|
36
init.lua
36
init.lua
@ -37,6 +37,7 @@ minetest.register_tool(mod_name..':leather_armor', {
|
||||
description = 'Leather Armor',
|
||||
_dinv_armor = 0.9,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_leather_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':boots', {
|
||||
@ -44,6 +45,7 @@ minetest.register_tool(mod_name..':boots', {
|
||||
description = 'Sturdy Boots',
|
||||
_dinv_armor = 0.9,
|
||||
_dinv_location = 'feet',
|
||||
_dinv_texture = 'dinv_char_boots.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':leather_cap', {
|
||||
@ -51,6 +53,7 @@ minetest.register_tool(mod_name..':leather_cap', {
|
||||
description = 'Leather Cap',
|
||||
_dinv_armor = 0.9,
|
||||
_dinv_location = 'head',
|
||||
_dinv_texture = 'dinv_char_leather_helm.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':steel_helmet', {
|
||||
@ -58,6 +61,7 @@ minetest.register_tool(mod_name..':steel_helmet', {
|
||||
description = 'Steel Helmet',
|
||||
_dinv_armor = 0.8,
|
||||
_dinv_location = 'head',
|
||||
--_dinv_texture = '',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':wood_shield', {
|
||||
@ -65,6 +69,7 @@ minetest.register_tool(mod_name..':wood_shield', {
|
||||
description = 'Wooden Shield',
|
||||
_dinv_armor = 0.8,
|
||||
_dinv_location = 'arm',
|
||||
_dinv_texture = 'dinv_char_wood_shield.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':steel_shield', {
|
||||
@ -72,6 +77,7 @@ minetest.register_tool(mod_name..':steel_shield', {
|
||||
description = 'Steel Shield',
|
||||
_dinv_armor = 0.7,
|
||||
_dinv_location = 'arm',
|
||||
--_dinv_texture = '',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':chain_armor', {
|
||||
@ -79,6 +85,7 @@ minetest.register_tool(mod_name..':chain_armor', {
|
||||
description = 'Chain Mail',
|
||||
_dinv_armor = 0.75,
|
||||
_dinv_location = 'body',
|
||||
_dinv_texture = 'dinv_char_chain_armor.png',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':plate_armor', {
|
||||
@ -86,6 +93,7 @@ minetest.register_tool(mod_name..':plate_armor', {
|
||||
description = 'Plate Mail',
|
||||
_dinv_armor = 0.6,
|
||||
_dinv_location = 'body',
|
||||
--_dinv_texture = '',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':diamond_plate_armor', {
|
||||
@ -93,6 +101,7 @@ minetest.register_tool(mod_name..':diamond_plate_armor', {
|
||||
description = 'Diamond Plate Mail',
|
||||
_dinv_armor = 0.45,
|
||||
_dinv_location = 'body',
|
||||
--_dinv_texture = '',
|
||||
})
|
||||
|
||||
minetest.register_tool(mod_name..':fur_cloak', {
|
||||
@ -101,6 +110,7 @@ minetest.register_tool(mod_name..':fur_cloak', {
|
||||
_dinv_armor = 0.98,
|
||||
_dinv_warmth = 2,
|
||||
_dinv_location = 'back',
|
||||
--_dinv_texture = '',
|
||||
})
|
||||
|
||||
--print(dump(minetest.registered_tools[mod_name..':plate_armor']))
|
||||
@ -640,6 +650,7 @@ minetest.register_on_joinplayer(function(player)
|
||||
pinv:set_size(worn_inv, 8)
|
||||
mod.set_main_size_by_bags(player)
|
||||
mod.set_armor(player)
|
||||
mod.set_armor_textures(player)
|
||||
player:set_inventory_formspec(mod.make_inventory_spec(player))
|
||||
end)
|
||||
|
||||
@ -829,6 +840,29 @@ function mod.get_warmth(player)
|
||||
end
|
||||
|
||||
|
||||
function mod.set_armor_textures(player)
|
||||
local prop = player:get_properties()
|
||||
local textures = prop.textures
|
||||
--local tex = (textures and textures[1] or 'character.png')
|
||||
local tex = 'character.png'
|
||||
local pile = {}
|
||||
for k, v in worn_items(player) do
|
||||
local vs = v:get_name()
|
||||
local it = minetest.registered_items[vs]
|
||||
if it._dinv_location and it._dinv_texture then
|
||||
pile[it._dinv_location] = it._dinv_texture
|
||||
end
|
||||
end
|
||||
for _, loc in pairs({ 'body', 'feet', 'head', 'arm', 'back' }) do
|
||||
if pile[loc] then
|
||||
tex = tex .. '^' .. pile[loc]
|
||||
end
|
||||
end
|
||||
textures = { tex }
|
||||
player_api.set_textures(player, textures)
|
||||
end
|
||||
|
||||
|
||||
function mod.set_armor(player)
|
||||
if not player then
|
||||
return
|
||||
@ -870,6 +904,7 @@ function mod.damage_armor(player, damage)
|
||||
player:get_inventory():set_stack(worn_inv, k, v)
|
||||
if ow + wear > 65535 then
|
||||
mod.set_armor(player)
|
||||
mod.set_armor_textures(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -912,6 +947,7 @@ minetest.register_on_player_inventory_action(function(player, action, inventory,
|
||||
|
||||
mod.set_main_size_by_bags(player)
|
||||
mod.set_armor(player)
|
||||
mod.set_armor_textures(player)
|
||||
end)
|
||||
|
||||
|
||||
|
BIN
textures/dinv_char_boots.png
Normal file
BIN
textures/dinv_char_boots.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 204 B |
BIN
textures/dinv_char_chain_armor.png
Normal file
BIN
textures/dinv_char_chain_armor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
textures/dinv_char_leather_armor.png
Normal file
BIN
textures/dinv_char_leather_armor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 928 B |
BIN
textures/dinv_char_leather_helm.png
Normal file
BIN
textures/dinv_char_leather_helm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 250 B |
BIN
textures/dinv_char_wood_shield.png
Normal file
BIN
textures/dinv_char_wood_shield.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 B |
Loading…
x
Reference in New Issue
Block a user