Page 1 of 1

On mouseover

PostPosted: Tue May 20, 2014 22:24
by golthem
I'm working on a mod and was wondering if there was something in the API that let's you do a bit of code when "mousing over" a node. I've looked over and over the API but all I've found is the get_look code. Is this what I'm looking for?

Re: On mouseover

PostPosted: Wed May 21, 2014 01:47
by mauvebic
You probably want to look at the sign/infotext code in the engine source since that shows a bit of text when mousing over them.

Re: On mouseover

PostPosted: Wed May 21, 2014 09:01
by kaeza
Such a callback would have a high performance cost. It would be handling a mouseover event for every node every player looks at.

Re: On mouseover

PostPosted: Wed May 21, 2014 10:18
by rubenwardy
kaeza wrote:Such a callback would have a high performance cost. It would be handling a mouseover event for every node every player looks at.


It could be filtered. Ie, only send mouse over a for test:node nodes.

You could make it so the player stares at the block for two seconds before the event is caused.

Re: On mouseover

PostPosted: Wed May 21, 2014 10:27
by kaeza
rubenwardy wrote:It could be filtered. Ie, only send mouse over a for test:node nodes.

You could make it so the player stares at the block for two seconds before the event is caused.

And how do you tell the client for what nodes it should send "I'm looking at you, node" packets and for which it shouldn't?

For the 2 second thing, you can get the same effect by defining a node timer/global step and using get_line_of_sight() or some get_look_dir() magic.

Re: On mouseover

PostPosted: Wed May 21, 2014 11:24
by rubenwardy
kaeza wrote:
rubenwardy wrote:It could be filtered. Ie, only send mouse over a for test:node nodes.

You could make it so the player stares at the block for two seconds before the event is caused.


And how do you tell the client for what nodes it should send "I'm looking at you, node" packets and for which it shouldn't?

For the 2 second thing, you can get the same effect by defining a node timer/global step and using get_line_of_sight() or some get_look_dir() magic.

I meant client side cpp code fore both points. Server tells client what to send. Would require protocol bump, maybe.