Render entity preview like during item placement

Place to get help with not working mods / modding interface.
doc
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Mon Mar 28, 2016 3:52 pm
Contact:

Render entity preview like during item placement

Post by doc »

When a player is placing an item or blueprint, the game renders the entities roughly as they're going to look, even showing where power line connections are going to appear, and of course indicating in red if an entity can't be placed.

My question is this, is there a way to produce this effect from Lua? I'm trying to create a machine that places blueprints for you, and I'm trying to find an interface to show you where the blueprint will be placed.

And help greatly appreciated. Thanks.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15938
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Render entity preview like during item placement

Post by Rseding91 »

No.
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: Render entity preview like during item placement

Post by Adil »

You could generate semi-transparent dummy entities for every building placeable by player and spawn those with your gui. My transparent tree mod might be relevant. (You'd probably want to make your dummies of type "simple-entity" like rock.)
If you want to have it connected to player's cursor, you'll have to get creative with blueprint type items. I can't provide more on the matter.

Finally, there has already been a mod for blueprint deployment. And it turns out there's another now.
And it seems that they're both ded. At least at the first glance.
Probably you can get some design ideas from those implementations.
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.
doc
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Mon Mar 28, 2016 3:52 pm
Contact:

Re: Render entity preview like during item placement

Post by doc »

Adil wrote:You could generate semi-transparent dummy entities for every building placeable by player and spawn those with your gui. My transparent tree mod might be relevant. (You'd probably want to make your dummies of type "simple-entity" like rock.)
If you want to have it connected to player's cursor, you'll have to get creative with blueprint type items. I can't provide more on the matter.
I did consider this, but generating so many new entity types seemed messy. In the end I opted for a completely different interface using a separate "anchor" entity, so the deployment position relative to the deployer is actually baked into the blueprint itself.
Adil wrote: Finally, there has already been a mod for blueprint deployment. And it turns out there's another now.
And it seems that they're both ded. At least at the first glance.
Probably you can get some design ideas from those implementations.
Thanks, I did have a bit of a look around but didn't dig those two up. The 2nd one is very close to my initial design. However now I'm very happy with the anchor system, because it properly allows recursive deployment. The issue with having a GUI to pick the offset is that those settings won't themselves get stored in blueprints, so I think recursion would be impossible with that mod.

My mod is here if interested: viewtopic.php?f=93&t=24053 - still lots of improvement to be made but it works quite nicely already.
Post Reply

Return to “Modding help”