Bugfix
This commit is contained in:
parent
c4cf33b2a9
commit
6d7cdd9e0c
|
@ -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.
|
||||
|
||||
|
|
2
init.lua
2
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)
|
||||
|
|
Loading…
Reference in New Issue