On mouseover

golthem
Member
 
Posts: 43
Joined: Tue Jan 21, 2014 20:22
In-game: Golthem

On mouseover

by golthem » Tue May 20, 2014 22:24

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?
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

Re: On mouseover

by mauvebic » Wed May 21, 2014 01:47

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.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: On mouseover

by kaeza » Wed May 21, 2014 09:01

Such a callback would have a high performance cost. It would be handling a mouseover event for every node every player looks at.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: On mouseover

by rubenwardy » Wed May 21, 2014 10:18

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.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: On mouseover

by kaeza » Wed May 21, 2014 10:27

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.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: On mouseover

by rubenwardy » Wed May 21, 2014 11:24

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.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 11 guests

cron