1
0
Fork 0

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
1 changed files with 6 additions and 5 deletions

View File

@ -649,6 +649,12 @@ minetest.register_entity(":__builtin:item", {
local node = minetest.get_node_or_nil(p) local node = minetest.get_node_or_nil(p)
local in_unloaded = (node == nil) 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 if self.is_clock then
self.object:set_properties({ self.object:set_properties({
textures = {"mcl_clock:clock_" .. (mcl_worlds.clock_works(p) and mcl_clock.old_time or mcl_clock.random_frame)} 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) enable_physics(self.object, self)
return return
end 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 -- Destroy item in lava, fire or special nodes