Page 1 of 1

rightclick player menu?

Posted: Fri Feb 23, 2018 07:10
by theFox
How about a menu that pops up when you rightclick a player?

featuring:
  • whisper
  • give items
  • (admin) kick
  • (admin) peek/open inventory

Re: rightclick player menu?

Posted: Thu Apr 12, 2018 20:54
by PolySaken
This would be quite easy to implement with a server side mod. Redefine hand on_secondary_use to check if pointed_thing is a player. Then open a formspec with said options.

Re: rightclick player menu?

Posted: Fri Apr 13, 2018 14:43
by theFox
PolySaken wrote:This would be quite easy to implement with a server side mod.
I wanted to ask if anyone would appreciate this...

Re: rightclick player menu?

Posted: Fri Apr 13, 2018 21:30
by PolySaken
theFox wrote:I wanted to ask if anyone would appreciate this...
It would be a good idea for servers with no exchange/shop mods and for administrating players directly,
so I think some would.

Re: rightclick player menu?

Posted: Sat Apr 14, 2018 16:42
by MineYoshi
theFox wrote:I wanted to ask if anyone would appreciate this...
It would make the game a lot easier, specially the part of giving items.

Re: rightclick player menu?

Posted: Sun Apr 15, 2018 00:06
by PolySaken
MineYoshi wrote:
theFox wrote:I wanted to ask if anyone would appreciate this...
It would make the game a lot easier, specially the part of giving items.
Maybe the talk option could be used to add realism? a server could require players to be next to each other to talk.

Re: rightclick player menu?

Posted: Tue Apr 17, 2018 01:21
by MineYoshi
PolySaken wrote:
MineYoshi wrote:
theFox wrote:I wanted to ask if anyone would appreciate this...
It would make the game a lot easier, specially the part of giving items.
Maybe the talk option could be used to add realism? a server could require players to be next to each other to talk.
I find this quite annoying. Maybe an option to chat privately being close could be good, let's be honest, but being alone on a mine and not being able to ask someone for help truly isn't so funny at all.

Re: rightclick player menu?

Posted: Thu Apr 19, 2018 01:59
by sorcerykid
PolySaken wrote:This would be quite easy to implement with a server side mod. Redefine hand on_secondary_use to check if pointed_thing is a player. Then open a formspec with said options.
Sadly, it's not that easy. I attempted this about a year ago, but never got it to work using the existing API since right-click events are ignored for player objects. I ended up having to add an on_player_rightclick( ) callback to the engine.

From the source files below, you can see that server packet handler intercepts the event and calls the rightClick( ) method of the player object, which is no-op by default.

https://github.com/minetest/minetest/bl ... r.cpp#L987

https://github.com/minetest/minetest/bl ... ect.h#L141

Re: rightclick player menu?

Posted: Thu Apr 19, 2018 10:51
by PolySaken
sorcerykid wrote:
PolySaken wrote:This would be quite easy to implement with a server side mod. Redefine hand on_secondary_use to check if pointed_thing is a player. Then open a formspec with said options.
Sadly, it's not that easy. I attempted this about a year ago, but never got it to work using the existing API since right-click events are ignored for player objects. I ended up having to add an on_player_rightclick( ) callback to the engine.

From the source files below, you can see that server packet handler intercepts the event and calls the rightClick( ) method of the player object, which is no-op by default.

https://github.com/minetest/minetest/bl ... r.cpp#L987

https://github.com/minetest/minetest/bl ... ect.h#L141
on_secondary_use overrides other rightlick functions though, does it not?
Edit: sorry, I was wrong. apparently you can't overwrite the hand either.

Re: rightclick player menu?

Posted: Thu Apr 19, 2018 12:30
by hajo
PolySaken wrote:talk option .. server could require players to be next to each other to talk.
Maybe display a speech-balloon for private / line-of-sight talking ?

Or just craft a sign/book, and write on it...

Re: rightclick player menu?

Posted: Thu Apr 19, 2018 13:09
by sorcerykid
The on_secondary_use( ) callback is only triggered when the player is pointing at air. If you look further down in the CPP source of the packet handler, you can see it is a special case.

Re: rightclick player menu?

Posted: Sun Aug 26, 2018 20:40
by zeuner
theFox wrote:How about a menu that pops up when you rightclick a player?

featuring:
  • whisper
  • give items
  • (admin) kick
  • (admin) peek/open inventory
I like the idea, and I could imagine exciting possibilities of player-player interactions by this.

Re: rightclick player menu?

