Hand out rewards and place treasure chests. Each reward inventory can contain multiple items. Each player gets one set. It's possible to let the reward inv refill automaticly after a certain time.
Go to file
Sokomine ac037a74b0 started integration into yl_speak_up 2023-12-28 17:46:56 +01:00
README.md added README.md 2023-12-28 08:33:23 +01:00
chest_functions.lua first input handling 2023-12-26 17:06:08 +01:00
handle_access.lua started integration into yl_speak_up 2023-12-28 17:46:56 +01:00
init.lua started integration into yl_speak_up 2023-12-28 17:46:56 +01:00
mod.conf started integration into yl_speak_up 2023-12-28 17:46:56 +01:00
reward_inv.lua log when someone inserted or took items 2023-12-28 15:33:30 +01:00
save_restore.lua moved save_restore into extra file 2023-12-28 07:56:59 +01:00
show_reward_fs.lua loging for editing reward invs added 2023-12-28 16:20:03 +01:00
show_reward_list_fs.lua set show_hidden for reward list according to privs of player 2023-12-28 16:44:05 +01:00
treasure_chest.lua made chest functions reloadable 2023-12-24 21:59:45 +01:00
update_inv.lua fixed update_inv 2023-12-28 06:57:03 +01:00
yl_speak_up_integration.lua started integration into yl_speak_up 2023-12-28 17:46:56 +01:00

README.md

Autor: Sokomine License: GPLv3

This mod adds a reward inventory. This is useful for treasure chests or handing out rewards for quests.

Each reward inventory can handle out multiple itemstacks.

Usually rewards are given to each player only once (unless you allow it to refill after x seconds).

The player can come back any time later and take what he didn't have room for in the first place.

Usage:

  1. Obtain reward_inv:treasure_chest via /giveme or creative inventory.
  2. Place the chest.
  3. Set a reward_id. Usually the position of the chest will be fine.
  4. Click on "Create".
  5. Fill the inventory and add a hint for the players how to find this chest.
  6. Click on save. Done!

Why is a reward_id used?

  • NPC can use that easier
  • treasure chests can be moved to other places (if you have to make room for something else)
  • one treasure can be shared by alternate places

For NPC or in general, call reward_inv.grant_access(pname, reward_id) to grant player pname access to reward reward_id. This needs to be done first. And after that, call reward_inv.show_reward_fs(player, reward_id) to show the actual formspec.

Quest items with metadata yl_speak_up:quest_item_for set to the player's name will be updated to the name of the player who gets the reward, and reward_inv:reward_id will be set to reward_id in addition.

Players with the give priv can create new reward inventories and assign them to chests and NPC.

Be careful when editing reward inventories where rewards have already been handed out! It is possible but not recommended. Do this only if there is need (i.e. items becomming unknown items or renamed).

Original goals of this mod:

  • ability to hand out multiple diffrent stacks per reward/treasure...place (8x4, chest-like inventory, though most slots will be empty most of the time)
  • each player gets the rewards usually only once
  • automatic refill after some time of last taking could be an option
  • the player can take rewards from diffrent slots at diffrent times. That's important when the player doesn't have enough room in his inventory.
  • the player cannot put anything in the treasure chest and not move items around inside - just take part or all of it
  • NPC ought to be able to use the mechanism as well (as in: provide rewards/treasures this way - give them, not take treasures)
  • a way to keep track of which chests a player found. Can be done by having a list with a description of the area the chest is in - i.e. area name/description + area id, or which quest has it as reward
  • show how many players have found those chests in the list above
  • option for a chest/npc not to be listed in the list above (if it's i.e. a temporal event)
  • ID could be location of the chest as string or npc ID + time or set freely by the creator
  • once a treasure inventory has been created, it cannot be changed (because what gets stored is how many items the player took from each stack when - not what he took) -> given up on that as there is too often need for change (items becomming unavailable or renamed)
  • new treasure inventories can be created and be used by existing places; meaning: when a treasure is changed, all who accessed it in the past already can get the things from the new treasure again
  • if necessary, diffrent places can share the same treasure inventory
  • halfway efficient storage of data
  • keep in mind that very few players actually do quests and explore
  • a treasure chest right at spawn may be bad - that one would really attract many players and require storing a lot of data
  • store when a player first accessed a treasure inventory; the good old minetest.serialize/deserialize is not elegant but may be sufficient for the task