[Mod] liblevelup [2020-12-16][liblevelup]

Post Reply
User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

[Mod] liblevelup [2020-12-16][liblevelup]

by AlexYst » Post

liblevelup is a mod for collecting statistics on what node drops players have acquired throughout their time on your server. It's intended to be used to add a sense of progression to the game, giving some sort of bonus to players based on the amount of experience they've had mining different materials, but does not itself do anything but count.

liblevelup has now been streamlined and improved. Now, it counts minerals drops, farm crop drops, sapling drops, and farm seed drops. These are all detected automatically; liblevelup attempts to adapt to the set of mods that are currently running, and no hard-coded drops are included. It's all dynamic. Originally, liblevelup included an sfinv page, but that has now been broken off into its own mod. If you want to restore that functionality, please install minestats_sfinv. Other graphical interfaces can be installed as well, such as minestats_hud, which displays a player's stats to them via the HUD instead of the inventory menu.

Things mined not by players directly are not counted. These things include, for example, leaf decay, falling node mishap, attached node drops, and TNT explosions. They are not attributed to any player, as no player mined them. If for some reason you want those stats as a player, you need to mine your own leaves instead of letting leaf decay do all the work for you; you only get credit for stats you actually *earn*. This isn't likely to change anytime soon; the Minetest API barely allows me to capture player names when actually digging through subtle hackery; it doesn't allow me to capture coordinates at all, nor is there a get_nearest_player() method even if I did have coordinates.

History:

Originally, this functionality was coded as part of a mod called Minequest, where it allowed players to become more proficient at using items in certain ways. I though the feature might be useful to other mods, so I generalised it, broke it off into a separate mod, and called it "minestats". While minestats was complete, I eventually hit a dead end with Minequest and had to discontinue it before release. Given its name and its lack of context, I felt like minestats sort of just became a stats display mod, which is never what it was intended to be. It was supposed to actually influence game play. In an attempt to turn that around, I've rebranded it as "liblevelup", a more-fitting name. That breaks dependencies though, so with dependencies already broken, I took the opportunity to reorganise the API a bit better. The old API will be included in the mod for at least two years after its deprecation, as is my standard when deprecating API features in this mod, but you'll also need to edit the dependency list of any older mods you have that use this to depend on liblevelup instead of minestats.

The API tables are as follows:

- liblevelup.register:

This table contains callback-registration functions used to alter liblevelup's behaviour or request event notifications from libelvelup. Registration functions should be called during mod-loading time. After mod-loading time has ended, the entire registration table becomes unavailable at some point between mod-loading time and game time.

Code: Select all

liblevelup.register.is_countable(function(node_string, drop_string, drop_possibilities))
liblevelup is extendible! It does its best to determine what nodes and drops should be counted, but by registering a function here, you can help it out a bit and make it count even more node/drop combos. When going through the list of available nodes and their drops, liblevelup will call your function passing three arguments. The first two are the node and one item of one of its potential drops. Your function should return true if you want that node/drop combo counted. The third argument is a table of potential drops that node can drop in their full form. Each item is itself a table, containing the items that the node could drop together in a single dig. All possible drop combinations are included. Both the node string and drop string are in item string format. Usually, the node will simply be a node name, but in the case of coloured nodes, it'll also contain a palette index. Don't just assume this string is a valid node name and attempt to look it up in the minetest.registered_nodes table; the string may have more data and not be in the table in that form. The drop string will frequently contain non-name data, such as an item count, but can also include tool wear and metadata.

Only one is_countable function can be registered per mod, so put all your checking logic in a single function or call other functions from within the function you register. If you try to register a second is_countable function from the same mod, it'll override the first.

Code: Select all

liblevelup.register.levelup_function(function(player, level))
When a player levels up, functions registered with this function will be called and passed a player object and an integer, with the integer being the player's new level. Levels start at zero, so the first level-up will be at level one.

Code: Select all

liblevelup.register.startup_function(function())
Some mods need to run code near the beginning of the game, but need access to the liblevelup API, including liblevelup.meta.drops_list(). They can use this function to register their own function that will be called once liblevelup has become ready. Please note two things about this function though. First, these functions are only called once, soon after load time. Registering a function later is pointless, and this function actually disappears from the API once it's too late to use it. Second, because of the way this is implemented, each mod may only register up to one startup function. As all these functions are called in succession, you might as well put everything you need run in one registered function anyway.

