forked from VoxeLibre/VoxeLibre
parent
a539b25b08
commit
95cdf7c00a
|
@ -1,36 +1,5 @@
|
||||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/armor.lua")
|
dofile(minetest.get_modpath(minetest.get_current_modname()).."/armor.lua")
|
||||||
|
|
||||||
local wear_armor = function(itemstack, user, pointed_thing)
|
|
||||||
local groups = minetest.registered_items[itemstack:get_name()].groups
|
|
||||||
local slot
|
|
||||||
if groups then
|
|
||||||
if groups.armor_head then
|
|
||||||
slot = 2
|
|
||||||
elseif groups.armor_torso then
|
|
||||||
slot = 3
|
|
||||||
elseif groups.armor_legs then
|
|
||||||
slot = 4
|
|
||||||
elseif groups.armor_feet then
|
|
||||||
slot = 5
|
|
||||||
end
|
|
||||||
if slot then
|
|
||||||
local ainv = minetest.get_inventory({type="detached", name=user:get_player_name().."_armor"})
|
|
||||||
local inv = user:get_inventory()
|
|
||||||
local old = inv:get_stack("armor", slot)
|
|
||||||
ainv:set_stack("armor", slot, itemstack)
|
|
||||||
inv:set_stack("armor", slot, itemstack)
|
|
||||||
armor:set_player_armor(user)
|
|
||||||
armor:update_inventory(user)
|
|
||||||
if old:is_empty() then
|
|
||||||
itemstack:take_item()
|
|
||||||
else
|
|
||||||
itemstack = old
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Regisiter Head Armor
|
-- Regisiter Head Armor
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:helmet_leather", {
|
minetest.register_tool("3d_armor:helmet_leather", {
|
||||||
|
@ -38,8 +7,6 @@ minetest.register_tool("3d_armor:helmet_leather", {
|
||||||
inventory_image = "3d_armor_inv_helmet_leather.png",
|
inventory_image = "3d_armor_inv_helmet_leather.png",
|
||||||
groups = {armor_head=5, armor_heal=0, armor_use=100},
|
groups = {armor_head=5, armor_heal=0, armor_use=100},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:helmet_iron", {
|
minetest.register_tool("3d_armor:helmet_iron", {
|
||||||
|
@ -47,8 +14,6 @@ minetest.register_tool("3d_armor:helmet_iron", {
|
||||||
inventory_image = "3d_armor_inv_helmet_iron.png",
|
inventory_image = "3d_armor_inv_helmet_iron.png",
|
||||||
groups = {armor_head=10, armor_heal=5, armor_use=250},
|
groups = {armor_head=10, armor_heal=5, armor_use=250},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:helmet_gold", {
|
minetest.register_tool("3d_armor:helmet_gold", {
|
||||||
|
@ -56,8 +21,6 @@ minetest.register_tool("3d_armor:helmet_gold", {
|
||||||
inventory_image = "3d_armor_inv_helmet_gold.png",
|
inventory_image = "3d_armor_inv_helmet_gold.png",
|
||||||
groups = {armor_head=15, armor_heal=10, armor_use=500},
|
groups = {armor_head=15, armor_heal=10, armor_use=500},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:helmet_diamond",{
|
minetest.register_tool("3d_armor:helmet_diamond",{
|
||||||
|
@ -65,8 +28,6 @@ minetest.register_tool("3d_armor:helmet_diamond",{
|
||||||
inventory_image = "3d_armor_inv_helmet_diamond.png",
|
inventory_image = "3d_armor_inv_helmet_diamond.png",
|
||||||
groups = {armor_head=20, armor_heal=15, armor_use=750},
|
groups = {armor_head=20, armor_heal=15, armor_use=750},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:helmet_chain", {
|
minetest.register_tool("3d_armor:helmet_chain", {
|
||||||
|
@ -74,8 +35,6 @@ minetest.register_tool("3d_armor:helmet_chain", {
|
||||||
inventory_image = "3d_armor_inv_helmet_chain.png",
|
inventory_image = "3d_armor_inv_helmet_chain.png",
|
||||||
groups = {armor_head=15, armor_heal=10, armor_use=500},
|
groups = {armor_head=15, armor_heal=10, armor_use=500},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Regisiter Torso Armor
|
-- Regisiter Torso Armor
|
||||||
|
@ -85,8 +44,6 @@ minetest.register_tool("3d_armor:chestplate_leather", {
|
||||||
inventory_image = "3d_armor_inv_chestplate_leather.png",
|
inventory_image = "3d_armor_inv_chestplate_leather.png",
|
||||||
groups = {armor_torso=15, armor_heal=0, armor_use=100},
|
groups = {armor_torso=15, armor_heal=0, armor_use=100},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:chestplate_iron", {
|
minetest.register_tool("3d_armor:chestplate_iron", {
|
||||||
|
@ -94,8 +51,6 @@ minetest.register_tool("3d_armor:chestplate_iron", {
|
||||||
inventory_image = "3d_armor_inv_chestplate_iron.png",
|
inventory_image = "3d_armor_inv_chestplate_iron.png",
|
||||||
groups = {armor_torso=20, armor_heal=5, armor_use=250},
|
groups = {armor_torso=20, armor_heal=5, armor_use=250},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:chestplate_gold", {
|
minetest.register_tool("3d_armor:chestplate_gold", {
|
||||||
|
@ -103,8 +58,6 @@ minetest.register_tool("3d_armor:chestplate_gold", {
|
||||||
inventory_image = "3d_armor_inv_chestplate_gold.png",
|
inventory_image = "3d_armor_inv_chestplate_gold.png",
|
||||||
groups = {armor_torso=25, armor_heal=10, armor_use=500},
|
groups = {armor_torso=25, armor_heal=10, armor_use=500},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:chestplate_diamond",{
|
minetest.register_tool("3d_armor:chestplate_diamond",{
|
||||||
|
@ -112,8 +65,6 @@ minetest.register_tool("3d_armor:chestplate_diamond",{
|
||||||
inventory_image = "3d_armor_inv_chestplate_diamond.png",
|
inventory_image = "3d_armor_inv_chestplate_diamond.png",
|
||||||
groups = {armor_torso=30, armor_heal=15, armor_use=750},
|
groups = {armor_torso=30, armor_heal=15, armor_use=750},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:chestplate_chain", {
|
minetest.register_tool("3d_armor:chestplate_chain", {
|
||||||
|
@ -121,8 +72,6 @@ minetest.register_tool("3d_armor:chestplate_chain", {
|
||||||
inventory_image = "3d_armor_inv_chestplate_chain.png",
|
inventory_image = "3d_armor_inv_chestplate_chain.png",
|
||||||
groups = {armor_torso=25, armor_heal=10, armor_use=500},
|
groups = {armor_torso=25, armor_heal=10, armor_use=500},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Regisiter Leg Armor
|
-- Regisiter Leg Armor
|
||||||
|
@ -132,8 +81,6 @@ minetest.register_tool("3d_armor:leggings_leather", {
|
||||||
inventory_image = "3d_armor_inv_leggings_leather.png",
|
inventory_image = "3d_armor_inv_leggings_leather.png",
|
||||||
groups = {armor_legs=10, armor_heal=0, armor_use=100},
|
groups = {armor_legs=10, armor_heal=0, armor_use=100},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:leggings_iron", {
|
minetest.register_tool("3d_armor:leggings_iron", {
|
||||||
|
@ -141,8 +88,6 @@ minetest.register_tool("3d_armor:leggings_iron", {
|
||||||
inventory_image = "3d_armor_inv_leggings_iron.png",
|
inventory_image = "3d_armor_inv_leggings_iron.png",
|
||||||
groups = {armor_legs=15, armor_heal=5, armor_use=250},
|
groups = {armor_legs=15, armor_heal=5, armor_use=250},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:leggings_gold", {
|
minetest.register_tool("3d_armor:leggings_gold", {
|
||||||
|
@ -150,8 +95,6 @@ minetest.register_tool("3d_armor:leggings_gold", {
|
||||||
inventory_image = "3d_armor_inv_leggings_gold.png",
|
inventory_image = "3d_armor_inv_leggings_gold.png",
|
||||||
groups = {armor_legs=20, armor_heal=10, armor_use=500},
|
groups = {armor_legs=20, armor_heal=10, armor_use=500},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:leggings_diamond",{
|
minetest.register_tool("3d_armor:leggings_diamond",{
|
||||||
|
@ -159,8 +102,6 @@ minetest.register_tool("3d_armor:leggings_diamond",{
|
||||||
inventory_image = "3d_armor_inv_leggings_diamond.png",
|
inventory_image = "3d_armor_inv_leggings_diamond.png",
|
||||||
groups = {armor_legs=25, armor_heal=15, armor_use=750},
|
groups = {armor_legs=25, armor_heal=15, armor_use=750},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:leggings_chain", {
|
minetest.register_tool("3d_armor:leggings_chain", {
|
||||||
|
@ -168,8 +109,6 @@ minetest.register_tool("3d_armor:leggings_chain", {
|
||||||
inventory_image = "3d_armor_inv_leggings_chain.png",
|
inventory_image = "3d_armor_inv_leggings_chain.png",
|
||||||
groups = {armor_legs=20, armor_heal=10, armor_use=500},
|
groups = {armor_legs=20, armor_heal=10, armor_use=500},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
-- Regisiter Boots
|
-- Regisiter Boots
|
||||||
|
|
||||||
|
@ -178,8 +117,6 @@ minetest.register_tool("3d_armor:boots_leather", {
|
||||||
inventory_image = "3d_armor_inv_boots_leather.png",
|
inventory_image = "3d_armor_inv_boots_leather.png",
|
||||||
groups = {armor_feet=5, armor_heal=0, armor_use=100},
|
groups = {armor_feet=5, armor_heal=0, armor_use=100},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:boots_iron", {
|
minetest.register_tool("3d_armor:boots_iron", {
|
||||||
|
@ -187,8 +124,6 @@ minetest.register_tool("3d_armor:boots_iron", {
|
||||||
inventory_image = "3d_armor_inv_boots_iron.png",
|
inventory_image = "3d_armor_inv_boots_iron.png",
|
||||||
groups = {armor_feet=10, armor_heal=5, armor_use=250},
|
groups = {armor_feet=10, armor_heal=5, armor_use=250},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:boots_gold", {
|
minetest.register_tool("3d_armor:boots_gold", {
|
||||||
|
@ -196,8 +131,6 @@ minetest.register_tool("3d_armor:boots_gold", {
|
||||||
inventory_image = "3d_armor_inv_boots_gold.png",
|
inventory_image = "3d_armor_inv_boots_gold.png",
|
||||||
groups = {armor_feet=15, armor_heal=10, armor_use=500},
|
groups = {armor_feet=15, armor_heal=10, armor_use=500},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:boots_diamond",{
|
minetest.register_tool("3d_armor:boots_diamond",{
|
||||||
|
@ -205,8 +138,6 @@ minetest.register_tool("3d_armor:boots_diamond",{
|
||||||
inventory_image = "3d_armor_inv_boots_diamond.png",
|
inventory_image = "3d_armor_inv_boots_diamond.png",
|
||||||
groups = {armor_feet=20, armor_heal=15, armor_use=750},
|
groups = {armor_feet=20, armor_heal=15, armor_use=750},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:boots_chain", {
|
minetest.register_tool("3d_armor:boots_chain", {
|
||||||
|
@ -214,8 +145,6 @@ minetest.register_tool("3d_armor:boots_chain", {
|
||||||
inventory_image = "3d_armor_inv_boots_chain.png",
|
inventory_image = "3d_armor_inv_boots_chain.png",
|
||||||
groups = {armor_feet=15, armor_heal=10, armor_use=500},
|
groups = {armor_feet=15, armor_heal=10, armor_use=500},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
on_place = wear_armor,
|
|
||||||
on_secondary_use = wear_armor,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Register Craft Recipies
|
-- Register Craft Recipies
|
||||||
|
|
Loading…
Reference in New Issue