Replace deprecated get_entity_name

This commit is contained in:
Wuzzy 2017-08-18 21:58:20 +02:00
parent 4dc1d6b43b
commit e2442a6283
5 changed files with 12 additions and 8 deletions

@ -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

@ -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

@ -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

@ -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

@ -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