master
Yves Quemener 2019-08-24 15:24:06 +09:00
parent c4cf33b2a9
commit 6d7cdd9e0c
2 changed files with 2 additions and 2 deletions

View File

@ -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.

View File

@ -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)