Browse Source

Bugfix

master
Yves Quemener 3 weeks ago
parent
commit
6d7cdd9e0c
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      README.md
  2. 1
    1
      init.lua

+ 1
- 1
README.md 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.


+ 1
- 1
init.lua 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)

Loading…
Cancel
Save