[Mod] Treasurer [0.2.0] [treasurer]

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

[Mod] Treasurer [0.2.0] [treasurer]

by Wuzzy » Post

WARNING: This mod is abandoned.

Treasurer

This is a framework to define and distribute random treasures into the world. Treasurer itself does neither define any items nor does it attempt to distribute them because it is a framework.

Player information
To actually get a game with treasures using Treasurer running, you need a couple of mods:
  • Treasurer
  • At least one TRM (treasure registration mod). This is a mod which tells Treasurer which treasures exist
  • At least one TSM (treasure spawning mod). This is a mod which puts random treasures into the world
Minimal usage example
Spoiler
In this minimal example, Minetest Game is used with 3 mods enabled:
This will add treasures from Minetest Game into chests in dungeons.
Add more TRMs to get treasures from other mods as well.
Add more TSMs to find treasures in other places.
Add as many TRMs and TSMs you like.
List of TRMs: All TRMs by me are WTFPL’ed.

List of TSMs:
  • Dungeon Treasure Chests [tsm_chests_dungeon]: Adds treasure chests into the default dungeons
  • Railway corridors [tsm_railcorridors]: Creates an underground network of mines, with treasure chests and simple railways
  • Mines [tsm_mines]: Creates very simple underground mine shafts
  • Pyramids [tsm_pyramids]: Creates pyramids in deserts with hidden treasures
  • Surprise blocks [tsm_surprise]: Creates randomly floating question mark blocks which drop cheap treasures when broken
  • tsm_geomoria [tsm_geomoria]: Extension of Geomoria, adds treasures in those strange underground structures
Developer information
Spoiler
The two main interfaces in Treasurer are treasure registration mods (TRMs) and treasure spawning mod (TSM) as explained above.

A treasure is basically just a fancy ItemStack. It consists of:
  • name of item
  • relative rarity
  • a preciousness
  • the amount of item (can be randomized)
  • a wear (can be randomized)
A TRM does nothing more than telling Treasurer a bunch of treasures it has to offer. Note, however, that a TRM should really do nothing more than just that. The actual mods where the items originate from does most likely NOT have to be changed in order to register its items as treasures.

A TSM distributes (“spawns”) treasures, where it has to ask Treasurer for some treasures. Treasurer then chooses some treasures out of the pool of available treasures and returns a list of ItemStacks. The TSM also may ask Treasurer to filter out treasures which have an either too high or too low preciousness (“preciousness” is defined by the TRMs). Be warned: Treasurer may return no treasures at all, either because no TRM is activated or no treasure that matches the filter exists.
“Spawning” here means to put the treasures into the world somehow. How a TSM does the task of spawning is up to the TSM.

Recap: The TSMs will spawn treasures into the world out of a pool of treasures which is offered by TRMs. Treasurer manages the pool.

Examples for TRMs are:
  • registering bronze, gold, iron ingots and possibly other items of default (see trm_default_example)
  • registering bread, wheat, seeds, etc. of farming
  • registering super cool item X from awesome mod Y, where X could normally only obtained by “/give” or with creative mode.
  • registering the … bla bla bla, you get the idea
Examples for TSMs are:
  • let a mob drop a not mob-specific, random treasure on death
  • give a random treasure as a “welcome gift” to joining and respawning players (see tsm_gift_example)
  • placing chests around the world and spawning treasures into them (see tsm_chests_example)
Some of the above example have been implemented into already working mods, which I distribute as seperate mods along in the same Zip file.

The Zip file contains:
  • Treasurer (which is heavily commented)
  • three examples (which are heavily commented)
  • a long README file (which hopefully covers everything you need)
Included example TSMs:
  • tsm_give_example: A simple example, bundled with Treasurer. Gives new player some random treasures at start.
  • tsm_chests_example: An example, bundled with Treasurer. Spawns some chests below the sea level and fills them with treasures. The deeper you are, the more valuable the treasures therein.
Here’s the Zip file:
https://forum.minetest.net/download/file.php?id=1302
Download and stuff
  • Download: download/file.php?id=1302
  • Hard dependencies: none
  • Works in Minetest 0.4.16 or later
  • Strongly recommended mods: At least one TRM and one TSM (see above)
  • License of everything: WTFPL

WARNING: This mod is abandoned.
Last edited by Wuzzy on Tue Nov 29, 2022 20:14, edited 20 times in total.

clarksallador
Member
Posts: 57
Joined: Sun Sep 30, 2012 03:18
Location: Philippines

by clarksallador » Post

Testing soon ;)

User avatar
RealBadAngel
Member
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Post

Can i smell Diablo like treasure system here?? ;)

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

by Wuzzy » Post

No, it smells more like coincidence here.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

I smell pizza.

User avatar
rubenwardy
Moderator
Posts: 6969
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

