[MOD] Tool Ranks and Modifiers [lib_trm][git]

ShadMOrdre
Member
 
Posts: 523
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

[MOD] Tool Ranks and Modifiers [lib_trm][git]

by ShadMOrdre » Fri Sep 06, 2019 22:54

What is Tool Ranks and Modifiers?

This mod simply combines the two wonderful mods, toolranks (by lisacvuk) and c-t-m (by davidthecreator).

I have tested this on MT v5.0.1. Due to the on_mods_loaded call, it will not work on previous versions. However, do not worry. If a version of this mod for MT previous versions is in high enough demand, I can repost previous versions which may have worked. Whatever version of MT you use must support the register_on_crafted API function for the craft modifiers to work, and must support the on_mods_loaded API function, for the overrides to take effect. Due to this function call, and the inability to check MT versions, this may crash previous versions of MT.

In order to avoid both dependency nightmares, and to avoid requiring mods to specifically modify tool registration code or add dependencies, this mod was born.

This mod has no dependencies, nor requires any recoding or dependency by mods using this functionality. This mod uses the on_mods_loaded function to override all registered tools to add the above functionality. If there are any specific mods for which I should disable the override, please let me know.

If you experience any issues, please let me know. Also, if you like this mod, please, drop a line.


DOWNLOAD and SOURCE: lib_trm

Image
Image
Image
Attachments
screenshot_20190906_155920.jpg
(244.39 KiB) Not downloaded yet
screenshot_20190906_155913.jpg
(246.03 KiB) Not downloaded yet
screenshot_20190906_155858.jpg
(230.1 KiB) Not downloaded yet
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

User avatar
runs
Member
 
Posts: 794
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by runs » Sat Sep 07, 2019 23:38

Translation support. Toolranks used descriptions to identify items, so no internationalization possible.
 

ShadMOrdre
Member
 
Posts: 523
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by ShadMOrdre » Sun Sep 08, 2019 07:09

I've updated this mod to use 1 of 3 available translation modes.

Enabled, by default, is an optional dependency on intllib mod. This is to maintain backwards compatibility.

If intllib mod is not installed or enabled, then lib_trm will fall back to an included intllib.lua module. As a native English speaker, I would need assistance if translations are needed.

To enable the MT v5.0+ built in translation module, go to the settings menu for lib_trm, and enable support there. Please note, that while I've used the intllib modules in previous mods, I am not yet familiar with the new builtin translation functionality, and this might be buggy.

Please let me know if this helps. It's also possible to apply the translation function around the description texts, but translations are already a tricky thing, so this might also need work.

Please report any issues, suggestions, or complaints. Thanks in advance.

Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

ThorfinnS
Member
 
Posts: 133
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by ThorfinnS » Tue Sep 10, 2019 04:15

I got a report from players (and confirmed it) that if you "repair" a pickaxe by creating a new pickaxe, then "merge" the worn out pick and the new pick, the property "disappears" after mining one node. I think it's only the description, though. In testing, I got a demonic stone shovel, and when digging stone, it was making the sound one gets from a pick going at stone, even though the description dropped back to regular old stone shovel. I made another stone shovel, and this one didn't do the same sound, and had no modifier. It also reported back 0 nodes dug, though the very next node dug said 120 or whatever nodes. Makes sense, I guess, since it looks like it's creating a new tool, rather than just updating the use count on an existing tool.

Repair seems to retain the properties, but not the description.

Might be one of the several dozen mods I have loaded, though. I have toolranks disabled, and don't have c-t-m- downloaded at all. Might also be the check to see if toolranks exists, rather than is enabled, I suppose.

[EDIT]
Oh, and the stone hoe I tried out made no sound at all before it broke. With Toolranks, it gives at least two warning sounds that it's going to break.
[/EDIT]
 

ThorfinnS
Member
 
Posts: 133
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by ThorfinnS » Wed Sep 11, 2019 18:02

Here's what I'm talking about.

has-props.png
Pick has properties
(18.9 KiB) Not downloaded yet


one-use.png
...after digging one stone block,
(17.64 KiB) Not downloaded yet


first.png
...there's no longer properties in the hover.
(13.77 KiB) Not downloaded yet
 

ShadMOrdre
Member
 
Posts: 523
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by ShadMOrdre » Mon Sep 16, 2019 23:01

ThorfinnS,

Yes, I've encountered this issue. Thank you for reporting.

I've got this fixed, just not in a way that I am comfortable with, ie, there are still "issues" regarding the tooltips and the way they are managed. With a little more integration between the two mods, the issues will go away. Note, due to the way that the description field is handled, there will continue to be issues with other mods that directly write the description, without accommodating the existing description. Those mods will need to be updated to correctly write the descriptions, without overwriting what any other mod may be adding to a tools description.

I also want to attempt creating armor modifiers, but I'll wait until after I post this update.

Again, thanks for your reporting.

Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

ShadMOrdre
Member
 
Posts: 523
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by ShadMOrdre » Tue Sep 24, 2019 05:13

