[MOD] Tool ranks [toolranks]

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

[MOD] Tool ranks [toolranks]

by lisacvuk » Post

Tool ranks
What this does is add levels to tools depending on number of nodes you've dug with that tool.
Higher level tools take longer to wear out.
So, what is the point of this mod?
How many times have you repaired a tool in Minetest?
If you are me, the number is close to none. The reason being, there is really no point to do so.
With this, you'll tend to keep your tools alive, by repairing them.
In order to keep the count of digs, place the tool on the first slot in the grid on the repair recipe.
You've convinced me, how do I get this mod?
It's simple!
Github
Direct link
And now the fancy screenshots!
Image
Image
How does this calculate the new wear?

Code: Select all

wear = digparams.wear / (1 + level / 4)
I simply brute-forced the above code. No idea how it works, but it seems about right in-game.
Dependencies:
default
Licence:
Code: LGPLv2.1+
Tool level sound: CC BY 3.0
Last edited by lisacvuk on Thu Oct 18, 2018 13:34, edited 5 times in total.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

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

Re: [MOD] Tool ranks [toolranks]

by azekill_DIABLO » Post

it's a must should be default!

User avatar
SaKeL
Member
Posts: 653
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [MOD] Tool ranks [toolranks]

by SaKeL » Post

Realy nice idea..agree..this should be considered in default game

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

Re: [MOD] Tool ranks [toolranks]

by azekill_DIABLO » Post

SaKeL wrote:..agree..
you must define the variable before concatenation

User avatar
the_raven_262
Member
Posts: 315
Joined: Mon Sep 22, 2014 09:30
GitHub: theraven262
IRC: the_raven_262 Raven262 Corvus262 corvus
In-game: the_raven_262 Raven262 Nevermore

Re: [MOD] Tool ranks [toolranks]

by the_raven_262 » Post

Not bad, not bad at all.
[amber] [conjuration] [warzone] | Why is #minetest-mod-dev so empty?

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

I should also add some ranks for swords, ex. '20 players killed', '25500 nodes dug'
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

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

Re: [MOD] Tool ranks [toolranks]

by twoelk » Post

could imagine many uses for this.
lisacvuk wrote:I should also add some ranks for swords, ex. '20 players killed', '25500 nodes dug'
might be of interest what was hit ;-)
For example on a non PvP server for a sword, if you hit a mob the rank goes up but if you hit a player the rank goes down. Of course there could be many other uses of blunting a tool or weapon beyond wear.

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

twoelk wrote:could imagine many uses for this.
lisacvuk wrote:I should also add some ranks for swords, ex. '20 players killed', '25500 nodes dug'
might be of interest what was hit ;-)
For example on a non PvP server for a sword, if you hit a mob the rank goes up but if you hit a player the rank goes down. Of course there could be many other uses of blunting a tool or weapon beyond wear.
Wouldn't do that. If someone wants to enforce no-PvP it shouldn't be through lowering weapon rank.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
Napiophelios
Member
Posts: 1019
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [MOD] Tool ranks [toolranks]

by Napiophelios » Post

This is a neat mod, however, after some time I receive an error that abruptly crashes game.
And I cannot rejoin without removing the mod.
Image
Instead of the repair grid I have been using the anvil from cottages mod to repair tools,
maybe this is the culprit, IDK.

Code: Select all

2017-07-12 04:20:28: ACTION[Server]: singleplayer digs default:stone at (342,-35,1)
2017-07-12 04:20:28: WARNING[Server]: Assignment to undeclared global "level" inside a function at ...minetest_game\mods\toolranks\init.lua:57.
2017-07-12 04:20:28: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback ScriptApiNode::node_on_dig(): ...minetest_game\mods\toolranks\init.lua:59: attempt to compare number with nil
2017-07-12 04:20:28: ERROR[Main]: stack traceback:
2017-07-12 04:20:28: ERROR[Main]: 	...minetest_game\mods\toolranks\init.lua:59: in function 'after_use'
2017-07-12 04:20:28: ERROR[Main]: 	D:\Games\MineTest_04160\bin\..\builtin\game\item.lua:483: in function <D:\Games\MineTest_04160\bin\..\builtin\game\item.lua:453>
2017-07-12 04:20:28: ACTION[Server]: singleplayer leaves game. List of players:
screenshot.png
(3.86 KiB) Not downloaded yet

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

Napiophelios wrote:This is a neat mod, however, after some time I receive an error that abruptly crashes game.
And I cannot rejoin without removing the mod.
Image
Instead of the repair grid I have been using the anvil from cottages mod to repair tools,
maybe this is the culprit, IDK.

Code: Select all