Lol, Adam, lol.

This looks interesting. Why don't you provide any treasures by default!
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
RealBadAngel
Member
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Post

Heavenly Diamond Pickaxe of the Stars...


Coincidence? :)

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

by Wuzzy » Post

rubenwardy wrote:Why don't you provide any treasures by default!
I don’t really understand your complaint, because I include one working example TRM which includes some treasures from default.

I also think the “examples” tsm_chests_example and trm_default_example are aleady kind of advanced for examples. A bit more game balance tweaking to these and I can call these actual mods.

Did you try the examples yet?

Oh, by the way: If a new (serious) TSM or TRM gets released that depends also on mod X, what do you think? Should it be posted to this thread? Should it get it’s own thread? Or should it be posted to the thread of mod X? And what about mods with multiple dependencies (minus Treasurer)?

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

by Wuzzy » Post

Hi! I have written a bunch of TRMs for many mods now to test Treasurer more throughly, also because the default treasures become boring with the time. ;-)
If you activate one of those mods, new treasures become available.

Download: TRM pack 0.1 (size: 9.2 KiB)
Alternative download: It is also in attachment #1.

Mods included (their provided treasures are written in parenthesis):
  • bees (honey comb, honey bottle)
  • blox (glow dust)
  • boats (boat)
  • carts (minecart, power rail, brake rail)
  • desert_uses (desert tools)
  • farming_plus (seeds, saplings, fruit, weed)
  • flowers_plus (flower pot)
  • food (several food items and unprocessed (!) food)
  • glooptest (for now, only the hammer and the handsaw, of course it only works if you have the tools module activated in Glooptest)
  • zmobs and lavatemple (lava orb, lava dagger)
  • magicbeans (the 3 beans)
  • tnt (TNT and gunpowder)
The naming convention is simply “trm_<basename>”.
The dependencies of each TRM are Treasurer and the respective mod from which they take the treasures from. For example, trm_bees depends on Bees and Treasurer.

If you have an idea for a mod to add, either write it on your own or ask me to do it. Writing a TRM is not difficult (Balancing one is! lol). In theory, any mod which has some useful (or useless!) items is a good candidate for a TRM.
I am not sure if it is a good idea to drop so many TRMs into one Zip file. On the other hand, TRMs are naturally very small in file size. The entire TRM pack has a size of 9.2 KiB.

License of the entire pack: WTFPL

PS: It is not forbidden to release TRMs on your own. ;-)
Attachments
trm_pack_0.1.zip
(9.17 KiB) Downloaded 345 times
Last edited by Wuzzy on Wed Oct 23, 2013 05:35, edited 1 time in total.

like2omg
Member
Posts: 37
Joined: Sat Nov 30, 2013 20:12

by like2omg » Post

