Viewport

Place to get help with not working mods / modding interface.
Post Reply
Incinirate
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sun May 03, 2015 9:50 pm
Contact:

Viewport

Post by Incinirate »

So, I've been looking all over the wiki trying to figure out how to get the active player's viewport (for reference for placing GUI elements) and can't find anything. Does anyone know how to do this? Or if its even possible with the current modding interface?
EDIT: More accurately, I'm looking for a way to figure out how many blocks are viewable in the screen at any given moment.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13232
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Viewport

Post by Rseding91 »

Incinirate wrote:So, I've been looking all over the wiki trying to figure out how to get the active player's viewport (for reference for placing GUI elements) and can't find anything. Does anyone know how to do this? Or if its even possible with the current modding interface?
EDIT: More accurately, I'm looking for a way to figure out how many blocks are viewable in the screen at any given moment.
I believe you can loop over the GUI elements of the player using something like:

(untested)

Code: Select all

for k,v in pairs(game.getplayer(1).gui.top) do game.getplayer(1).print(v.name) end
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding help”