[Mod] Unified Hammers (to crush nodes) [uniham]

User avatar
Linuxdirk
Member
 
Posts: 1998
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

[Mod] Unified Hammers (to crush nodes) [uniham]

by Linuxdirk » Tue Jun 11, 2019 00:41

Unified Hammers adds various hammers that can be used to crush nodes.

Usage


The mod registers various hammers. Those hammers can be crafted from sticks and their respective material. Different material hammers can be used different times before they break.

Image

Crafting the hammers needs two sticks and two of the material as shown in the image above. Crafting is then done very similar to the other tools.

Image

The recipe shape is always the same, just interchange the head material. If the moreores mod is installed and loaded hammers can be crafted from the mod’s ores in the same way as shown above.

Functionality


The hammers added by this mod can be used to crush material into “softer” material.

Image

The three default sandstone types can be crushed into the corresponding three default sand types, too.

Durability ranges from 30 uses (wooden hammer) to obsidian (400 uses). If installed, moreores’ Mithril allows 450 uses.

Mod Meta


License: GPLv3 for code, CC-BY-SA for media
Dependencies: default (Minetest >= 5.0.0)
Download latest version: uniham-master.zip
Source/issues/etc.: GitLab
Translations: English (default) and German
 

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

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by texmex » Tue Jun 11, 2019 07:31

Sweet! Is it on it's way into the content database?

I think the hammer heads can be improved visually by overlaying a soft embossing, similar to the look of the stick.
 

User avatar
Linuxdirk
Member
 
Posts: 1998
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by Linuxdirk » Tue Jun 11, 2019 14:02

texmex wrote:Sweet! Is it on it's way into the content database?

Of course it is :) As soon as it was approved it will become visible.

texmex wrote:I think the hammer heads can be improved visually by overlaying a soft embossing, similar to the look of the stick.

Currently I use a mask on the corresponding block nodes of the head material. I wonder how to get anti-aliased edges with this technique …
 

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

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by texmex » Tue Jun 11, 2019 14:44

How about applying this overlay, but with something like 10% opacity?
Attachments
emboss.png
(150 Bytes) Not downloaded yet
 

User avatar
Linuxdirk
Member
 
Posts: 1998
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by Linuxdirk » Wed Jun 12, 2019 19:08

How such a small change has such a huge impact (needs to be configurable and some tweaking though). Thanks for the idea, the hammer heads are now slightly embossed. New version on GitLab or when pushed through CDB.
 

User avatar
Linuxdirk
Member
 
Posts: 1998
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by Linuxdirk » Thu Jun 13, 2019 16:06

Okay, done, the embossing effect is now configurable (opacity) on hammer registration. This results in a small API change. The head definition now needs a table.

Before:

Code: Select all
uniham.register_hammer('my_cool_id', {
    name = 'My Cool Hammer',
    head = 'mymod_my_cool_head_base_texture.png',
    --- Alternative to `head`, see API documentation
    -- texture = 'mymod_my_cool_hammer_texture.png',
    craft = 'mymod:my_cool_item',
    uses = 200
})

After:

Code: Select all
uniham.register_hammer('my_cool_id', {
    name = 'My Cool Hammer',
    head = {
        texture = 'mymod_my_cool_head_base_texture.png',
        opacity = 51.2
    }
    --- Alternative to `head`, see API documentation
    -- texture = 'mymod_my_cool_hammer_texture.png',
    craft = 'mymod:my_cool_item',
    uses = 200
})

opacity is a value between 0 and 255. When omitted it defaults to 51.2 (20% visible).

Image

No hammer mechanics were changed. This change is only a visual change and a small API change.
 

User avatar
bosapara
Member
 
Posts: 485
Joined: Fri Apr 07, 2017 08:49
GitHub: bosapara

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by bosapara » Fri Jun 14, 2019 19:17

Good, reminds me "ex nihilo" from MC. Awesome for skyblock.

Created almost the same, just for fun:

Image
 

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

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by ThorfinnS » Thu Jun 20, 2019 19:51

I think I accidentally hit the block that starts the rope in Ropes mod.

Code: Select all
2019-06-20 14:48:27: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'uniham' in callback item_OnUse(): ...test\mt510-38b\bin\..\mods\uniham\system\crush_nodes.lua:35: attempt to index local 'node_sounds' (a nil value)
2019-06-20 14:48:27: ERROR[Main]: stack traceback:
2019-06-20 14:48:27: ERROR[Main]:    ...test\mt510-38b\bin\..\mods\uniham\system\crush_nodes.lua:35: in function <...test\mt510-38b\bin\..\mods\uniham\system\crush_nodes.lua:28>


[EDIT]
Yep. Confirmed that's what happened.

Any chance of adding toolranks support? Nice to have that audible cue as the implement nears it's breaking point.
[/EDIT]
 

User avatar
Linuxdirk
Member
 
Posts: 1998
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by Linuxdirk » Fri Jun 21, 2019 05:17

Seems like the rope mod does not add sounds to the node as expected. I'll try to work around this in a general manner.

ThorfinnS wrote:Any chance of adding toolranks support?

I'll try. Since the hammers are registered as tools only to be able to add wear (no tool capabilities are used, it is really just a tool because wear can't be added to a normal item and what the hammer does is not doable with default tools, i.e. replacing nodes is not possible) I wonder how toolranks would handle this, because there is no way to extend the uses or make the hammer stronger, or whatever else the mod does.
Last edited by Linuxdirk on Sat Jun 22, 2019 11:09, edited 1 time in total.
 

User avatar
Linuxdirk
Member
 
Posts: 1998
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: [Mod] Unified Hammers (to crush nodes) [uniham]

by Linuxdirk » Sat Jun 22, 2019 11:08

Quick update. The crash when using the hammer on the rope starting node is fixed. The issue causing the crash was fixed in general and the updated version is available on GitLab and will be pushed through CDB soon (check for updates there).

Unfortunately the toolranks mod can’t be supported for the reason I assumed: hammers do not have tool capabilities and do not dig any nodes. The wear is not added through default tool functionality but via custom function. Mainly because of what the hammers do is not possible with default tool definitions (i.e. replace nodes and precisely configure uses).

Toolranks will always see 0 digged nodes (because there aren’t any nodes digged) and the after_use function is never triggered.
 


Return to WIP Mods



Who is online

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