mirror of
https://github.com/mt-mods/spacesuit.git
synced 2026-05-04 13:56:51 -06:00
spacesuit wear
This commit is contained in:
@@ -1,30 +1,30 @@
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_tool("spacesuit:helmet", {
|
armor:register_armor("spacesuit:helmet", {
|
||||||
description = "Spacesuit Helmet",
|
description = "Spacesuit Helmet",
|
||||||
inventory_image = "spacesuit_inv_helmet.png",
|
inventory_image = "spacesuit_inv_helmet.png",
|
||||||
groups = {armor_head=5, armor_heal=1, armor_use=75},
|
groups = {armor_head=5, armor_heal=1, armor_use=150},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("spacesuit:chestplate", {
|
minetest.register_tool("spacesuit:chestplate", {
|
||||||
description = "Spacesuit Chestplate",
|
description = "Spacesuit Chestplate",
|
||||||
inventory_image = "spacesuit_inv_chestplate.png",
|
inventory_image = "spacesuit_inv_chestplate.png",
|
||||||
groups = {armor_torso=8, armor_heal=1, armor_use=75},
|
groups = {armor_torso=8, armor_heal=1, armor_use=150},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("spacesuit:pants", {
|
minetest.register_tool("spacesuit:pants", {
|
||||||
description = "Spacesuit Pants",
|
description = "Spacesuit Pants",
|
||||||
inventory_image = "spacesuit_inv_pants.png",
|
inventory_image = "spacesuit_inv_pants.png",
|
||||||
groups = {armor_legs=7, armor_heal=1, armor_use=75},
|
groups = {armor_legs=7, armor_heal=1, armor_use=150},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("spacesuit:boots", {
|
minetest.register_tool("spacesuit:boots", {
|
||||||
description = "Spacesuit Boots",
|
description = "Spacesuit Boots",
|
||||||
inventory_image = "spacesuit_inv_boots.png",
|
inventory_image = "spacesuit_inv_boots.png",
|
||||||
groups = {armor_feet=4, armor_heal=1, armor_use=75},
|
groups = {armor_feet=4, armor_heal=1, armor_use=150},
|
||||||
wear = 0,
|
wear = 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -73,7 +73,6 @@ minetest.register_globalstep(function(dtime)
|
|||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
for _,player in ipairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local inv = player:get_inventory()
|
|
||||||
|
|
||||||
local name, armor_inv = armor.get_valid_player(armor, player, "[spacesuit]")
|
local name, armor_inv = armor.get_valid_player(armor, player, "[spacesuit]")
|
||||||
local has_helmet = armor_inv:contains_item("armor", "spacesuit:helmet")
|
local has_helmet = armor_inv:contains_item("armor", "spacesuit:helmet")
|
||||||
@@ -82,8 +81,16 @@ minetest.register_globalstep(function(dtime)
|
|||||||
local has_boots = armor_inv:contains_item("armor", "spacesuit:boots")
|
local has_boots = armor_inv:contains_item("armor", "spacesuit:boots")
|
||||||
|
|
||||||
if has_helmet and has_chestplate and has_pants and has_boots and player:get_breath() < 10 then
|
if has_helmet and has_chestplate and has_pants and has_boots and player:get_breath() < 10 then
|
||||||
|
|
||||||
|
for i, stack in pairs(armor_inv:get_list("armor")) do
|
||||||
|
if not stack:is_empty() then
|
||||||
|
local name = stack:get_name()
|
||||||
|
local use = minetest.get_item_group(name, "armor_use") or 0
|
||||||
|
armor:damage(player, i, stack, use)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
player:set_breath(10)
|
player:set_breath(10)
|
||||||
-- TODO: wear
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
timer = 0
|
timer = 0
|
||||||
@@ -91,4 +98,4 @@ minetest.register_globalstep(function(dtime)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
print("[OK] Spacesuit")
|
print("[OK] Spacesuit")
|
||||||
|
|||||||
Reference in New Issue
Block a user