Code: Select all

liblevelup.register.update_function(function(player))
Functions registered with this function should take a player object as an argument and will be called every time a player's stats are updated. This could, for example, be used to set up a self-updating stats page for players in their inventory menu. Like the last function, only one function per mod is allowed; again, as these functions are all run in succession, you might as well put all your code to be registered in a single function.

- liblevelup.unregister:

If you want to override the functionality of another mod, it can be helpful to remove that mod's callback registrations, either to replace them with others or simply prevent them from activating. The following functions take a mod's name and removes the function they registered of the relevant type, if such a function was registered. For this to be effective, you'll need to depend on the mod (or soft depend on it) in order to make sure your unregistration comes after the other mod's registration. Otherwise, the other mod will sometimes register after you try to unregister. At this time, is-countable registrations cannot be unregistered. The other unregistration functions are self-explanatory:

Code: Select all

liblevelup.unregister.is_countable(mod_name)
liblevelup.unregister.levelup_function(mod_name)
liblevelup.unregister.update_function(mod_name)
- liblevelup.get:

These functions query the stats database.

Code: Select all

liblevelup.get.drop_stat(player_name, drop_name)
This function returns the number of a given item the player has gotten from node drops. For example, call this function passing the name "default:coal_lump", not "default:stone_with_coal".

Code: Select all

liblevelup.get.player_level(player_name)
Given a player name, this function returns that player's current level. Levels are obviously determined based on mining/farming experience. Levels start from level zero.

Code: Select all

liblevelup.get.next_level_at(player_name, material)
Given a player name and a material name, this function returns how many more of the material the player would need to mine/harvest in order to level up. Levelling occurs on a per-material curve, so the less of a material you've already harvested, the more harvesting that material counts toward your next level. That means there are two main strategies for increasing your level: harvest a lot of material or harvest many types of materials.

Code: Select all

liblevelup.get.player_material_level(player_name, material)
This function returns a per-material level related to how much of the material the player has harvested. Using this levelling function is usually not preferred, and liblevelup.get.player_level() is usually the better option. Use liblevelup.get.player_material_level() instead if for some reason you need separate levels for separate materials, such as if you want to add a feature that depends on a player's proficiency with a given material.

Code: Select all

liblevelup.get.pair_stat(player_name, node_name, drop_name)
This function returns the number of a given item, such as coal or cotton, a player has mined from the given node, such as coal ore or a specific cotton growing stage. This function is quantity-sensitive, so passing "farming:cotton" will tell how many times a given player has gotten a single cotton drop from the cotton plant stage, while passing "farming:cotton 2" will instead tell how many times the player received the possible double drop.

- liblevelup.meta:

These functions query information about the environment liblevelup is running in, but don't touch the database in any way.

Code: Select all

liblevelup.meta.is_counted(node_name, drop_name)
Returns a boolean, indicating whether the given node/drop combination is considered to be countable by liblevelup.

Code: Select all

liblevelup.meta.pairs_list()
This function, if called during load time, will return an empty table, as liblevelup is still waiting for all mods to have their chance to register nodes, recipes, and items. Once the game begins though, it'll return a table of all nodes and items counted by this mod. Each table entry is itself a table, containing three elements. "node" contains the name of the node that drops this item. "drop" is the drop that gets counted; it could be plural, like "farming:wheat 2". Confusingly, the outer table is is indexed from one instead of from zero, but that makes it easier to work with in many of Lua's functions. The keys denote the alphabetical order of the nodes, then drops.

Code: Select all

liblevelup.meta.drops_list()
Like the previous function, this one returns an empty table when called during load time. Otherwise, it returns a table of all detected countable drop items. The keys are simply integers denoting the alphabetical order of the drops, and the values are the item strings of each drop. Again, these are indexed from one. For example, if default is installed, "default:coal_lump" will be in this table, not "default:stone_with_coal".

Code license: GNU LGPL 2.1+
Resource license: no images or sounds are included!
Mod dependencies: None!

