ac037a74b0 | ||
---|---|---|
README.md | ||
chest_functions.lua | ||
handle_access.lua | ||
init.lua | ||
mod.conf | ||
reward_inv.lua | ||
save_restore.lua | ||
show_reward_fs.lua | ||
show_reward_list_fs.lua | ||
treasure_chest.lua | ||
update_inv.lua | ||
yl_speak_up_integration.lua |
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:
- Obtain
reward_inv:treasure_chest
via /giveme or creative inventory. - Place the chest.
- Set a
reward_id
. Usually the position of the chest will be fine. - Click on "Create".
- Fill the inventory and add a hint for the players how to find this chest.
- 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