Posted: Sun Aug 26, 2018 20:43
by zeuner
sorcerykid wrote:
PolySaken wrote:This would be quite easy to implement with a server side mod. Redefine hand on_secondary_use to check if pointed_thing is a player. Then open a formspec with said options.
Sadly, it's not that easy. I attempted this about a year ago, but never got it to work using the existing API since right-click events are ignored for player objects. I ended up having to add an on_player_rightclick( ) callback to the engine.

From the source files below, you can see that server packet handler intercepts the event and calls the rightClick( ) method of the player object, which is no-op by default.

https://github.com/minetest/minetest/bl ... r.cpp#L987

https://github.com/minetest/minetest/bl ... ect.h#L141
Do you happen to have a pull request opened for the engine addition? I don't think it's justified to only be able to set "on_rightclick" handlers for non-player objects.

Re: rightclick player menu?

Posted: Mon Aug 27, 2018 13:22
by sorcerykid
Here are the changes I made to the engine, with git patches for Minetest 0.4.15 and up: viewtopic.php?f=7&t=20722

Usage is similar to that of Lua entities, except it's a global callback.
  • minetest.register_on_rightclickplayer(func(player, clicker))
I hope you find it useful on your server!

Re: rightclick player menu?

Posted: Tue Aug 28, 2018 10:28
by zeuner
sorcerykid wrote:Here are the changes I made to the engine, with git patches for Minetest 0.4.15 and up: viewtopic.php?f=7&t=20722

Usage is similar to that of Lua entities, except it's a global callback.
  • minetest.register_on_rightclickplayer(func(player, clicker))
I hope you find it useful on your server!
Great, thanks!

I'm mostly doing minetest development for allowing people to run the modifications on their servers. So I would still think it would be a valuable contribution to let the patch find its way into the officially distributed server source.

Re: rightclick player menu?

Posted: Wed Sep 05, 2018 22:43
by Byakuren
Is item on_place triggered when pointing at players?

Re: rightclick player menu?

Posted: Tue Sep 11, 2018 14:33
by zeuner
theFox wrote:How about a menu that pops up when you rightclick a player?

featuring:
  • whisper
  • give items
  • (admin) kick
  • (admin) peek/open inventory
Regarding giving items, you might be interested in a mod I started on: https://github.com/zeuner/structured_communication. It's about giving items to another player in exchange for other items.

Re: rightclick player menu?

Posted: Fri Aug 28, 2020 19:05
by emperor_genshin
Made my own solution to this for the time being without the need to fiddle with core: https://notabug.org/Genshin/p2p

Example using this mod:

Code: Select all


p2p.register_on_right_clickplayer(function(clicker, clicked)

    minetest.chat_send_player(clicker:get_player_name(), "Right Clicked "..tostring(clicked:get_player_name()))

end)

Wiki: https://notabug.org/Genshin/p2p/wiki/How+to+use+the+api

Example Video: https://www.youtube.com/watch?v=PtzILeR0eWs

Re: rightclick player menu?

Posted: Fri Aug 28, 2020 20:22
by sorcerykid
zeuner wrote:I'm mostly doing minetest development for allowing people to run the modifications on their servers. So I would still think it would be a valuable contribution to let the patch find its way into the officially distributed server source.
I have a PR in review which incorporates the patch I shared above. Hopefully it will be merged into 5.4.

https://github.com/minetest/minetest/pull/9569

Re: rightclick player menu?

Posted: Tue Sep 01, 2020 11:49
by runs
sorcerykid wrote:
Fri Aug 28, 2020 20:22
zeuner wrote:I'm mostly doing minetest development for allowing people to run the modifications on their servers. So I would still think it would be a valuable contribution to let the patch find its way into the officially distributed server source.
I have a PR in review which incorporates the patch I shared above. Hopefully it will be merged into 5.4.

https://github.com/minetest/minetest/pull/9569
I hope that this is the case, for me it is fundamental, for the interaction with NPCs and other players without being by commands. For example, right now I have in mind to share objects between inventories.

Re: rightclick player menu?

Posted: Tue Sep 01, 2020 15:00
by runs
I am thinking on pickpocketing too, as in Skyrim.

Re: rightclick player menu?

Posted: Tue Sep 01, 2020 15:15
by runs
emperor_genshin wrote:
Fri Aug 28, 2020 19:05
Made my own solution to this for the time being without the need to fiddle with core: https://notabug.org/Genshin/p2p

Example using this mod:

Code: Select all


p2p.register_on_right_clickplayer(function(clicker, clicked)

    minetest.chat_send_player(clicker:get_player_name(), "Right Clicked "..tostring(clicked:get_player_name()))

end)

Wiki: https://notabug.org/Genshin/p2p/wiki/How+to+use+the+api

Example Video: https://www.youtube.com/watch?v=PtzILeR0eWs
I will use It for my pickpocketing mod.