[Mod] Treasure Chest [1.1] [treasurechest]

Post Reply
User avatar
thefamilygrog66
Member
Posts: 170
Joined: Mon Jul 09, 2012 19:08
Location: Ontario, Canada

[Mod] Treasure Chest [1.1] [treasurechest]

by thefamilygrog66 » Post

Treasure Chest (treasurechest) Mod

by thefamilygrog66

Description:

Adds treasure chests that a server admin can place, and fill with whatever treasures they choose. After the admin adds treasure to the chest, each player who finds it will be able to remove the same items that were originally added by the admin.

Cheers to bark for the idea/concept.

Update January 9 2016: I've rewritten the code so that now the admin simply fills the chest after placing it (i.e. no punching required to save its contents). Then, each player who finds it can examine its contents as many times as they want, removing what they like. The chest creates an inventory for each player, so that it remembers what has been taken by whom.

Mod Dependencies: default

License:

Sourcecode: WTFPL
Model: CC0 1.0, Paul Wortmann
Texture: WTFPL

Download: https://github.com/thefamilygrog66/trea ... master.zip

Browse code on github: https://github.com/thefamilygrog66/treasurechest

Screenshot:

Image
Last edited by thefamilygrog66 on Sat Jan 09, 2016 18:38, edited 4 times in total.

User avatar
kaadmy
Member
Posts: 706
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Treasure Chest

by kaadmy » Post

Uh, what does this mod do?
Never paint white stripes on roads near Zebra crossings.

Pixture

User avatar
thefamilygrog66
Member
Posts: 170
Joined: Mon Jul 09, 2012 19:08
Location: Ontario, Canada

Re: Treasure Chest

by thefamilygrog66 » Post

kaadmy wrote:Uh, what does this mod do?
Description and code to come, but I've basically done what bark was asking for here:
bark wrote:I want to make/see created a mod that adds a "treasure-chest" that can only be emptied once per player.

When placed, the chest must be configured with which items it is to contain. Once configured, the chest can be opened and emptied by any player, but only once per player.

Can someone can point me in a direction as to how I can achieve this?

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Treasure Chest

by kaeza » Post

code pls
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
thefamilygrog66
Member
Posts: 170
Joined: Mon Jul 09, 2012 19:08
Location: Ontario, Canada

Re: Treasure Chest

by thefamilygrog66 » Post

kaeza wrote:code pls
I've just added a link to it, Kaeza - check it out!

bark
Member
Posts: 35
Joined: Thu Sep 24, 2015 13:25
In-game: bark

Re: [Mod] Treasure Chest [1.0] [treasurechest]

by bark » Post

Great work on this, familygrog! The mod works very well!

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod] Treasure Chest [1.0] [treasurechest]

by sofar » Post

I'm wondering why you limit each person from only ever looking once, which I don't think is really needed. You could create a detached inventory for each player (attached to the node), put the items in those inventories, and repeatedly give each user his copy of the detached inventory. This would allow each user to look and come back later to pick up stuff they could not carry. If you prevent putting stuff into the chest, you don't have to worry about people abusing it as a free chest either.