I have yet to take a dive into making mods yet (haven't played Minetest enough anyways O_o ) but if it is possible to spawn items with "data" attached in Minetest (Minecraft map makers would call this data "NBT tags"), maybe we could have it so a specially formatted spawn line argument(s) could give set or ranged (chosen randomly) argument values.

As I have said, I have yet to take a dive into making mods, so I don't know if this is possible as of yet in Minetest. Oh and by the way, I like this idea... next up is equipment for mobs (once we can see what mobs hold/wear first)

[EDIT] Oops... am I reviving an old thread?
Last edited by like2omg on Sat Nov 30, 2013 20:27, edited 1 time in total.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

by Wuzzy » Post

I have no idea what you are talking about.
And no, this thread never goes old. ^_°

like2omg
Member
Posts: 37
Joined: Sat Nov 30, 2013 20:12

by like2omg » Post

spawn items with "data" attached
Items with specific, TRM-chosen named properties of the item already set (ex: durability)

specially formatted spawn line argument(s) could give set or ranged (chosen randomly) argument values
Adding one or two optional arguments to the TRM "add an item" line; have specifc, TRM-chosen named property of the item set to a specific value, or chosen randomly in the range of n1 to n2.
Possibly the argument could be (with property names replacing the named indexes):

Code: Select all

{
    "specificItemProperty": 2,
    "rangedItemProperty": { 5, 8 },
    "specifcCouldAlsoUseNonNumbers": <imagine an item list here>
    ... and on and on ...
}
next up is equiptment for mobs
I was mostly joking here (it's a "very far down the road" idea). When mobs can hold weapons and have equipped armor (and we can see them having it), having a modification for mobs to randomly get gear choices (probably this would be a part of the mob mod)

- insert non-signature divider -

I did come up with an idea (while doing the first compose and before I accidentally hit the keyboard's built-in back button) that we could possibly specify multiple "categories" that an item belongs to with TRM and ask for those "categories" to be in the selection when getting items with a TSM. I currently would say, have the TRM and TSM choose their names (instead of restrict them)
Examples:
- If a TSM wants any ol' block or a weapon {"block", "weapon"} or just anything --> nil
- Have a TRM specify that an item is in multiple categories {"tool", "pickaxe"} or have it not specify a category --> nil or {}

Then when it comes time to deside:
1. TSM descides a "block" or a "weapon"
2. Treasurer searches for those types in its database which were specified by the TRMs
3. Treasurer then does its normal limiting/choosing and sends the result

These are just some ideas I had. I hope you enjoy the ideas, even if you consider them to be too "high-tier" for your mod. *wink*

Edit: a bit of fixing (nothing content-breaking)
Last edited by like2omg on Sat Nov 30, 2013 22:45, edited 1 time in total.

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version 0.2.0 released

by Wuzzy » Post

Hi again. Sorry I answer so late. I have read your posts and I must say that your ideas are very good and I think it would greatly enhance Treasurer, when I just would actually built them in. ;-)

I also release version 0.2.0 today which was long overdue. From now on, Semantic Versioning applies.

Basically this update implements Treasurer groups. Something which you, like2omg, described as “categories”. It basically works like you described. I also have made a few mistakes in the documentation which are fixed now.

About the new groups:
TRMs can put treasures into groups and TSMs can filter out by groups. Any treasure can be assigned to one or more groups. Any TSM can shrink the treasure pool with a list of groups. Only treasures which belong to at least 1 of these groups will be in the pool.

I also suggested some groups in another text file, for a bit standardization. Stuff like “food”, or “crafting_component”, “melee_weapon”, etc. But technically, group names can be chosen freely. Using groups is optional. There is a group “default” in which all treasures go when no group is specified.

The details can be all found in the README file.

Version 0.2.0 is fully backwards-compatible to 0.1.

Download is in attachment.

Also, there’s a Git repository online now, find it at:
http://repo.or.cz/w/minetest_treasurer.git
This only contains the treasurer mod, not the examples! The examples are in treasurer0.2.0.zip (attachment).



I also distribute a new TRMP. The “P” stands for “pack”. It is a modpack entirely of TRMs. This TRMP is for minetest_game, not only default, so it should be more interesting. It is a bit more balanced than the old example for default. I’ll start with version 0.4.10.0. The version scheme follows the same of minetest_game, appended with a fourth digit, which will increase whenever I update the TRMP as long as minetest_game did not change.

IMO Treasurer seems to be pretty stable. I think I will increase the version number to 1.0.0 as soon like2omg’s other suggestions are implemented.


Maybe, for the future, I try focus more on writing TRMs for many mods, subgames and, more importantly, do more work on TSMs.
I think I could fork the mods pyramids, mines and railcorridors to include Treasurer support. All those mods already use treasure chests, but none of them use Treasurer. I tried to convince the author of the first 2 mods to use Treasurer, but it did not work. I won’t even bother trying with the third one, the author is new to modding. So I decided the only way to get anything done is to fork it and do it myselves. Well, that’s my plan at least.

If you know any other mods which generate treasure chests (or some other kind of treasure) and choose random treasures on their own, please let me know!

And maybe I can also use some of my (more or less) own ideas.

Treasurer has a lot of potential, I think. It is about time to use it! :)



Edit:
I have converted three mods into TSMs! See the initial post for links.
Attachments
treasurer0.2.0.zip
(80.31 KiB) Downloaded 1204 times
trmp_minetest_game0.4.10.0.zip
(8.39 KiB) Downloaded 1219 times

User avatar
rubenwardy
Moderator
Posts: 6969
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Treasurer [0.2.0] [treasurer]

by rubenwardy » Post

Thank you for this mod. I use it on my Capture the Flag server.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Treasurer [0.2.0] [treasurer]

by Byakuren » Post

Is there a way to provide item stacks with metadata attached, e.g. books with prewritten text? And it would be useful to be able to provide a function to treasurer to randomly (or non-randomly) generate the metadata, for example if a potion mod used metadata to store information about the potion.
Every time a mod API is left undocumented, a koala dies.

Martno
Member
Posts: 80
Joined: Thu May 28, 2015 07:09
Location: Hungary

Re: [Mod] Treasurer [0.2.0] [treasurer]

by Martno » Post

Byakuren wrote:Is there a way to provide item stacks with metadata attached, e.g. books with prewritten text? And it would be useful to be able to provide a function to treasurer to randomly (or non-randomly) generate the metadata, for example if a potion mod used metadata to store information about the potion.
That would be awesome.

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Treasurer [0.2.0] [treasurer]

by Byakuren » Post

Looks like the ability to specify metadata exists, but is undocumented. No metadata-generator support, though. For something like potions it would be possible to just register once for each preset potion effect.
Every time a mod API is left undocumented, a koala dies.

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] Treasurer [0.2.0] [treasurer]

