if minetest.get_modpath("3d_armor") then --- Magic Helmet armor:register_armor("brewing:helmet_magic", { description = ("Магический Шлем"), inventory_image = "brewing_inv_helmet_magic.png", groups = {radiation=100, armor_head=1, armor_heal=12, armor_use=600, armor_fire=1}, armor_groups = {fleshy=15}, damage_groups = {cracky=2, snappy=1, level=3}, }) --- Magic Chestplate armor:register_armor("brewing:chestplate_magic", { description = ("Магический Нагрудник"), inventory_image = "brewing_inv_chestplate_magic.png", groups = {radiation=100, armor_torso=1, armor_heal=12, armor_use=600, armor_fire=1}, armor_groups = {fleshy=20}, damage_groups = {cracky=2, snappy=1, level=3}, }) --- Magic Leggings armor:register_armor("brewing:leggings_magic", { description = ("Магические Поножи"), inventory_image = "brewing_inv_leggings_magic.png", groups = {radiation=100, armor_legs=1, armor_heal=12, armor_use=600, armor_fire=1}, armor_groups = {fleshy=20}, damage_groups = {cracky=2, snappy=1, level=3}, }) --- Magic Boots armor:register_armor("brewing:boots_magic", { description = ("Магические Ботинки"), inventory_image = "brewing_inv_boots_magic.png", groups = {radiation=100, armor_feet=1, armor_heal=12, armor_use=600, physics_speed=2, physics_jump=0.75, armor_fire=1}, armor_groups = {fleshy=15}, damage_groups = {cracky=2, snappy=1, level=3}, }) end --- Craft if minetest.get_modpath("3d_armor") or minetest.get_modpath("mcl_armor") then --- Magic Helmet minetest.register_craft({ output = "brewing:helmet_magic", recipe = { {"brewing:magic_gem", "brewing:magic_gem", "brewing:magic_gem"}, {"brewing:magic_gem", "", "brewing:magic_gem"}, {"", "", ""} } }) --- Magic Chestplate minetest.register_craft({ output = "brewing:chestplate_magic", recipe = { {"brewing:magic_gem", "", "brewing:magic_gem"}, {"brewing:magic_gem", "brewing:magic_gem", "brewing:magic_gem"}, {"brewing:magic_gem", "brewing:magic_gem", "brewing:magic_gem"} } }) --- Magic Leggings minetest.register_craft({ output = "brewing:leggings_magic", recipe = { {"brewing:magic_gem", "brewing:magic_gem", "brewing:magic_gem"}, {"brewing:magic_gem", "", "brewing:magic_gem"}, {"brewing:magic_gem", "", "brewing:magic_gem"} } }) --- Magic Boots minetest.register_craft({ output = "brewing:boots_magic", recipe = { {"", "", ""}, {"brewing:magic_gem", "", "brewing:magic_gem"}, {"brewing:magic_gem", "", "brewing:magic_gem"} } }) end -- Armor/Tool Player Damage if allow_tool_damage or (allow_armor_damage and minetest.get_modpath("3d_armor")) then local function has_item(player_name, item_name) local inventory = minetest.get_inventory({type="player", name=player_name}) local main_list = inventory:get_list("main") for _, stack in ipairs(main_list) do if stack:get_name() == item_name then return true end end return false end local function alter_health(player, change) if player == nil then return end local hp_max = player:get_properties().hp_max local current_health = player:get_hp() local new_health = current_health + change if new_health > hp_max then new_health = hp_max end if new_health < 0 then new_health = 0 end player:set_hp(new_health) end local function has_radioactive_tool(player) local wield = player:get_wielded_item() if wield then local tool_cap = wield:get_tool_capabilities() if tool_cap and tool_cap.damage_groups and tool_cap.damage_groups.radioactive then return true end end return false end local function pattern_count(base, pattern) return select(2, string.gsub(base, pattern, "")) end local function get_radioactive_armor_count(player) local inv_3d = player:get_meta():get_string("3d_armor_inventory") if not inv_3d then return 0 end return pattern_count(inv_3d, "uraniumstuff:") end local function damage_players() local players = minetest.get_connected_players() for _, player in ipairs(players) do local damage = 0 if allow_armor_damage then damage = damage + get_radioactive_armor_count(player) end if allow_tool_damage and has_radioactive_tool(player) then damage = damage + 1 end if damage > 0 then local player_name = player:get_player_name() local has_gem = has_item(player_name, "uraniumstuff:uranium_protection_gem") if not has_gem then alter_health(player, damage*-1) end end end minetest.after(5, damage_players) end damage_players() end