1
0
Fork 0

Merge pull request 'Fix undefined luaentity crash.' (#2084) from fix-unregistered-collisions into master

Reviewed-on: MineClone2/MineClone2#2084
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-03-21 10:31:20 +00:00
commit bc723616ea
2 changed files with 4 additions and 4 deletions

View File

@ -222,8 +222,8 @@ local collision = function(self)
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
if object:is_player()
or (object:get_luaentity()._cmi_is_mob == true and object ~= self.object) then
local ent = object:get_luaentity()
if object:is_player() or (ent and ent._cmi_is_mob and object ~= self.object) then
local pos2 = object:get_pos()
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}

View File

@ -35,8 +35,8 @@ local function player_collision(player)
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
if object and (object:is_player()
or (object:get_luaentity()._cmi_is_mob == true and object ~= player)) then
local ent = object:get_luaentity()
if (object:is_player() or (ent and ent._cmi_is_mob and object ~= player)) then
local pos2 = object:get_pos()
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}