2017-07-12 04:20:28: ACTION[Server]: singleplayer digs default:stone at (342,-35,1)
2017-07-12 04:20:28: WARNING[Server]: Assignment to undeclared global "level" inside a function at ...minetest_game\mods\toolranks\init.lua:57.
2017-07-12 04:20:28: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback ScriptApiNode::node_on_dig(): ...minetest_game\mods\toolranks\init.lua:59: attempt to compare number with nil
2017-07-12 04:20:28: ERROR[Main]: stack traceback:
2017-07-12 04:20:28: ERROR[Main]: 	...minetest_game\mods\toolranks\init.lua:59: in function 'after_use'
2017-07-12 04:20:28: ERROR[Main]: 	D:\Games\MineTest_04160\bin\..\builtin\game\item.lua:483: in function <D:\Games\MineTest_04160\bin\..\builtin\game\item.lua:453>
2017-07-12 04:20:28: ACTION[Server]: singleplayer leaves game. List of players:
screenshot.png
I'm looking into the issue right now, sorry for experiencing it. I probably haven't tested the mod enough before releasing it
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

Bug is solved; please download the latest version!
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
Napiophelios
Member
Posts: 1019
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [MOD] Tool ranks [toolranks]

by Napiophelios » Post

lisacvuk wrote:Bug is solved; please download the latest version!
Awesome, thanks for the quick fix :)
Image

Maybe you can add Moreores mod?

Code: Select all

--
--Moreores
--

if minetest.get_modpath('moreores') then
minetest.override_item("moreores:pick_mithril", {
  original_description = "Mithril Pickaxe",
  description = create_description("Mithril Pickaxe", 0, 1),
  after_use = new_afteruse,
})
minetest.override_item("moreores:axe_mithril", {
  original_description = "Mithril Axe",
  description = create_description("Mithril Axe", 0, 1),
  after_use = new_afteruse,
})
minetest.override_item("moreores:shovel_mithril", {
  original_description = "Mithril Shovel",
  description = create_description("Mithril Shovel", 0, 1),
  after_use = new_afteruse,
})
minetest.override_item("moreores:pick_silver", {
  original_description = "Silver Pickaxe",
  description = create_description("Silver Pickaxe", 0, 1),
  after_use = new_afteruse,
})
minetest.override_item("moreores:axe_silver", {
  original_description = "Silver Axe",
  description = create_description("Silver Axe", 0, 1),
  after_use = new_afteruse,
})
minetest.override_item("moreores:shovel_silver", {
  original_description = "Silver Shovel",
  description = create_description("Silver Shovel", 0, 1),
  after_use = new_afteruse,
})
end
Would be better if other mods could register their own tools
instead of adding them all to ToolRanks mod init file though.
screenshot.png
(3.9 KiB) Not downloaded yet

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

I moved all functions to toolranks table. Mod developers can now support toolranks if they so wish :)
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [MOD] Tool ranks [toolranks]

by texmex » Post

Hi! Great game mechanic here. Like you say, it creates good incentive to repair existing tools.

One thing I found incoherent is that you can level up any tool by digging any node. I'd much more like if the tool leveled up based on the number of nodes dug that would normally add wear to it. For example, axes used on dirt doesn't wear them. Perhaps you just need to exclude nodes with group var oddly_breakable_by_hand from adding to the node dug count.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

texmex wrote:Hi! Great game mechanic here. Like you say, it creates good incentive to repair existing tools.

One thing I found incoherent is that you can level up any tool by digging any node. I'd much more like if the tool leveled up based on the number of nodes dug that would normally add wear to it. For example, axes used on dirt doesn't wear them. Perhaps you just need to exclude nodes with group var oddly_breakable_by_hand from adding to the node dug count.
Or maybe only count a node if it damages the tool to dig it. Will look into it.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

Only counts the nodes that spend the tool now. Enjoy. :)
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [MOD] Tool ranks [toolranks]

by texmex » Post

Yes, that's what I meant. Great, thanks!
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

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

Re: [MOD] Tool ranks [toolranks]

by cx384 » Post

The idea of this mod is not bad, but I think it is not good to use "minetest.override_item()" for such things ( you don't have to ), because this makes it difficult to add toolranks to all tool. Moreover, the new/changed description should dependence on the previous meta description, to avoid mod incompatibilities.
Can your read this?

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

cx384 wrote:The idea of this mod is not bad, but I think it is not good to use "minetest.override_item()" for such things ( you don't have to ), because this makes it difficult to add toolranks to all tool. Moreover, the new/changed description should dependence on the previous meta description, to avoid mod incompatibilities.
Alright, how would you do it then? I'm interested. I cannot edit the definitions of default tools, which only leaves me override_item.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

I could of course use register_on_dignode, but I'm not sure that would be a better method, because it would be called for every dig, not just the ones with the right tool.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

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

Re: [MOD] Tool ranks [toolranks]

by cx384 » Post

Yeah, thats what I think you should use.
Can your read this?

ABJ
Member
Posts: 3015
Joined: Sun Jan 18, 2015 13:02
GitHub: ABJ-MV
In-game: ABJ
Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.

Re: [MOD] Tool ranks [toolranks]

by ABJ » Post

Get this added into MTG!

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

I doubt they would accept it, comrade. But I can probably try.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
lisacvuk
Member
Posts: 274
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk
Location: Serbia, Užice

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Post

New feature: Will notify the player if tool is about to break.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)

User avatar
TenPlus1
Member
Posts: 2867
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [MOD] Tool ranks [toolranks]

by TenPlus1 » Post

Sweeeeeeeeeet, gonna add this to Xanadu :)

Post Reply

Who is online

Users browsing this forum: Steamed_Punk and 7 guests