Download: <https://notabug.org/y.st./liblevelup/archive/master.zip>
Repository: <https://notabug.org/y.st./liblevelup>
Last edited by AlexYst on Thu Dec 17, 2020 06:55, edited 36 times in total.

User avatar
cx384
Member
Posts: 653
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: [Mod] Minestats [minestats]

by cx384 » Post

Good job!
Do you support unified_inventory?
Can your read this?

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Minestats [minestats]

by azekill_DIABLO » Post

great! what a nice formspec!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Andrey01
Member
Posts: 2574
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] Minestats [minestats]

by Andrey01 » Post

Really do tin lumps have on default?

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Minestats [minestats]

by azekill_DIABLO » Post

Andrey01 wrote:Really do tin lumps have on default?
yup sir, welcome to 4.14.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

cx384 wrote:Good job!
Do you support unified_inventory?
Not yet, but I can try! It shouldn't be too hard.
Andrey01 wrote:Really do tin lumps have on default?
Minetest 0.4.15 doesn't have tin lumps in default, but Minetest 0.4.16 (not yet released) will have them.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Minestats [minestats]

by azekill_DIABLO » Post

are you kiding me i got them... *checking*
ok all my sorryness sir i was wrong, i got moreores.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

cx384 wrote:Good job!
Do you support unified_inventory?
Full unified_inventory support does not seem possible at this time due to unified_inventory's inflexible API. Single-page (up to eight minerals) support has been added for unified_inventory though. Details of the problem are in the initial post.

User avatar
Andrey01
Member
Posts: 2574
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] Minestats [minestats]

by Andrey01 » Post

y.st. wrote:
Andrey01 wrote:Really do tin lumps have on default?
Minetest 0.4.15 doesn't have tin lumps in default, but Minetest 0.4.16 (not yet released) will have them.
How? 0.4.15 have already been released long ago in December.

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: [Mod] Minestats [minestats]

by GreenXenith » Post

Andrey01 wrote:
y.st. wrote:
Andrey01 wrote:Really do tin lumps have on default?
Minetest 0.4.15 doesn't have tin lumps in default, but Minetest 0.4.16 (not yet released) will have them.
How? 0.4.15 have already been released long ago in December.
0.4.15 does NOT have tin. The next version (0.4.16) WILL have them.
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Minestats [minestats]

by azekill_DIABLO » Post

he his totally true!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

twoelk
Member
Posts: 1482
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

Re: [Mod] Minestats [minestats]

by twoelk » Post

cool - and interesting
meloves stats
me=informationfreak

This might be usefull for uhm, lots of things,
anyways teachers might like it if they would get easy access to the individual stats - maybe some sort of serverstats version?

I wonder if this could report to a book....
one could craft a book called mystats or maybe [playername]stats and could somehow link it to the mod so that the mod would write it's stats to this book also. This might bypass some page issues.
Of course the book should be placeable into a bookshelf inventory.
Actually if the stats where avaliable to other mods one could imagine some central highscore screen for some contest ...
er ...
better not :-O
one could see I havn't been all to busy on some servers lately that I had big plans on :-(

I wonder how useful this mod might be together with Adventuretest or on some skyblock server or in some classroom project...

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

twoelk wrote:cool - and interesting
meloves stats
me=informationfreak

This might be usefull for uhm, lots of things,
anyways teachers might like it if they would get easy access to the individual stats - maybe some sort of serverstats version?

I wonder if this could report to a book....
one could craft a book called mystats or maybe [playername]stats and could somehow link it to the mod so that the mod would write it's stats to this book also. This might bypass some page issues.
Of course the book should be placeable into a bookshelf inventory.
Actually if the stats where avaliable to other mods one could imagine some central highscore screen for some contest ...
er ...
better not :-O
one could see I havn't been all to busy on some servers lately that I had big plans on :-(

I wonder how useful this mod might be together with Adventuretest or on some skyblock server or in some classroom project...
The only page issues are caused by inventory_plus, not this mod. I like the book idea, though I don't think I could make it auto-update. I might use that book idea for a different mod I'm working on that will hook into this one. Speaking of which, it seems you have a similar idea as me on that. This mod was actually *built* to report stats to other mods. This mod wasn't originally intended to stand alone, and was part of something bigger. For flexibility though, I broke it off into its own mod. However, the API on that stat-sharing isn't completely stable quite yet. I'll need to finish the other mod first, as that'll give me a chance to better explore what information other mods might need from this one. High scores aren't quite the direction I'm headed in, but they should be easy to implement once both mods are complete.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

