mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Remove _cmi_is_mob
This commit is contained in:
parent
4054f05a4c
commit
e0f70b54ec
18 changed files with 31 additions and 34 deletions
|
@ -78,7 +78,7 @@ function mcl_damage.from_punch(mcl_reason, object)
|
||||||
mcl_reason.type = "arrow"
|
mcl_reason.type = "arrow"
|
||||||
elseif luaentity._is_fireball then
|
elseif luaentity._is_fireball then
|
||||||
mcl_reason.type = "fireball"
|
mcl_reason.type = "fireball"
|
||||||
elseif luaentity._cmi_is_mob then
|
elseif luaentity.is_mob then
|
||||||
mcl_reason.type = "mob"
|
mcl_reason.type = "mob"
|
||||||
end
|
end
|
||||||
mcl_reason.source = mcl_reason.source or luaentity._source_object
|
mcl_reason.source = mcl_reason.source or luaentity._source_object
|
||||||
|
|
|
@ -524,7 +524,7 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
|
||||||
if luaentity.deal_damage then
|
if luaentity.deal_damage then
|
||||||
luaentity:deal_damage(damage, mcl_reason or {type = "generic"})
|
luaentity:deal_damage(damage, mcl_reason or {type = "generic"})
|
||||||
return
|
return
|
||||||
elseif luaentity._cmi_is_mob then
|
elseif luaentity.is_mob then
|
||||||
-- local puncher = mcl_reason and mcl_reason.direct or target
|
-- local puncher = mcl_reason and mcl_reason.direct or target
|
||||||
-- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage)
|
-- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage)
|
||||||
if luaentity.health > 0 then
|
if luaentity.health > 0 then
|
||||||
|
@ -544,7 +544,7 @@ end
|
||||||
function mcl_util.get_hp(obj)
|
function mcl_util.get_hp(obj)
|
||||||
local luaentity = obj:get_luaentity()
|
local luaentity = obj:get_luaentity()
|
||||||
|
|
||||||
if luaentity and luaentity._cmi_is_mob then
|
if luaentity and luaentity.is_mob then
|
||||||
return luaentity.health
|
return luaentity.health
|
||||||
else
|
else
|
||||||
return obj:get_hp()
|
return obj:get_hp()
|
||||||
|
|
|
@ -314,7 +314,7 @@ function boat.on_step(self, dtime, moveresult)
|
||||||
|
|
||||||
for _, obj in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if entity and entity._cmi_is_mob then
|
if entity and entity.is_mob then
|
||||||
attach_object(self, obj)
|
attach_object(self, obj)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
|
@ -78,10 +78,6 @@ local node_snowblock = "mcl_core:snowblock"
|
||||||
local node_snow = "mcl_core:snow"
|
local node_snow = "mcl_core:snow"
|
||||||
mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
|
mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
|
||||||
|
|
||||||
--Helper function to clear all mobs because /clearobjects removes too much
|
|
||||||
local function is_mob(o)
|
|
||||||
return o.type == "ambient" or o.type == "animal" or o.type == "monster" or o.type == "npc"
|
|
||||||
end
|
|
||||||
minetest.register_chatcommand("clearmobs",{
|
minetest.register_chatcommand("clearmobs",{
|
||||||
privs={maphack=true},
|
privs={maphack=true},
|
||||||
params = "<all>|<nametagged>|<range>",
|
params = "<all>|<nametagged>|<range>",
|
||||||
|
@ -90,7 +86,7 @@ minetest.register_chatcommand("clearmobs",{
|
||||||
local p = minetest.get_player_by_name(n)
|
local p = minetest.get_player_by_name(n)
|
||||||
local num=tonumber(param)
|
local num=tonumber(param)
|
||||||
for _,o in pairs(minetest.luaentities) do
|
for _,o in pairs(minetest.luaentities) do
|
||||||
if is_mob(o) then
|
if o.is_mob then
|
||||||
if param == "all" or
|
if param == "all" or
|
||||||
( param == "nametagged" and o.nametag ) or
|
( param == "nametagged" and o.nametag ) or
|
||||||
( param == "" and not o.nametag and not o.tamed ) or
|
( param == "" and not o.nametag and not o.tamed ) or
|
||||||
|
@ -223,7 +219,7 @@ local collision = function(self)
|
||||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||||
|
|
||||||
local ent = object:get_luaentity()
|
local ent = object:get_luaentity()
|
||||||
if object:is_player() or (ent and ent._cmi_is_mob and object ~= self.object) then
|
if object:is_player() or (ent and ent.is_mob and object ~= self.object) then
|
||||||
|
|
||||||
local pos2 = object:get_pos()
|
local pos2 = object:get_pos()
|
||||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||||
|
@ -3951,7 +3947,7 @@ minetest.register_entity(name, {
|
||||||
runaway_from = def.runaway_from,
|
runaway_from = def.runaway_from,
|
||||||
owner_loyal = def.owner_loyal,
|
owner_loyal = def.owner_loyal,
|
||||||
facing_fence = false,
|
facing_fence = false,
|
||||||
_cmi_is_mob = true,
|
is_mob = true,
|
||||||
pushable = def.pushable or true,
|
pushable = def.pushable or true,
|
||||||
|
|
||||||
|
|
||||||
|
@ -3999,6 +3995,7 @@ minetest.register_entity(name, {
|
||||||
--this is a temporary hack so mobs stop
|
--this is a temporary hack so mobs stop
|
||||||
--glitching and acting really weird with the
|
--glitching and acting really weird with the
|
||||||
--default built in engine collision detection
|
--default built in engine collision detection
|
||||||
|
self.is_mob = true
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
collide_with_objects = false,
|
collide_with_objects = false,
|
||||||
})
|
})
|
||||||
|
@ -4123,7 +4120,7 @@ function mobs:register_arrow(name, def)
|
||||||
|
|
||||||
if entity
|
if entity
|
||||||
and self.hit_mob
|
and self.hit_mob
|
||||||
and entity._cmi_is_mob == true
|
and entity.is_mob == true
|
||||||
and tostring(player) ~= self.owner_id
|
and tostring(player) ~= self.owner_id
|
||||||
and entity.name ~= self.object:get_luaentity().name then
|
and entity.name ~= self.object:get_luaentity().name then
|
||||||
self.hit_mob(self, player)
|
self.hit_mob(self, player)
|
||||||
|
@ -4133,7 +4130,7 @@ function mobs:register_arrow(name, def)
|
||||||
|
|
||||||
if entity
|
if entity
|
||||||
and self.hit_object
|
and self.hit_object
|
||||||
and (not entity._cmi_is_mob)
|
and (not entity.is_mob)
|
||||||
and tostring(player) ~= self.owner_id
|
and tostring(player) ~= self.owner_id
|
||||||
and entity.name ~= self.object:get_luaentity().name then
|
and entity.name ~= self.object:get_luaentity().name then
|
||||||
self.hit_object(self, player)
|
self.hit_object(self, player)
|
||||||
|
@ -4452,7 +4449,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 47)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 47)) do
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if lua and lua._cmi_is_mob then
|
if lua and lua.is_mob then
|
||||||
lua.lifetimer = math.max(20, lua.lifetimer)
|
lua.lifetimer = math.max(20, lua.lifetimer)
|
||||||
lua.despawn_immediately = false
|
lua.despawn_immediately = false
|
||||||
end
|
end
|
||||||
|
|
|
@ -195,7 +195,7 @@ local list_of_all_biomes = {
|
||||||
local function count_mobs(pos)
|
local function count_mobs(pos)
|
||||||
local num = 0
|
local num = 0
|
||||||
for _,object in pairs(get_objects_inside_radius(pos, aoc_range)) do
|
for _,object in pairs(get_objects_inside_radius(pos, aoc_range)) do
|
||||||
if object and object:get_luaentity() and object:get_luaentity()._cmi_is_mob then
|
if object and object:get_luaentity() and object:get_luaentity().is_mob then
|
||||||
num = num + 1
|
num = num + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -78,7 +78,7 @@ end
|
||||||
|
|
||||||
function mcl_bossbars.update_boss(object, name, color)
|
function mcl_bossbars.update_boss(object, name, color)
|
||||||
local props = object:get_luaentity()
|
local props = object:get_luaentity()
|
||||||
if not props or not props._cmi_is_mob then
|
if not props or not props.is_mob then
|
||||||
props = object:get_properties()
|
props = object:get_properties()
|
||||||
props.health = object:get_hp()
|
props.health = object:get_hp()
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,7 +28,7 @@ local function pp_on_timer(pos, elapsed)
|
||||||
local obj_does_activate = function(obj, activated_by)
|
local obj_does_activate = function(obj, activated_by)
|
||||||
if activated_by.any then
|
if activated_by.any then
|
||||||
return true
|
return true
|
||||||
elseif activated_by.mob and obj:get_luaentity() and obj:get_luaentity()._cmi_is_mob == true then
|
elseif activated_by.mob and obj:get_luaentity() and obj:get_luaentity().is_mob == true then
|
||||||
return true
|
return true
|
||||||
elseif activated_by.player and obj:is_player() then
|
elseif activated_by.player and obj:is_player() then
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -106,7 +106,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||||
local mobname = ent.name
|
local mobname = ent.name
|
||||||
local def = minetest.registered_entities[mobname]
|
local def = minetest.registered_entities[mobname]
|
||||||
-- Approximation of monster detection range
|
-- Approximation of monster detection range
|
||||||
if def._cmi_is_mob and ((mobname ~= "mobs_mc:pigman" and def.type == "monster" and not monster_exceptions[mobname]) or (mobname == "mobs_mc:pigman" and ent.state == "attack")) then
|
if def.is_mob and ((mobname ~= "mobs_mc:pigman" and def.type == "monster" and not monster_exceptions[mobname]) or (mobname == "mobs_mc:pigman" and ent.state == "attack")) then
|
||||||
if math.abs(bed_pos.y - obj:get_pos().y) <= 5 then
|
if math.abs(bed_pos.y - obj:get_pos().y) <= 5 then
|
||||||
return false, S("You can't sleep now, monsters are nearby!")
|
return false, S("You can't sleep now, monsters are nearby!")
|
||||||
end
|
end
|
||||||
|
|
|
@ -203,7 +203,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
ok = true
|
ok = true
|
||||||
elseif obj:get_luaentity() then
|
elseif obj:get_luaentity() then
|
||||||
if (obj:get_luaentity()._cmi_is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
if (obj:get_luaentity().is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -226,7 +226,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
local obj = closest_object
|
local obj = closest_object
|
||||||
local is_player = obj:is_player()
|
local is_player = obj:is_player()
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
|
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua.is_mob or lua._hittable_by_projectile))) then
|
||||||
if obj:get_hp() > 0 then
|
if obj:get_hp() > 0 then
|
||||||
-- Check if there is no solid node between arrow and object
|
-- Check if there is no solid node between arrow and object
|
||||||
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
||||||
|
|
|
@ -24,7 +24,7 @@ local function damage_explosion(self, damagemulitplier)
|
||||||
for _,obj in pairs(objects) do
|
for _,obj in pairs(objects) do
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
mcl_util.deal_damage(obj, damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos()), {type = "explosion"})
|
mcl_util.deal_damage(obj, damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos()), {type = "explosion"})
|
||||||
elseif obj:get_luaentity()._cmi_is_mob then
|
elseif obj:get_luaentity().is_mob then
|
||||||
obj:punch(self.object, 1.0, {
|
obj:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos())},
|
damage_groups={fleshy=damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos())},
|
||||||
|
@ -415,7 +415,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
ok = true
|
ok = true
|
||||||
elseif obj:get_luaentity() then
|
elseif obj:get_luaentity() then
|
||||||
if (obj:get_luaentity()._cmi_is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
if (obj:get_luaentity().is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -438,7 +438,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
local obj = closest_object
|
local obj = closest_object
|
||||||
local is_player = obj:is_player()
|
local is_player = obj:is_player()
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
|
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua.is_mob or lua._hittable_by_projectile))) then
|
||||||
if obj:get_hp() > 0 then
|
if obj:get_hp() > 0 then
|
||||||
-- Check if there is no solid node between arrow and object
|
-- Check if there is no solid node between arrow and object
|
||||||
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
||||||
|
|
|
@ -167,7 +167,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
if is_player then
|
if is_player then
|
||||||
player:set_hp(math.min(player:get_properties().hp_max or 20, player:get_hp() + 1), { type = "set_hp", other = "regeneration" })
|
player:set_hp(math.min(player:get_properties().hp_max or 20, player:get_hp() + 1), { type = "set_hp", other = "regeneration" })
|
||||||
EF.regenerating[player].heal_timer = 0
|
EF.regenerating[player].heal_timer = 0
|
||||||
elseif entity and entity._cmi_is_mob then
|
elseif entity and entity.is_mob then
|
||||||
entity.health = math.min(entity.hp_max, entity.health + 1)
|
entity.health = math.min(entity.hp_max, entity.health + 1)
|
||||||
EF.regenerating[player].heal_timer = 0
|
EF.regenerating[player].heal_timer = 0
|
||||||
else -- stop regenerating if not a player or mob
|
else -- stop regenerating if not a player or mob
|
||||||
|
@ -545,7 +545,7 @@ function mcl_potions.is_obj_hit(self, pos)
|
||||||
|
|
||||||
if entity and entity.name ~= self.object:get_luaentity().name then
|
if entity and entity.name ~= self.object:get_luaentity().name then
|
||||||
|
|
||||||
if entity._cmi_is_mob then
|
if entity.is_mob then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ function mcl_potions.healing_func(player, hp)
|
||||||
hp = 1
|
hp = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if obj and obj._cmi_is_mob then
|
if obj and obj.is_mob then
|
||||||
obj.health = math.max(obj.health + hp, obj.hp_max)
|
obj.health = math.max(obj.health + hp, obj.hp_max)
|
||||||
elseif player:is_player() then
|
elseif player:is_player() then
|
||||||
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })
|
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })
|
||||||
|
|
|
@ -281,7 +281,7 @@ local function water_splash(obj, damage)
|
||||||
end
|
end
|
||||||
-- Damage mobs that are vulnerable to water
|
-- Damage mobs that are vulnerable to water
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if lua and lua._cmi_is_mob then
|
if lua and lua.is_mob then
|
||||||
obj:punch(obj, 1.0, {
|
obj:punch(obj, 1.0, {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {water_vulnerable=damage},
|
damage_groups = {water_vulnerable=damage},
|
||||||
|
|
|
@ -66,7 +66,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
for _, obj in pairs(minetest.get_objects_inside_radius(pos, d)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, d)) do
|
||||||
|
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if obj:is_player() or entity._cmi_is_mob then
|
if obj:is_player() or entity.is_mob then
|
||||||
|
|
||||||
vals.def.potion_fun(obj)
|
vals.def.potion_fun(obj)
|
||||||
-- TODO: Apply timer penalty only if the potion effect was acutally applied
|
-- TODO: Apply timer penalty only if the potion effect was acutally applied
|
||||||
|
|
|
@ -110,7 +110,7 @@ function mcl_potions.register_splash(name, descr, color, def)
|
||||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
||||||
|
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if obj:is_player() or entity._cmi_is_mob then
|
if obj:is_player() or entity.is_mob then
|
||||||
|
|
||||||
local pos2 = obj:get_pos()
|
local pos2 = obj:get_pos()
|
||||||
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
|
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
|
||||||
|
|
|
@ -216,7 +216,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
||||||
if obj ~= self._shooter and obj:is_player() then
|
if obj ~= self._shooter and obj:is_player() then
|
||||||
ok = true
|
ok = true
|
||||||
elseif obj:get_luaentity() then
|
elseif obj:get_luaentity() then
|
||||||
if obj ~= self._shooter and obj:get_luaentity()._cmi_is_mob then
|
if obj ~= self._shooter and obj:get_luaentity().is_mob then
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -238,7 +238,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
||||||
local obj = closest_object
|
local obj = closest_object
|
||||||
local is_player = obj:is_player()
|
local is_player = obj:is_player()
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if obj ~= self._shooter and (is_player or (lua and lua._cmi_is_mob)) then
|
if obj ~= self._shooter and (is_player or (lua and lua.is_mob)) then
|
||||||
|
|
||||||
if obj:get_hp() > 0 then
|
if obj:get_hp() > 0 then
|
||||||
-- Check if there is no solid node between arrow and object
|
-- Check if there is no solid node between arrow and object
|
||||||
|
|
|
@ -64,7 +64,7 @@ local function check_object_hit(self, pos, dmg)
|
||||||
-- TODO: Deal knockback
|
-- TODO: Deal knockback
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return true
|
return true
|
||||||
elseif (entity._cmi_is_mob == true or entity._hittable_by_projectile) and (self._thrower ~= object) then
|
elseif (entity.is_mob == true or entity._hittable_by_projectile) and (self._thrower ~= object) then
|
||||||
-- FIXME: Knockback is broken
|
-- FIXME: Knockback is broken
|
||||||
object:punch(self.object, 1.0, {
|
object:punch(self.object, 1.0, {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
|
|
|
@ -4,7 +4,7 @@ local orig_func = minetest.registered_chatcommands["spawnentity"].func
|
||||||
local cmd = table.copy(minetest.registered_chatcommands["spawnentity"])
|
local cmd = table.copy(minetest.registered_chatcommands["spawnentity"])
|
||||||
cmd.func = function(name, param)
|
cmd.func = function(name, param)
|
||||||
local ent = minetest.registered_entities[param]
|
local ent = minetest.registered_entities[param]
|
||||||
if minetest.settings:get_bool("only_peaceful_mobs", false) and ent and ent._cmi_is_mob and ent.type == "monster" then
|
if minetest.settings:get_bool("only_peaceful_mobs", false) and ent and ent.is_mob and ent.type == "monster" then
|
||||||
return false, S("Only peaceful mobs allowed!")
|
return false, S("Only peaceful mobs allowed!")
|
||||||
else
|
else
|
||||||
local bool, msg = orig_func(name, param)
|
local bool, msg = orig_func(name, param)
|
||||||
|
|
|
@ -36,7 +36,7 @@ local function player_collision(player)
|
||||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||||
|
|
||||||
local ent = object:get_luaentity()
|
local ent = object:get_luaentity()
|
||||||
if (object:is_player() or (ent and ent._cmi_is_mob and object ~= player)) then
|
if (object:is_player() or (ent and ent.is_mob and object ~= player)) then
|
||||||
|
|
||||||
local pos2 = object:get_pos()
|
local pos2 = object:get_pos()
|
||||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||||
|
|
Loading…
Reference in a new issue