Page 1 of 1

Set "Grid position" of blueprints

Posted: Sun Jul 11, 2021 5:57 pm
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.

Re: Set "Grid position" of blueprints

Posted: Mon Jul 12, 2021 12:31 am
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.

Re: Set "Grid position" of blueprints

Posted: Mon Jul 12, 2021 3:07 pm
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.

Re: Set "Grid position" of blueprints

Posted: Mon Jul 12, 2021 5:30 pm
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!

Re: Set "Grid position" of blueprints

Posted: Thu Jul 22, 2021 6:53 pm
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.

Re: Set "Grid position" of blueprints

Posted: Thu Jul 22, 2021 7:14 pm
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.

Re: Set "Grid position" of blueprints

Posted: Thu Jul 22, 2021 7:51 pm
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?

Re: Set "Grid position" of blueprints

Posted: Thu Jul 22, 2021 9:48 pm
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.