Spawner: Fix issue when "npcs" table is not present in restore_plotmarkers.
This commit is contained in:
parent
fe5a155177
commit
8e5d6d03f4
@ -900,6 +900,7 @@ minetest.register_chatcommand("restore_plotmarkers", {
|
|||||||
local infotext = meta:get_string("infotext")
|
local infotext = meta:get_string("infotext")
|
||||||
local npcs = minetest.deserialize(meta:get_string("npcs"))
|
local npcs = minetest.deserialize(meta:get_string("npcs"))
|
||||||
-- Restore workplaces to original status
|
-- Restore workplaces to original status
|
||||||
|
if npcs then
|
||||||
for i = 1, #npcs do
|
for i = 1, #npcs do
|
||||||
if npcs[i].workplace then
|
if npcs[i].workplace then
|
||||||
-- Remove work data
|
-- Remove work data
|
||||||
@ -907,6 +908,7 @@ minetest.register_chatcommand("restore_plotmarkers", {
|
|||||||
workplace_meta:set_string("work_data", nil)
|
workplace_meta:set_string("work_data", nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- Set metadata
|
-- Set metadata
|
||||||
meta = minetest.get_meta(nodes[i])
|
meta = minetest.get_meta(nodes[i])
|
||||||
meta:set_string("village_id", village_id)
|
meta:set_string("village_id", village_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user