It's been a bit, but I have an update. I thought once this mod was finished, it'd be finished, aside from some tweaks needed to communicate properly with the upcoming companion mod. After all, the concept is so simple that I thought there would be nothing to elaborate on. I was wrong.

I've removed support for unified_inventory. The simple fact is that unified_inventory is too rigid for something as dynamic as this mod. I shoehorned partial unified_inventory support into this mod before, but such broken support just makes *this* mod look like it's broken, when (in my opinion) it's unified_inventory that needs an overhaul. I'm currently looking into building a compatibility layer between unified_inventory and mods that use the more modern and official sfinv. If I can get it working at all, it'll be incredibly hacky. However, that hackiness will be in its own mod, not lumped into this one.

I've fixed up the stat storage. When this mod starts, it'll transfer the data from the old database to the new one. I'll leave the database update in the code for at least two years, but no promises after that. Just load any world that used an old version of this mod using the new version, and the update will be applied.

I found a bug in how this mod handled immature farm plants. Less than twenty percent of the time, they'd be considered minerals and counted. If you harvested fifteen immature farm plants, this mod would say you'd harvested about three. This bug only affected immature farm plants, never mature ones. The bug has been corrected, and farm plants are now never considered minerals.

The full list of defined minerals is now visible to the player *before* the player digs any of them. Now players know what to look for. More importantly though, mod developers and server administrators can know exactly which nodes are detected by this mod without extensive, time-consuming, potentially-unthorough test sessions. Speaking of which, minerals are now listed in a consistent order, not in the order of greatest number harvested to least number harvested. Previously, if a mineral-defining mod was removed, this mod would continue showing the item in the form of an unknown item, along with its numeric stat. I swear this was a deliberate feature, not a bug, but it did look messy. This has been removed, and unknown items no longer display. This new setup involved an almost-total rewrite of the mod, but it feels so much more complete.

This mod never depended on default, but it did use the furnace arrow image from that mod. As a result, if default wasn't installed, the stats menu would have broken images. That has been corrected, and this mod now uses text instead. Removing default won't hinder this mod any more. Speaking of dependencies, this mod no longer depends on sfinv. If sfinv is installed, great! This mod will use it to add a stats page. If not, this mod will simply silently track stats. Additionally, if you have the creative mod installed and creative mode turned on, it previously shut this mod off. That was a known bug, but was sort of a low priority on my list. However, fixing it was easier than I thought. The menu tabs are in a different order, but this mod is now compatible with the creative mod.

The stats page now does not appear if no mineral-defining mods are installed. Having a blank page there was just stupid.

As I was finishing up the last of this update, I found several more things I want to do. I was tempted to work on them instead of finalising this release, but that would've delayed the release of these new features, and the code was so close to presentable anyway that I had to finish up what I already had. First, I found another bug to fix. Minerals that use unnormalised item strings as their drops are not properly detected. In some cases, this is because the mod's using legacy item strings because it's an old mod. In other cases, it's because the mod is unnecessarily specifying that there's one of the item ("default:iron_lump 1" instead of "default:iron_lump"). Either way, I need to add normalisation so this mod properly detects all mineral nodes. I'm also considering adding support for mineral nodes that drop multiple of the same item. I don't recall offhand which mods do this, but there do exist at least a couple.

Most nodes that this mod supports are found underground. Miners like me have it made, but surface-dwellers are sadly neglected. My biggest problem with adding support for surface nodes though was that it would inadvertently cause the mod to count the number of regular stone nodes mined. Do we really want a cobble counter? As I was finishing up this update though, I came up with a way to add support for young plant gathering (getting seeds from grass and saplings from bushes and trees) as well as coral-mining. Preliminary tests look good, and I should be able to add support for these nodes in a later update.

