[Mod] Node Information on_punch [punchinfo]

Post Reply
User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

[Mod] Node Information on_punch [punchinfo]

by octacian » Post

Image

Node Information on_punch [punchinfo]
This is another fairly simple utility mod, but it can serve a very useful purpose. PunchInfo was originally inspired by azekill_DIABLO's NodeExploror mod. However, NodeExplorer was lacking in several areas, and since it wasn't on GitHub, I decided to start over from scratch.

The concept of PunchInfo is very simple, whenever a player left-clicks (i.e. punches) a node, information about that node is shown. This information includes the description, itemstring, top texture, light emission level, drawtype, and groups. The HUD is removed after 2 seconds (configurable in minetest.conf with punchnode.hud_show_time, integer). This can also be configured per-player via the chatcommand.

If you find the HUD to be too big, it can be configured to one of three sizes in minetest.conf with punchnode.hud_size. The HUD size can be set to one of three integers, 1, 2, or 3 (2 is default).

Chatcommand
The HUD can be managed and customized per-player with the /punchinfo command. This single command accepts several parameters, as seen below.

clear: Clears custom configuration for the player (show time, size, etc...)
get <key>: Gets HUD information (e.g. size)
enable: Enables the PunchInfo HUD
disable: Disables the PunchInfo HUD
time <integer>: Sets the time before the HUD is hidden
size <integer>: Sets the HUD size to 1, 2, or 3
Last edited by octacian on Tue Jan 17, 2017 05:47, edited 5 times in total.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
Desour
Member
Posts: 1469
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] Node Information on_punch [punchinfo]

by Desour » Post

Is the information sent to all players on server, I hope and assume not. Can it be disabled by player in game for him/herself?
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Node Information on_punch [punchinfo]

by octacian » Post

DS-minetest wrote:Is the information sent to all players on server, I hope and assume not. Can it be disabled by player in game for him/herself?
No. It is only sent to the player who punched the node. I'm working on a screenshot, which will be up soon. I hadn't thought about disabling it per-player, will do.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Node Information on_punch [punchinfo]

by octacian » Post

Added command to enable or disable PunchInfo HUD per-player. See original post.

Screenshot posted.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

scottvee
Member
Posts: 18
Joined: Thu Jan 12, 2017 07:59
In-game: scottvee

Re: [Mod] Node Information on_punch [punchinfo]

by scottvee » Post

Well that would be easier than reading everyone's source code to see specific properties of things. Will try it out. ;-)

scottvee
Member
Posts: 18
Joined: Thu Jan 12, 2017 07:59
In-game: scottvee

Re: [Mod] Node Information on_punch [punchinfo]

by scottvee » Post

Hi Octacian. I got an odd error when punching one of my own blocks. You can see from the F5 debug readout that the fields are filled in, but after a punch I get an error that "tiles" is nil.

Image

Here is definition of my node:

minetest.register_node("fall_stones:fall_cobble", {
description = "Fall Cobble",
light_source = fall_stones_debug_light,
tiles = {"default_cobble.png"},
groups = {cracky=2, falling_node = 1, stone=2},
sounds = default.node_sound_sand_defaults(),
drop = 'default:gravel'
})

It does have a tiles property.

Seemed a bit odd, thought I should send it along.

User avatar
mahmutelmas06
Member
Posts: 367
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: [Mod] Node Information on_punch [punchinfo]

by mahmutelmas06 » Post

thank you for this mod
Hud is too big. You need to make it smaller.
My Mods:

Beverage

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Node Information on_punch [punchinfo]

by octacian » Post

scottvee wrote:Hi Octacian. I got an odd error when punching one of my own blocks. You can see from the F5 debug readout that the fields are filled in, but after a punch I get an error that "tiles" is nil.
Thanks for sending the code for your node. Just tested with the code, and didn't have any issues. Maybe try updating the mod as I may have pushed amendments to a commit fixing that issue, can't remember. Anyway, download the mod again and try it, if there's still an issue. I'll see if I can rewrite the code for getting the texture.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Node Information on_punch [punchinfo]

by octacian » Post

mahmutelmas06 wrote:thank you for this mod
Hud is too big. You need to make it smaller.
I'm working on adding an option allowing you to choose between 3 different sizes. The medium size will become default. After that, I will allow players to configure the show time and HUD size for themselves, rather than applying the same to all players.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] Node Information on_punch [punchinfo]

by octacian » Post

Added 3 configurable HUD sizes and commands allowing each player to customize their own HUD. Also fixed the bug mentioned near the end of the video (linked in OP) where the HUD would be hidden immediately after punching blocks quickly. See original post and video for more info.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests