fix crash when items in unloaded chunk

This commit is contained in:
Sumyjkl 2022-07-28 11:10:56 +10:00
parent 3abeed3025
commit 86d6445f42

View file

@ -649,6 +649,12 @@ minetest.register_entity(":__builtin:item", {
local node = minetest.get_node_or_nil(p)
local in_unloaded = (node == nil)
if in_unloaded then
-- Don't infinetly fall into unloaded map
disable_physics(self.object, self)
return
end
if self.is_clock then
self.object:set_properties({
textures = {"mcl_clock:clock_" .. (mcl_worlds.clock_works(p) and mcl_clock.old_time or mcl_clock.random_frame)}
@ -680,11 +686,6 @@ minetest.register_entity(":__builtin:item", {
enable_physics(self.object, self)
return
end
if in_unloaded then
-- Don't infinetly fall into unloaded map
disable_physics(self.object, self)
return
end
-- Destroy item in lava, fire or special nodes