There are technical limitations that prevent me from giving farm plants the first-class support they deserve. However, I can give them second-class support if anyone's interested. Number of plants harvested would need to be separated from the number of each crop harvested, due to the fact that the plants can drop multiple types of items in a single harvest. Is this something anyone would be interested in? Does anyone have any arguments for or against this?

u34

Re: [Mod] Minestats [minestats]

by u34 » Post

y.st. wrote:Image
+1 for this awesome mod!!

the page stats does not count an element when the page is active shown on the screen! You have to press the next and previous button to show the correct amount of elements. should there be a button to refresh the counters which are displayed on the screen. This problem has the awards-mod also. There is no automatic refresh.

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

cHyper wrote:
y.st. wrote:Image
+1 for this awesome mod!!

the page stats does not count an element when the page is active shown on the screen! You have to press the next and previous button to show the correct amount of elements. should there be a button to refresh the counters which are displayed on the screen. This problem has the awards-mod also. There is no automatic refresh.
I noticed that while testing too. I was reluctant to add automatic refreshing though, as it'd require a table be added to keep track of what page each player is on to make sure the right new formspec is sent or, if the player's on another tab, make sure not to update that player's formspec at all. I like your idea of a refresh button, but there's precious little space. There's one to two more buttons I already need to add to that bottom area, and a third will start covering the page number. I'll see what I can get put together though, this does seem like a feature that should be added.

EDIT: Done! The stats page now automatically updates as you mine.

u34

Re: [Mod] Minestats [minestats]

by u34 » Post

EDIT: Done! The stats page now automatically updates as you mine.
+1 thanks for this.

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] Minestats [minestats]

by TumeniNodes » Post

could an option for kill stats be added for pvp gaming?
gruesome, I know... but hey..., it's all about street cred :P
A Wonderful World

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

TumeniNodes wrote:could an option for kill stats be added for pvp gaming?
gruesome, I know... but hey..., it's all about street cred :P
I'll look into that. It doesn't seem like it would be too difficult to add support. I might need to do it as a separate mod though. Are you looking to log the number of kills each player has or an itemised number of times each player has killed each other player?

Image

Support for seeds and saplings does not seem to be within the range of my capabilities for the time being. The major difficulty is in distinguishing seeds and saplings from grass and torches. Grass comes in five flavours, all of which drop the same node. This gets four of them flagged as potential countables. Torches use one of three nodes depending on their facing and all three, again, drop the same node, getting two of them flagged as countables. This is *CORRECT* behaviour in Minetest Game, I just don't have a way to distinguish it from the dropping of young plants just yet. I could check for the presence of an on_place method to rule out grass and torches, but that would rule out seeds and saplings as well. Seeds use this method to limit what nodes they can be placed on. Saplings use this to prevent players from placing saplings that can grow into a neighbour's protected area. This allows the prevention of vandalism-by-tree while still allowing saplings to *grow* in protected areas, provided the area is protected by the player that placed the sapling or the sapling was placed before the protection was. I always welcome pull requests, but I'd be especially thankful for any relating to this issue.

On a more positive note, this mod now supports legacy item strings, unnormalised item strings, and nodes that drop more than one of the same craft item. It's worth noting that nodes that drop a variable amount of their bounty will have several entries on the stats page, one for every amount they can drop. This is an intended feature, and was always the intention in multi-item drop support. It's interesting to see how often you get each potential number of items, so lumping all digs together or counting the total number of dropped items was never the intention and will not be implemented. An example of how this works is shown in the screenshot in this post. The lapis mod adds lapis lazuli ores to the game, which when mined, drop two, three, four, or five of the mineral. Previously, this made lapis lazuli exempt from counting in minestats, but now, it instead gives lapis lazuli four entries on the stats page. Nodes that drop more than 65535 of the same item are still not supported for the same technical reasons that farm plants aren't supported (namely, that I don't know where to even begin support for a variable number of drop stacks), but in practice, no node should be dropping that many items when mined, so it won't be a problem.

I'm still not sure if support for farming nodes, which drop multiple *types* of item in one drop, will be added in the future. However, one thing is for certain: support for multiple types of drops is of a lower priority than basic support for surface plants. Until I can find a way to support seeds and saplings without counting the number of times a torch has been removed from a wall, farming support won't make it into this mod.
Attachments
screenshot_20170606_190951.png
screenshot_20170606_190951.png (146.83 KiB) Viewed 1039 times

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] Minestats [minestats]