I am happy to announce this update.

Tools now maintain the description field across level ups. Tools and armor both benefit from the tool ranks code. At this time, only tools use the modifiers. Included in this update, is a function that overrides defined tools and armor, to now use the tool ranks and modifiers code. For mods that have already hard-coded support for toolranks mod, they will be ignored by this mod, but can still use the toolranks namespace from this mod. For any mod that defines either tools or armor, and that does not provide support for toolranks, those tools and armors will be overridden to use this mod.

Tool repair is correctly handled via the anvil mod, or the anvil found in the cottages mod. Both anvils correctly repair the wear value of the existing itemstack, thus, the tool is repaired, not replaced, and retains it's modifers and levels. As a game play mechanic, this should be preferred to tool repair recipes for the craft grid.

Tool repair via the crafting grid will never work, because, technically, the worn/damaged tools are not repaired, but are instead used to craft a new tool from the worn/damaged existing tools. The new tool takes on default values, since it is a new itemstack from the craft grid. This is not something that can be corrected easily, from within a mod. IMO, I'm not entirely sure that tool repair recipes for the craft grid are the right way to "fix" damaged tools, from a game play mechanics perspective. Either way, I will not address or try to accommodate tool repair via the crafting grid due this issue.

Armor modifiers are still on my TO DO list.

Please let me know if the resolves the existing issues, sans the craft grid repair issue.

DOWNLOAD: lib_trm


Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

User avatar
Lone_Wolf
Member
 
Posts: 2186
Joined: Sun Apr 09, 2017 05:50
Location: Hopefully very far from yours, snoop :P
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by Lone_Wolf » Thu Oct 03, 2019 20:02

When repairing tools via the crafting grid just copy over the attributes from the highest ranking tool?
 

ThorfinnS
Member
 
Posts: 133
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by ThorfinnS » Fri Oct 04, 2019 03:55

Never mind. I thought for sure I had disabled toolranks to give this a whirl, but not so much...
 

Skamiz Kazzarch
Member
 
Posts: 80
Joined: Fri Mar 09, 2018 20:34
Location: la lojbaugag.
GitHub: Skamiz
In-game: Skamiz

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by Skamiz Kazzarch » Fri Oct 04, 2019 08:00

Letest version of trm, latest version of minetest, fresh world with only this mod enabled 2019-10-04 09:56:16: ACTION[Server]: singleplayer joins game. List of players: singleplayer
Code: Select all
2019-10-04 09:56:19: ACTION[Server]: singleplayer digs default:snow at (298,6,156)
2019-10-04 09:56:19: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback node_on_dig(): ...ames\minetest\bin\..\mods\lib_trm/lib_trm_tool_ranks.lua:81: attempt to concatenate local 'itemdesc' (a nil value)
2019-10-04 09:56:19: ERROR[Main]: stack traceback:
2019-10-04 09:56:19: ERROR[Main]:    ...ames\minetest\bin\..\mods\lib_trm/lib_trm_tool_ranks.lua:81: in function 'after_use'
2019-10-04 09:56:19: ERROR[Main]:    C:\Games\minetest\bin\..\builtin\game\item.lua:569: in function <C:\Games\minetest\bin\..\builtin\game\item.lua:537>
2019-10-04 09:56:19: ACTION[Server]: singleplayer leaves game. List of players:
2019-10-04 09:56:19: ACTION[Main]: Server: Shutting down

Edit:
Un-comenting line 53 in init.lua seems to have fixed it.
 

ThorfinnS
Member
 
Posts: 133
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by ThorfinnS » Fri Oct 04, 2019 16:50

Thanks, Skamiz Kazzarch. That's the same message I was getting, and lisacvuk's toolranks WAS disabled. (I was looking at the wrong game setup.)

Might be something to do with all the warnings lib_trm is throwing on load. Undefined globals, IIRC. An undefined global would likely explain the attempting to concatenate a nil value error.
 

ShadMOrdre
Member
 
Posts: 523
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [MOD] Tool Ranks and Modifiers [lib_trm][git]

by ShadMOrdre » Fri Oct 04, 2019 18:36

Thanks for reporting this.

I had ran into this, late one night, fixed it, but didn't push the fix.

I have corrected this on Github, and noticed, in the process, that there may still be issues with how descriptions and the toolranks original_description are handled. While all seems to work, at the moment, there may still be issues around this. I will make some minor changes to the code, which should not affect the current functionality, but will help to eliminate error messages popping up from an inconsistent method of determining the description and original_description itemstack definitions.

Again, this should not affect current functionality. This will only be to help eliminate potential future error messages, especially from mods that use the description field, but are not "tool" mods, like the vendors. This won't fix the other issues related to those mods, as those mods have to be updated to read/write the descriptions of itemstacks in a way that won't overwrite the existing itemstack description.

As always, thank you for reporting and all the other feedback.

Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 


Return to WIP Mods



Who is online

Users browsing this forum: MSN [Bot] and 3 guests