also check amor variable while integrating with 3D Armor

This commit is contained in:
Leonard-Orlando Menzel 2024-01-22 22:38:17 +01:00 committed by GitHub
parent 8408a73851
commit 7c4ce99986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -512,35 +512,39 @@ minetest.register_craftitem("animalia:net", {
----------- -----------
if minetest.get_modpath("3d_armor") then if minetest.get_modpath("3d_armor") then
table.insert(armor.attributes, "heavy_pelt") if amor ~= nil then
table.insert(armor.attributes, "heavy_pelt")
armor:register_armor("animalia:coat_bear_pelt", {
description = "Bear Pelt Coat", armor:register_armor("animalia:coat_bear_pelt", {
inventory_image = "animalia_inv_coat_bear_pelt.png", description = "Bear Pelt Coat",
groups = {armor_torso = 1, armor_heal = 0, armor_heavy_pelt = 1, armor_use = 1000}, inventory_image = "animalia_inv_coat_bear_pelt.png",
armor_groups = {fleshy = 5} groups = {armor_torso = 1, armor_heal = 0, armor_heavy_pelt = 1, armor_use = 1000},
}) armor_groups = {fleshy = 5}
})
minetest.register_on_punchplayer(function(player, hitter, _, _, _, damage)
local name = player:get_player_name() minetest.register_on_punchplayer(function(player, hitter, _, _, _, damage)
if name local name = player:get_player_name()
and (armor.def[name].heavy_pelt or 0) > 0 then if name
local hit_ip = hitter:is_player() and (armor.def[name].heavy_pelt or 0) > 0 then
if hit_ip and minetest.is_protected(player:get_pos(), "") then local hit_ip = hitter:is_player()
return if hit_ip and minetest.is_protected(player:get_pos(), "") then
else return
local player_pos = player:get_pos() else
if not player_pos then return end local player_pos = player:get_pos()
if not player_pos then return end
local biome_data = minetest.get_biome_data(player_pos)
local biome_data = minetest.get_biome_data(player_pos)
if biome_data.heat < 50 then
player:set_hp(player:get_hp() - (damage / 1.5)) if biome_data.heat < 50 then
return true player:set_hp(player:get_hp() - (damage / 1.5))
return true
end
end end
end end
end end)
end) else
minetest.log("warning", "Animalia: Conflicts with other mods, couldnt properly integrate with 3D_armor")
end
end end
----------- -----------
@ -778,4 +782,4 @@ minetest.register_on_craft(function(itemstack, _, old_craft_grid)
end end
end end
end end
end) end)