Spawner: Fix issue when "npcs" table is not present in restore_plotmarkers.
This commit is contained in:
parent
fe5a155177
commit
8e5d6d03f4
@ -517,9 +517,9 @@ function npc.spawner.assign_places(self, entrance, node_data, pos)
|
||||
npc.occupations.registered_occupations[self.occupation_name].allow_multiple_npcs_at_workplace
|
||||
}
|
||||
meta:set_string("work_data", minetest.serialize(work_data))
|
||||
--
|
||||
-- meta = minetest.get_meta(node_data.workplace_type[i].node_pos)
|
||||
-- minetest.log("Work data: "..dump(minetest.deserialize(meta:get_string("work_data"))))
|
||||
--
|
||||
-- meta = minetest.get_meta(node_data.workplace_type[i].node_pos)
|
||||
-- minetest.log("Work data: "..dump(minetest.deserialize(meta:get_string("work_data"))))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -900,6 +900,7 @@ minetest.register_chatcommand("restore_plotmarkers", {
|
||||
local infotext = meta:get_string("infotext")
|
||||
local npcs = minetest.deserialize(meta:get_string("npcs"))
|
||||
-- Restore workplaces to original status
|
||||
if npcs then
|
||||
for i = 1, #npcs do
|
||||
if npcs[i].workplace then
|
||||
-- Remove work data
|
||||
@ -907,6 +908,7 @@ minetest.register_chatcommand("restore_plotmarkers", {
|
||||
workplace_meta:set_string("work_data", nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Set metadata
|
||||
meta = minetest.get_meta(nodes[i])
|
||||
meta:set_string("village_id", village_id)
|
||||
|
Loading…
Reference in New Issue
Block a user