forked from mtcontrib/minetest_treasurer
Update README.md with some factids, finish unfinished sentences.
This commit is contained in:
parent
88ca8bafbf
commit
04c61885f3
48
README.md
48
README.md
@ -59,28 +59,45 @@ Secondly, there are the treasure spawning mods (TSMs). The task of a TSM is to s
|
||||
distribute the available treasures into the world. This is also called “treasure
|
||||
spawning”. How exactly the TSM spawns the treasures is completely up the TSM. But a
|
||||
TSM has to request Treasurer to get some random treasures to distribute. A TSM may
|
||||
optionally request to filter out treasures outside certain preciousness levels, so
|
||||
it can be
|
||||
optionally request to filter out treasures outside certain preciousness levels
|
||||
and groups, so the result is a bit controllable and not completely random.
|
||||
Treasurer can not guarantee to return the requestet amount of treasures, it may
|
||||
return an empty table, for two reasons:
|
||||
|
||||
* There is no TRM activated. There must be at least one to work
|
||||
* The preciousness filter filtered out. This problem can be fixed by installing more
|
||||
TRMs or by balancing the existing TRMs to cover as many preciousness levels as
|
||||
possible. It also may be that the range specified by the TSM was too small. It is
|
||||
recommended to keep the requested range at least of a size of 1.
|
||||
Treasurer does, however, guarantee that the returned treasures are always in the
|
||||
requested boundsa.
|
||||
* There is no TRM activated. There must be at least one to work.
|
||||
* The filters filtered out everything, leaving Treasurer with an empty treasure pool
|
||||
to choose from. This problem can be fixed by installing more TRMs or by balancing the
|
||||
existing TRMs to cover as many preciousness levels as possible. It also may be that
|
||||
the range specified by the TSM was too small. It is recommended to keep the
|
||||
requested range at least of a size of 1. Treasurer does, however, guarantee that
|
||||
the returned treasures are always in the requested bounds.
|
||||
|
||||
A TSM has to at least depend on Treasurer.
|
||||
Like for TRMs, it is strongly recommended that a TSM does nothing more than spawning
|
||||
treasures. This does not exclude the possibility that a TSM does not depend
|
||||
on any other mod.
|
||||
Unlike for TRMs, it may not be a problem to also do some other stuff than just
|
||||
spawning treasures if it seems feasible. You may choose to make your TSM fully
|
||||
dependant on Treasure, then it won’t work without Treasurer. You may also choose
|
||||
to only add an optional dependency on Treasurer. For this to work, your mod must
|
||||
now select its own treasures, which of course will only come from a rather limited
|
||||
pool.
|
||||
|
||||
To check if the Treasurer mod is installed, you can use something like this in
|
||||
your code:
|
||||
|
||||
```
|
||||
if(minetest.get_modpath("treasurer")~=nil) then
|
||||
-- Treasurer is installed.
|
||||
-- You can call Treasurer’s functions here.
|
||||
else
|
||||
-- Treasurer is not installed.
|
||||
-- You may write your replacement code here.
|
||||
-- You can not call Treasurer’s funcitons here.
|
||||
end
|
||||
```
|
||||
|
||||
There are two example TSMs. The first one is a very basic one and called “`tsm_gift_example`”.
|
||||
It gives a “welcome gift” (1 random treasure) to players who just joined the server
|
||||
or who respawn. The preciousness filter is not used. It does only depend on Treasurer.
|
||||
The second one is called “`tsm_chests_example`” and pretty advanced for an example.
|
||||
or who respawn. The preciousness and group filters are not used. It does only depend on
|
||||
Treasurer. The second one is called “`tsm_chests_example`” and pretty advanced for an example.
|
||||
It places chests of the mod “default” between 20 and 200 node lenghts below the water
|
||||
surface and puts 1-6 random treasures into these. The lower the chest, the higher
|
||||
the preciousness. It depends on treasurer and default (for the chests, of course).
|
||||
@ -108,7 +125,8 @@ certain treasure is then simply the rarity value divided by the sum.
|
||||
How “precious” an item is, is highly subjective and also not always easy to categorize.
|
||||
Preciousness in Treasurer’s terms should be therefore viewed as “utility” or as
|
||||
“reward level” or “strength” or even “beauty” or whatever positive attributes you can
|
||||
think of for items.
|
||||
think of for items. See the text file `GROUPS_AND_PRECIOUSNESS` for a rough
|
||||
guideline.
|
||||
So, if you create a TRM and your treasure is something you want the player work
|
||||
hard for, assign it a high preciousness. Everyday items that are already easy to
|
||||
obtain in normal gameplay certainly deserve a lower precious than items that are
|
||||
|
2
init.lua
2
init.lua
@ -210,7 +210,7 @@ end
|
||||
count: (optional) amount of items in the treasure. If this value is nil, treasurer assumes a default of 1.
|
||||
min_preciousness: (optional) don’t consider treasures with a lower preciousness. nil = no lower limit
|
||||
max_preciousness: (optional) don’t consider treasures with a higher preciousness. nil = no lower limit
|
||||
treasurer_group: (optional): Only consider treasures which are members of at least one of the members of the provided Treasurer group table. nil = consider all groups
|
||||
treasurer_groups: (optional): Only consider treasures which are members of at least one of the members of the provided Treasurer group table. nil = consider all groups
|
||||
returns:
|
||||
a table of ItemStacks (the requested treasures) - may be empty
|
||||
on error, it returns false
|
||||
|
Loading…
Reference in New Issue
Block a user