This code wouldn't be too difficult either: create an owner "master" detached inventory, and copy that to each players' detached inventory on demand. (sorry, didn't look at your code yet)

User avatar
thefamilygrog66
Member
Posts: 170
Joined: Mon Jul 09, 2012 19:08
Location: Ontario, Canada

Re: [Mod] Treasure Chest [1.0] [treasurechest]

by thefamilygrog66 » Post

bark wrote:Great work on this, familygrog! The mod works very well!
Thanks, and thank you for the idea.

User avatar
thefamilygrog66
Member
Posts: 170
Joined: Mon Jul 09, 2012 19:08
Location: Ontario, Canada

Re: [Mod] Treasure Chest [1.0] [treasurechest]

by thefamilygrog66 » Post

sofar wrote:I'm wondering why you limit each person from only ever looking once, which I don't think is really needed. You could create a detached inventory for each player (attached to the node), put the items in those inventories, and repeatedly give each user his copy of the detached inventory. This would allow each user to look and come back later to pick up stuff they could not carry. If you prevent putting stuff into the chest, you don't have to worry about people abusing it as a free chest either.

This code wouldn't be too difficult either: create an owner "master" detached inventory, and copy that to each players' detached inventory on demand. (sorry, didn't look at your code yet)
I wrote it that way because that's what bark had requested, and I was able to simply use the inventory array within the node's metadata (hint: I just doubled its capacity, but restricted the formspec to the first half). Your idea also makes sense, and I might look at making another version that behaves that way.

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod] Treasure Chest [1.0] [treasurechest]

by sofar » Post

thefamilygrog66 wrote: I wrote it that way because that's what bark had requested, and I was able to simply use the inventory array within the node's metadata (hint: I just doubled its capacity, but restricted the formspec to the first half). Your idea also makes sense, and I might look at making another version that behaves that way.
Sure - what I'd do is make a minetest setting to determine the size and whether the inventory is one-time access only, leaving the option to the Server admin. That way people could make treasure chests with a single itemstack if they wish.

Additionally, perhaps people would like this idea as well: Restrict the *number* of items a player can withdraw, so that treasure chests become interesting collectible items: e.g. once players find a first chest with 4 items, but they're only allowed to take 1, perhaps they're more likely to go find the 3 other chests to complete a set.

Don't make twenty five versions of the same mod if you can avoid it, though. It helps to keep more people interested in the same code, you'll get better mods that way.

User avatar
thefamilygrog66
Member
Posts: 170
Joined: Mon Jul 09, 2012 19:08
Location: Ontario, Canada

Re: [Mod] Treasure Chest [1.0] [treasurechest]

by thefamilygrog66 » Post

sofar wrote:I'm wondering why you limit each person from only ever looking once, which I don't think is really needed. You could create a detached inventory for each player (attached to the node), put the items in those inventories, and repeatedly give each user his copy of the detached inventory. This would allow each user to look and come back later to pick up stuff they could not carry. If you prevent putting stuff into the chest, you don't have to worry about people abusing it as a free chest either.

This code wouldn't be too difficult either: create an owner "master" detached inventory, and copy that to each players' detached inventory on demand. (sorry, didn't look at your code yet)
Since this is the behaviour that Bark had originally requested anyway -- I misunderstood exactly what was requested -- I've rewritten the code so that now the admin simply fills the chest after placing it (i.e. no punching required to save its contents). Then, each player who finds it can examine its contents as many times as they want, removing what they like. The chest creates an inventory for each player, so that it remembers what has been taken by whom.

User avatar
rpgsniper2452
New member
Posts: 8
Joined: Mon May 16, 2016 15:04
GitHub: rpgsniper2452
IRC: rpgsniper2452
In-game: rpgsniper2452

Re: [Mod] Treasure Chest [1.1] [treasurechest]

by rpgsniper2452 » Post

Now I can hide my diamonds and mese better! lol
good mod too!

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Treasure Chest [1.1] [treasurechest]

by Sokomine » Post

This mod is used on barks Barkhouse server. It works very well there. Treasure chests are hidden throughout the world and motivate players to explore, to climb, jump and otherwise reach all these positions where chests are stored.

The only problem is that there's no way to check for each player how many of the chests he/she has found already. It would be great to at least know how many (compared to those installed in total) each player has found. Assigning numbers or even descriptions to the chests might also be helpful in order to identify what has been missed. A global statistic could be entertaining :-)

Right now the mod is not aware of which chest sits where and which chests exist. Such information could be gathered whenever a chest is accessed and it's not yet known.

Could you include such a feature? :-)
A list of my mods can be found here.

User avatar
thefamilygrog66
Member
Posts: 170
Joined: Mon Jul 09, 2012 19:08
Location: Ontario, Canada

Re: [Mod] Treasure Chest [1.1] [treasurechest]

by thefamilygrog66 » Post

Hey, that's a cool idea Sokomine. I'll see what I can do...

User avatar
ParaklataChotou
Member
Posts: 209
Joined: Sat Jun 18, 2016 17:09
GitHub: paraklatachotou
IRC: CareBearWhoCares
In-game: AutistCortana

Re: [Mod] Treasure Chest [1.1] [treasurechest]

by ParaklataChotou » Post

Thank you for this mod. I'll try on my server.
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.

User avatar
scottwolff
Member
Posts: 129
Joined: Sat Apr 30, 2016 06:15
In-game: scottwolff or some variant of iasiney
Location: Central Illinois

Re: [Mod] Treasure Chest [1.1] [treasurechest]

by scottwolff » Post

First mod that got offered to me by one of my moderators to use. Used it, liked it very much. Still use it currently. Good for one shots. Doesn't please everyone but everyone is sometimes lazy and don't want to go break a node here or there and make the items in the treasurechest theirselves XD

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests