summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2014-08-16 11:16:23 +0200
committerNovatux <nathanael.courant@laposte.net>2014-08-16 11:16:23 +0200
commit17cae3a6508408e913ff05fc44e0e2c3172572b6 (patch)
tree973d3dfbe186a28d654361fb058fa30de1aa5dd8
parentf8a8046a7b266cdd93a9281ebb4df8705f598f50 (diff)
downloadpipeworks-17cae3a6508408e913ff05fc44e0e2c3172572b6.tar
pipeworks-17cae3a6508408e913ff05fc44e0e2c3172572b6.tar.gz
pipeworks-17cae3a6508408e913ff05fc44e0e2c3172572b6.tar.bz2
pipeworks-17cae3a6508408e913ff05fc44e0e2c3172572b6.tar.xz
pipeworks-17cae3a6508408e913ff05fc44e0e2c3172572b6.zip
Fix possible race condition crash
-rwxr-xr-xluaentity.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/luaentity.lua b/luaentity.lua
index a4ef4a0..fe81cb3 100755
--- a/luaentity.lua
+++ b/luaentity.lua
@@ -42,11 +42,7 @@ local function write_entities()
write_file(luaentity.entities)
end
-minetest.after(0, function()
- luaentity.entities = read_entities()
-end)
minetest.register_on_shutdown(write_entities)
- -- todo: load that from file (datastorage?) -> don't forget about metatables (are those serialized?) / do not blindly save -> the attached_entities have to be removed
luaentity.entities_index = 0
local function get_blockpos(pos)
@@ -310,6 +306,9 @@ function luaentity.get_objects_inside_radius(pos, radius)
end
minetest.register_globalstep(function(dtime)
+ if not luaentity.entities then
+ luaentity.entities = read_entities()
+ end
for id, entity in pairs(luaentity.entities) do
local master = entity._attached_entities_master
if master then