Request to add API of getting user's mouse location on surface

seancheey
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Oct 14, 2020 9:47 am
Contact:

Request to add API of getting user's mouse location on surface

Post by seancheey »

Hi,

I suggest add a new API is LuaPlayer like this:
```
LuaPlayer.get_cursor_surface_location() -> Position
```
Or:

add a new surface_position parameter to user's custom input event that involves cursor clicking.

This makes a lot of operations possible, such as let player go to x,y location, or put a series of marker on ground base of user's cursor location.

Thanks
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Request to add API of getting user's mouse location on surface

Post by NotRexButCaesar »

+1
—Crevez, chiens, si vous n'étes pas contents!
Rseding91
Factorio Staff
Factorio Staff
Posts: 14627
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Request to add API of getting user's mouse location on surface

Post by Rseding91 »

Ok, I added "cursor_position" to all custom-input events.
If you want to get ahold of me I'm almost always on Discord.
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Request to add API of getting user's mouse location on surface

Post by NotRexButCaesar »

You guys are the best!
—Crevez, chiens, si vous n'étes pas contents!
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 615
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Request to add API of getting user's mouse location on surface

Post by raiguard »

This is amazing, and thank you!

While this will work for a huge variety of usecases, it won't work for my specific usecase: dragging. I'll still have to resort to using capsules (which don't work on the map view) in order to facilitate this.

The only way to suit my usecase would be to have an option to repeatedly fire the custom input if it is held down, so I can read changes in the position. So, I don't expect it to be possible, but may as well ask! Thank you again.
Don't forget, you're here forever.
Post Reply

Return to “Implemented mod requests”