game.player.cursorposition should be relative

Things that we aren't going to implement
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

game.player.cursorposition should be relative

Post by Adil »

Currently this field stores absolute value that depends on the game window size, which seems impossible to determine.
It'd be more useful if we could obtain the cursor position in screen units (e.g. cursor.x/window_width). Maybe even with character being reference point.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

Re: game.player.cursorposition should be relative

Post by jeroon »

do these help?

screen2realposition
Translate screen coordinates (position relative to the left top edge of the window) to the map coordinates (what is the map position of the place under the cursor).
real2screenposition
Translate map coordinates to screen coordinates.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14345
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: game.player.cursorposition should be relative

Post by Rseding91 »

See also: https://forums.factorio.com/forum/vie ... f=7&t=5917

So, take care if you're going to use that method :) It might not exist forever.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: game.player.cursorposition should be relative

Post by Adil »

jeroon wrote:do these help?
snip
Well, those definitely could be used to pile up a function that achieves the same goal, but I wouldn't want to use it on each tick if a simple table field lookup was possible.
Rseding91 wrote:See also: https://forums.factorio.com/forum/vie ... f=7&t=5917

So, take care if you're going to use that method :) It might not exist forever.
Aww. That's sad. Those were nice way of making custom controls in the mods.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14345
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: game.player.cursorposition should be relative

Post by Rseding91 »

Adil wrote:Aww. That's sad. Those were nice way of making custom controls in the mods.
After reading their response I don't think the methods are going anywhere but they definitely won't be compatible with MP/replays so you'll want to keep that in mind if you do use them.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Won't implement”