Page 1 of 1

[Mod] Node Information on_punch [punchinfo]

PostPosted: Sun Jan 15, 2017 18:52
by octacian
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

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Sun Jan 15, 2017 18:56
by DS-minetest
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?

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Sun Jan 15, 2017 18:58
by octacian
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.

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Sun Jan 15, 2017 20:01
by octacian
Added command to enable or disable PunchInfo HUD per-player. See original post.

Screenshot posted.

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Mon Jan 16, 2017 09:27
by scottvee
Well that would be easier than reading everyone's source code to see specific properties of things. Will try it out. ;-)

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Mon Jan 16, 2017 09:42
by scottvee
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.

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Mon Jan 16, 2017 13:00
by mahmutelmas06
thank you for this mod
Hud is too big. You need to make it smaller.

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Mon Jan 16, 2017 16:09
by octacian
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.

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Tue Jan 17, 2017 01:09
by octacian
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.

Re: [Mod] Node Information on_punch [punchinfo]

PostPosted: Tue Jan 17, 2017 05:49
by octacian
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.