diff --git a/README.md b/README.md index a360f92..56e6e69 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Chest whose content can only be taken from and that offers the same content to each player once. I wrote this because I made treasure hunting game. I wanted players to receive each a reward for finding the chest, not have a first-arrived-takes-all. +Chest whose content can only be taken from and that offers the same content to each player once. I wrote this because I made a treasure hunting game. I wanted each player to receive a reward once for finding the chest, not have a first-arrived-takes-all. Players are only able to take from it, not put things in, a bit similar to the way bones work. diff --git a/init.lua b/init.lua index babac9d..c798e07 100644 --- a/init.lua +++ b/init.lua @@ -36,7 +36,7 @@ minetest.register_node("quest_chest:chest", { local meta = minetest.get_meta(pos) local chestid = quest_chests_storage:get_int("next_id") meta:set_string("chestid", chestid) - local ids = minetest.deserialize(quest_chests_storage:get_string("ids")) + local ids = minetest.deserialize(quest_chests_storage:get_string("ids") or "{}") table.insert(ids, chestid) quest_chests_storage:set_string("ids", minetest.serialize(ids)) quest_chests_storage:set_int("next_id", chestid+1)