by bell07 » Post

Hi @all,

please have a look to the new trm_generic mod that I started this week: viewtopic.php?f=9&t=15843

xisd
Member
Posts: 54
Joined: Sun Oct 02, 2016 22:38

Re: [Mod] Treasurer [0.2.0] [treasurer]

by xisd » Post

Hi !
I packed together a few more trms
Some are for mod included in minetest_game but that were not in trmp_minetest
other are for other some mods I use.
Its available there : https://github.com/xisd/trmp_Pack
Only carts is redundant with the other mod pack posted in this thread (it's the same but with the categories support)

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Treasurer [0.2.0] [treasurer]

by Wuzzy » Post

Nothing new about Treasurer itself (it is NOT on my list of priorities), but I updated the first post to make it more readable. I figured it was WAY too technical. Now hopefully it should be understandable by non-technical users as well.
To use Treasurer, you do NOT have to be a modder. :D
If you still have difficulties in understanding Treasurer, please let me know.

I also updated the list of TRMs and TSMs and added a simple usage example.

In other news, I just added a new treasure spawning mod which puts treasures into dungeon chests:
[Mod] Dungeon Treasure Chests [tsm_chests_dungeon]


I also noticed that trmp_minetest_game is very outdated. :-/
But note that Treasurer and related projects will probably remain frozen for quite a while. As I said, it is NOT a priority.

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] Treasurer [0.2.0] [treasurer]

by bell07 » Post

Next one for the list, based on tsm_chest_dungeon: https://github.com/bell07/minetest-tsm_geomoria. This mod needs both to run: treasurer and geomoria (it is not a fork of geomoria, just a hook implementation).

User avatar
Wuzzy
Member
Posts: 4781
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Treasurer [0.2.0] [treasurer]

by Wuzzy » Post

Nice!
But IMO it would be better and easier for users if Treasurer support is optionally added to the main Geomoria mod.
Meaning, when the Treasurer mod is found, it generates treasures, but if it is not found, they are not generated.

Or at least convince duane to update the first post to put a link to tsm_geomoria.

User avatar
Beerholder
Member
Posts: 199
Joined: Wed Aug 03, 2016 20:23
GitHub: evrooije
In-game: Beerholder

Re: [Mod] Treasurer [0.2.0] [treasurer]

by Beerholder » Post

UPDATE Never mind, it seems that the new chest code is using main as inventory whereas I still had the old chest code (using default:chest) from minetest_game in my game. Pulled latest MG, merged the MG mods in my game with latest MG and problem solved :) Leaving below for reference. Oh and p.s. thanks for the great mod framework!
Hi Wuzzy, I am having some trouble with one of the TSMs, the chests are always empty :( Hope you can help ... I am trying to run the mod on 0.4.16 and for some reason this bit of code from tsm_chests_dungeon does not seem to work (bit modified from the original but original also did not work):

Code: Select all

local treasures = treasurer.select_random_treasures(10, 0, 10, nil)
treasures_added = treasures_added + #treasures
for t=1,#treasures do
	minetest.log("action","[treasurer] Adding: "..treasures[t]:get_name())
	inv:add_item("main", treasures[t])
end
I added the log statement for debug purposes and it prints what it is adding e.g.:

Code: Select all

2017-05-25 23:27:59: ACTION[Server]: [treasurer] Adding: tnt:gunpowder
2017-05-25 23:27:59: ACTION[Server]: [treasurer] Adding: default:stick
So treasurer most definitely runs on mapgen and returns items. But when I look in the chests (any chest, tried lots) there is nothing in there. All chests are empty, so I guess the inv:add_item doesn't do anything. I also tried constructing a new ItemStack, passing it using inv:set_stack but no luck. I am going to debug this some more myself e.g. check for changes that might have broken this or see if there is some issue with my minetest_game not being up to date (I have had some other issues with storing meta as well), but thought I'd check with you as well, e.g. have you got this running on 0.4.16, are aware of this issue or maybe I am just doing something wrong ... Thanks! :)

User avatar
poikilos
Member
Posts: 67
Joined: Thu Feb 18, 2016 13:45
GitHub: Poikilos
In-game: Poikilos

Re: [Mod] Treasurer [0.2.0] [treasurer]

by poikilos » Post

ClockGen copied trmp_minetest_game to github for easy cloning and forking. I forked it and fixed issues with incorrect/outdated dye naming: https://github.com/poikilos/trmp_minetest_game

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] Treasurer [0.2.0] [treasurer]

by bell07 » Post

Give up the tsm_geomoria mod. I do not use it anymore and duane abadoned the Geomoria mod.

Latest version (including git history) attached.
@Wuzzy, please update the first post, set the download link to the attached file.
Attachments
tsm_geomoria.zip
(24.71 KiB) Downloaded 264 times

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests