[Mod] Treasure Chest [1.1] [treasurechest]

User avatar
thefamilygrog66
Member
 
Posts: 169
Joined: Mon Jul 09, 2012 19:08

[Mod] Treasure Chest [1.1] [treasurechest]

by thefamilygrog66 » Tue Dec 08, 2015 17:30

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/treasurechest/archive/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: 627
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Treasure Chest

by kaadmy » Tue Dec 08, 2015 19:21

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

User avatar
thefamilygrog66
Member
 
Posts: 169
Joined: Mon Jul 09, 2012 19:08

Re: Treasure Chest

by thefamilygrog66 » Tue Dec 08, 2015 20:03

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
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Treasure Chest

by kaeza » Wed Dec 09, 2015 13:11

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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
thefamilygrog66
Member
 
Posts: 169
Joined: Mon Jul 09, 2012 19:08

Re: Treasure Chest

by thefamilygrog66 » Wed Dec 09, 2015 16:51

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 » Wed Dec 09, 2015 17:12

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

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

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

by sofar » Wed Dec 09, 2015 17:17

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: 169
Joined: Mon Jul 09, 2012 19:08

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

by thefamilygrog66 » Wed Dec 09, 2015 17:20

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


Thanks, and thank you for the idea.
 

User avatar
thefamilygrog66
Member
 
Posts: 169
Joined: Mon Jul 09, 2012 19:08

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

by thefamilygrog66 » Wed Dec 09, 2015 17:26

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
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

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

by sofar » Wed Dec 09, 2015 18:18

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: 169
Joined: Mon Jul 09, 2012 19:08

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

by thefamilygrog66 » Sat Jan 09, 2016 18:37

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 » Tue May 17, 2016 03:17

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

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

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

by Sokomine » Sun Aug 21, 2016 00:29

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: 169
Joined: Mon Jul 09, 2012 19:08

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

by thefamilygrog66 » Fri Aug 26, 2016 19:42

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 » Tue Oct 04, 2016 19:26

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


Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 41 guests

cron