From e2442a6283e164fa0c259edcad9f0928000103db Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 18 Aug 2017 21:58:20 +0200 Subject: [PATCH] Replace deprecated get_entity_name --- mods/ENTITIES/mobs_mc/ender_dragon.lua | 2 +- mods/ENTITIES/mobs_mc/wither.lua | 2 +- mods/ITEMS/mcl_banners/init.lua | 6 ++++-- mods/ITEMS/mcl_signs/init.lua | 6 ++++-- mods/ITEMS/mcl_tnt/init.lua | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index 790ec19bc..02d7e04c7 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -120,7 +120,7 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon2", { local objects = minetest.get_objects_inside_radius(pos, 1) for _,obj in ipairs(objects) do - local name = obj:get_entity_name() + local name = self.name if name~="mobs_mc:roar_of_the_dragon2" and name ~= "mobs_mc:enderdragon" then obj:set_hp(obj:get_hp()-0.05) if (obj:get_hp() <= 0) then diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index 21c21f6a0..65d8ed9b2 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -95,7 +95,7 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon", { local objects = minetest.get_objects_inside_radius(pos, 1) for _,obj in ipairs(objects) do - local name = obj:get_entity_name() + local name = self.name if name~="mobs_mc:roar_of_the_dragon" and name ~= "mobs_mc:wither" then obj:set_hp(obj:get_hp()-0.05) if (obj:get_hp() <= 0) then diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index ec78fa448..e48c680b2 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -47,7 +47,8 @@ local on_destruct_standing_banner = function(pos) local checkpos = vector.add(pos, standing_banner_entity_offset) local objects = minetest.get_objects_inside_radius(checkpos, 0.5) for _, v in ipairs(objects) do - if v:get_entity_name() == "mcl_banners:standing_banner" then + local ent = v:get_luaentity() + if ent and ent.name == "mcl_banners:standing_banner" then v:get_luaentity():_drop() end end @@ -58,7 +59,8 @@ local on_destruct_hanging_banner = function(pos) local checkpos = vector.add(pos, hanging_banner_entity_offset) local objects = minetest.get_objects_inside_radius(checkpos, 0.5) for _, v in ipairs(objects) do - if v:get_entity_name() == "mcl_banners:hanging_banner" then + local ent = v:get_luaentity() + if ent and ent.name == "mcl_banners:hanging_banner" then v:get_luaentity():_drop() end end diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index c4bcec3e0..be63501ab 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -162,7 +162,8 @@ local sign_groups = {handy=1,axey=1, flammable=1, deco_block=1, material_wood=1, local destruct_sign = function(pos) local objects = minetest.get_objects_inside_radius(pos, 0.5) for _, v in ipairs(objects) do - if v:get_entity_name() == "mcl_signs:text" then + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then v:remove() end end @@ -183,7 +184,8 @@ local update_sign = function(pos, fields, sender) end local objects = minetest.get_objects_inside_radius(pos, 0.5) for _, v in ipairs(objects) do - if v:get_entity_name() == "mcl_signs:text" then + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then v:set_properties({textures={generate_texture(create_lines(text), v:get_luaentity()._signnodename)}}) return end diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 4d0f59961..ff91b0f44 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -18,10 +18,10 @@ end local function do_tnt_physics(tnt_np,tntr) local objs = minetest.get_objects_inside_radius(tnt_np, tntr) for k, obj in pairs(objs) do - local oname = obj:get_entity_name() + local ent = obj:get_luaentity() local v = obj:getvelocity() local p = obj:getpos() - if oname == "mcl_tnt:tnt" then + if ent and ent.name == "mcl_tnt:tnt" then obj:setvelocity({x=(p.x - tnt_np.x) + (tntr / 2) + v.x, y=(p.y - tnt_np.y) + tntr + v.y, z=(p.z - tnt_np.z) + (tntr / 2) + v.z}) else if v ~= nil then