by TumeniNodes » Post

y.st. wrote:
TumeniNodes wrote:could an option for kill stats be added for pvp gaming?
gruesome, I know... but hey..., it's all about street cred :P
I'll look into that. It doesn't seem like it would be too difficult to add support. I might need to do it as a separate mod though. Are you looking to log the number of kills each player has or an itemised number of times each player has killed each other player?
I think both would be desirable with pvp gamers. : )
But, it does seem it would make more sense as it's own mod anyway so, I won't divert focus here on it. And will just wait until it comes up again.

This mod looks really great btw
A Wonderful World

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

TumeniNodes wrote:I think both would be desirable with pvp gamers. : )
But, it does seem it would make more sense as it's own mod anyway so, I won't divert focus here on it. And will just wait until it comes up again.

This mod looks really great btw
Thanks! I've tried to make it as complete as possible.

I'm stuck on this mod, anyway. The last feature I want to add seems to be out of my reach for the time being, which means I was about to work on one of two unreleased mods. One is boring; I don't want to work on it, I just feel obligated to. The other will require a lot of planning before much can be done on it. I'm excited, but I'm also ill prepared. I might as well work on the death stats mod; I don't think it'll take as much time as the others, given what I've already learned working on this stats mod. I can't promise it'll be super quick though, the night's almost over and I'll be spending a chunk of tomorrow biking to the next city over for an errand, but I've made a fair bit of progress already.

EDIT: I can't really test this. I'm on a weak laptop, so having multiple clients open isn't a good idea. You're welcome to try my code though and see if it meets your needs. If not, or if it has a bug, let me know and I'll see what I can do. If it works, I'll give it its own forum topic.

Code license: GNU LGPL 2.1+
Resource license: no images or sounds are included!
Mod dependencies: sfinv
Download: <https://notabug.org./y.st./slayer/archive/master.zip>
Repository: <https://notabug.org./y.st./slayer>

At first, I tried adding images beside each player's name; specifically, an image of the bones:bones node. It didn't really look very good though, and removing it allowed me to remove dependence on the bones mod. Also, it let me up the number of players displayed per page from seven to fifteen.

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

I normally try not to bump this early, but ...

PREVIOUS VERSIONS OF THIS MOD HAVE A GAME_BREAKING BUG!! If you have installed this mod, *please* consider updating to the latest version, which has a bug fix in place.

Details, you ask? When an attached node's supporting node is dug, the attached node drops its usual drops as usual, but *additionally* drops itself! You just knocked a torch off the wall? Congratulations! Here, have two torches. You dug the ground beneath some grass? Here, have either two grass items or a grass and a seed. Ugh. What a mess. I am very sorry.

While I'm here ...

Other new features include a more-condensed menu mode for when a world has more then nine minerals defined, and a single-page mode for when less than nineteen minerals are defined. Previously, the bottom line of the formspec was reserved for page buttons, even when no page buttons were needed. This resulted sometimes in a second page in which there was only one item, an item that would've fit on the first page if the page buttons weren't in the way. Additionally, support has been added for a corner case that affects the lapis mod, but not the lapis mod. While once only one was fully-compatible with minestats, now they both are. I haven't seen this corner case in other mods, but it's worth handling correctly for consistency. As a separate corner case, some nodes contain the property "drop = {}". Previously, that would cause minestats to crash the game at load time. This has been corrected now, as it's actually a valid value for that node property and should be treated as such.

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] Minestats [minestats]

by TumeniNodes » Post

y.st. wrote:
Thanks! I've tried to make it as complete as possible.

I'm stuck on this mod, anyway. The last feature I want to add seems to be out of my reach for the time being, which means I was about to work on one of two unreleased mods. One is boring; I don't want to work on it, I just feel obligated to. The other will require a lot of planning before much can be done on it. I'm excited, but I'm also ill prepared. I might as well work on the death stats mod; I don't think it'll take as much time as the others, given what I've already learned working on this stats mod. I can't promise it'll be super quick though, the night's almost over and I'll be spending a chunk of tomorrow biking to the next city over for an errand, but I've made a fair bit of progress already.

