Set "Grid position" of blueprints

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
GlassBricks
Inserter
Inserter
Posts: 25
Joined: Fri Jun 11, 2021 5:20 pm
Contact:

Set "Grid position" of blueprints

Post by GlassBricks »

Currently (v1.1.35) there is no way to read/write the "Grid position" setting of blueprints from lua (on LuaItemStack). Could we get this feature?

There is an older forum post on this topic viewtopic.php?f=28&t=96815 marked "solved", but it only describes only a workaround.

curiosity
Filter Inserter
Filter Inserter
Posts: 315
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Set "Grid position" of blueprints

Post by curiosity »

Grid position doesn't really exist. It gets calculated from the entity positions. And when you change it in the blueprint GUI, entities are shifted.

GlassBricks
Inserter
Inserter
Posts: 25
Joined: Fri Jun 11, 2021 5:20 pm
Contact:

Re: Set "Grid position" of blueprints

Post by GlassBricks »

Oh, so to change the "grid position" I would edit the positions of all the blueprint entities.

A get/set_grid_position still could be useful, though.
But even if not implemented, at least the grid position behavior should be documented somewhere.

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Set "Grid position" of blueprints

Post by Qon »

Please tell us if you can get it to work that way or not, I'm curious and would like to know in case I have to do the same in a possible future mod!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Set "Grid position" of blueprints

Post by eradicator »

Qon wrote:
Mon Jul 12, 2021 5:30 pm
Please tell us if you can get it to work that way or not, I'm curious and would like to know in case I have to do the same in a possible future mod!
I don't really understand what exactly "grid position" is supposed to be. Is it just a way of saying "not centered on the red flag"? In Eradicator's Belt Planner I successfully managed to put a blueprint of the current preview into the players hands without it visually changing position. So it's definetly possible.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

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

Re: Set "Grid position" of blueprints

Post by NotRexButCaesar »

eradicator wrote:
Thu Jul 22, 2021 6:53 pm
I don't really understand what exactly "grid position" is supposed to be. Is it just a way of saying "not centered on the red flag"?
Grid position is just an offset from the cursor when placing the blueprint. The change is completely visual.
—Crevez, chiens, si vous n'étes pas contents!

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Set "Grid position" of blueprints

Post by Qon »

eradicator wrote:
Thu Jul 22, 2021 6:53 pm
Qon wrote:
Mon Jul 12, 2021 5:30 pm
Please tell us if you can get it to work that way or not, I'm curious and would like to know in case I have to do the same in a possible future mod!
I don't really understand what exactly "grid position" is supposed to be. Is it just a way of saying "not centered on the red flag"?
If both are possible then I would like to know both. 1. Moving entities without moving flag. This was possible before flag. I guess this is what your mod does.
2. Moving flag, changing the flag offset numbers. Players can do it in gui. Can a mod read and write these numbers?

curiosity
Filter Inserter
Filter Inserter
Posts: 315
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Set "Grid position" of blueprints

Post by curiosity »

Qon wrote:
Thu Jul 22, 2021 7:51 pm
If both are possible then I would like to know both. 1. Moving entities without moving flag. This was possible before flag. I guess this is what your mod does.
2. Moving flag, changing the flag offset numbers. Players can do it in gui. Can a mod read and write these numbers?
As I said, grid position doesn't physically exist. "The flag" does not physically exist. You can trivially offset grid position by offsetting every entity. The flag position is calculated, AFAICT, in some way from blueprint dimensions. It shouldn't be hard to reverse engineer it if you so desire.

I have already put a request into the docs thread to document it, and linked to this thread. I'm sure this thread will be moved to one of the three processed forums when that is done.

Post Reply

Return to “Modding interface requests”