rightclick player menu?

User avatar
theFox
Member
 
Posts: 163
Joined: Sun Feb 12, 2017 14:08
Location: Germany
GitHub: theFox6
In-game: theFox

rightclick player menu?

by theFox » Fri Feb 23, 2018 07:10

How about a menu that pops up when you rightclick a player?

featuring:
  • whisper
  • give items
  • (admin) kick
  • (admin) peek/open inventory
my mods and subgames (ง'̀-'́)ง
 

User avatar
PolySaken
Member
 
Posts: 270
Joined: Thu Nov 09, 2017 05:18
Location: djelibabi
GitHub: PolySaken-I-Am
In-game: PolySaken

Re: rightclick player menu?

by PolySaken » Thu Apr 12, 2018 20:54

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.
 

User avatar
theFox
Member
 
Posts: 163
Joined: Sun Feb 12, 2017 14:08
Location: Germany
GitHub: theFox6
In-game: theFox

Re: rightclick player menu?

by theFox » Fri Apr 13, 2018 14:43

PolySaken wrote:This would be quite easy to implement with a server side mod.

I wanted to ask if anyone would appreciate this...
my mods and subgames (ง'̀-'́)ง
 

User avatar
PolySaken
Member
 
Posts: 270
Joined: Thu Nov 09, 2017 05:18
Location: djelibabi
GitHub: PolySaken-I-Am
In-game: PolySaken

Re: rightclick player menu?

by PolySaken » Fri Apr 13, 2018 21:30

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.
 

User avatar
MineYoshi
Member
 
Posts: 5354
Joined: Wed Jul 08, 2015 13:20

Re: rightclick player menu?

by MineYoshi » Sat Apr 14, 2018 16:42

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.
nire patata zurea da, kide :-)
 

User avatar
PolySaken
Member
 
Posts: 270
Joined: Thu Nov 09, 2017 05:18
Location: djelibabi
GitHub: PolySaken-I-Am
In-game: PolySaken

Re: rightclick player menu?

by PolySaken » Sun Apr 15, 2018 00:06

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.
 

User avatar
MineYoshi
Member
 
Posts: 5354
Joined: Wed Jul 08, 2015 13:20

Re: rightclick player menu?

by MineYoshi » Tue Apr 17, 2018 01:21

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.
nire patata zurea da, kide :-)
 

User avatar
sorcerykid
Member
 
Posts: 852
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: rightclick player menu?

by sorcerykid » Thu Apr 19, 2018 01:59

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
 

User avatar
PolySaken
Member
 
Posts: 270
Joined: Thu Nov 09, 2017 05:18
Location: djelibabi
GitHub: PolySaken-I-Am
In-game: PolySaken

Re: rightclick player menu?

by PolySaken » Thu Apr 19, 2018 10:51

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.
 

hajo
Member
 
Posts: 595
Joined: Thu Oct 13, 2016 10:45
Location: DE

Re: rightclick player menu?

by hajo » Thu Apr 19, 2018 12:30

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...
 

User avatar
sorcerykid
Member
 
Posts: 852
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: rightclick player menu?

by sorcerykid » Thu Apr 19, 2018 13:09

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.
 

zeuner
Member
 
Posts: 23
Joined: Fri Dec 01, 2017 20:09
GitHub: zeuner

Re: rightclick player menu?

by zeuner » Sun Aug 26, 2018 20:40

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.
 

zeuner
Member
 
Posts: 23
Joined: Fri Dec 01, 2017 20:09
GitHub: zeuner

Re: rightclick player menu?

by zeuner » Sun Aug 26, 2018 20:43

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.
Last edited by zeuner on Mon Aug 27, 2018 17:35, edited 1 time in total.
 

User avatar
sorcerykid
Member
 
Posts: 852
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: rightclick player menu?

by sorcerykid » Mon Aug 27, 2018 13:22

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!
 

zeuner
Member
 
Posts: 23
Joined: Fri Dec 01, 2017 20:09
GitHub: zeuner

Re: rightclick player menu?

by zeuner » Tue Aug 28, 2018 10:28

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.
 

Byakuren
Member
 
Posts: 812
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: rightclick player menu?

by Byakuren » Wed Sep 05, 2018 22:43

Is item on_place triggered when pointing at players?
Every time a mod API is left undocumented, a koala dies.
 

zeuner
Member
 
Posts: 23
Joined: Fri Dec 01, 2017 20:09
GitHub: zeuner

Re: rightclick player menu?

by zeuner » Tue Sep 11, 2018 14:33

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.
 


Return to Feature Discussion



Who is online

Users browsing this forum: No registered users and 4 guests