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

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/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 for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
if object:is_player() local ent = object:get_luaentity()
or (object:get_luaentity()._cmi_is_mob == true and object ~= self.object) then if object:is_player() or (ent and ent._cmi_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}

View file

@ -35,8 +35,8 @@ 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
if object and (object:is_player() local ent = object:get_luaentity()
or (object:get_luaentity()._cmi_is_mob == true and object ~= player)) then if (object:is_player() or (ent and ent._cmi_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}