EDIT: I can't really test this. I'm on a weak laptop, so having multiple clients open isn't a good idea. You're welcome to try my code though and see if it meets your needs. If not, or if it has a bug, let me know and I'll see what I can do. If it works, I'll give it its own forum topic.

Code license: GNU LGPL 2.1+
Resource license: no images or sounds are included!
Mod dependencies: sfinv
Download: <https://notabug.org./y.st./slayer/archive/master.zip>
Repository: <https://notabug.org./y.st./slayer>

At first, I tried adding images beside each player's name; specifically, an image of the bones:bones node. It didn't really look very good though, and removing it allowed me to remove dependence on the bones mod. Also, it let me up the number of players displayed per page from seven to fifteen.
I get "init.lua" does not exist... I must be doing something wrong.
this goes into the mods folder, correct?
I'd like to see pvp players test this. This would be especially nice for arena type gaming
I think HOMETOWN has an arena, that would be an excellent place to test

can you open a new WIP thread for the slayer mod?
I just left a post on HOMETOWN
A Wonderful World

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

TumeniNodes wrote:I get "init.lua" does not exist... I must be doing something wrong.
this goes into the mods folder, correct?
I'd like to see pvp players test this. This would be especially nice for arena type gaming
I think HOMETOWN has an arena, that would be an excellent place to test

can you open a new WIP thread for the slayer mod?
I just left a post on HOMETOWN
Sorry, that's a problem with the Git host. Most Git hosts, NotABug included, rename the directory to the wrong name, which confuses Minetest. To get around that in the past, I had to put the mod directory *inside* the root directory, so it wouldn't get renamed (as the root directory is the one to get renamed). I'm still in the habit of doing that. However, Minetest has a recentish feature that allows this to instead be corrected with the mod.conf file, so I've switched to that now. Either redownload the mod or remove that outer directory.

As for the topic: <viewtopic.php?f=9&t=17862>

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] Minestats [minestats]

by TumeniNodes » Post

DOH... how did I miss that? my bad, sorry.
A Wonderful World

User avatar
AlexYst
Member
Posts: 109
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: AlexYst
In-game: AlexYst
Contact:

Re: [Mod] Minestats [minestats]

by AlexYst » Post

TumeniNodes wrote:DOH... how did I miss that? my bad, sorry.
No worries. It's something that really should be fixed on the Git host's end.

-=-=-

I 've been trying to log the mining of the wrong plants all along! This mod logs the collection of craft items when digging, and it should stay that way. Instead of attempting to log saplings and seeds, this mod now logs the collection of unplacable items, such as cotton and wheat. Farm plants are now supported! There's a catch though. The default farm plants have eight stages of growth and two drop levels. That's a total of sixteen *separate* stats for each of these two basic plants. Each plant had a stats page to itself in my initial testing! To combat that, I've condensed the stats into fewer by ignoring the node that dropped the farm crop. This condenses the two pages (one for cotton, on for wheat) to a more reasonable level, but comes at the cost of leaving the node off of the stats page. While the minerals page displays both the mineral node and the mineral drop, the farming page displays only the drop. Additionally, it's worth noting that if a craft item of the specific quantity used to craft the node is dropped, it will not be logged. For example, one or two wheat can't be crafted into a wheat plant, so wheat is always counted. However, four clay lumps are dropped by a clay block, and that same number of clay lumps can be used to craft the clay block again so it can be placed. For that reason, the dropping of clay lumps by clay blocks is never logged.

That brings me to the next new feature: separate pages for minerals and farm plants! So which is the default page? It depends on your elevation. When underground, the default page displays the mineral counts. When on the surface or in the air, farm plants are displayed by default. If you want to see the other stats though, the page mode can be toggled back and forth. I've had to drop support for using the last line for stat display when only a single page is available for simplicity, but if anyone has any complaints, I can probably bring that back; it'l just require some more-complicated checks. In practice, this feature shouldn't be used by many any more anyway, as most people have default and farming both installed, which will give them at least two pages. Please remember that the stat sorting in this mod is automated. That makes it imperfect, at best, and I hope you can forgive that. Items that we intuitively consider to be minerals may at times end up in the farming section and vice versa.

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests