Page 1 of 1

Render entity preview like during item placement

Posted: Thu Apr 21, 2016 2:53 pm
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.

Re: Render entity preview like during item placement

Posted: Thu Apr 21, 2016 8:25 pm
by Rseding91
No.

Re: Render entity preview like during item placement

Posted: Fri Apr 22, 2016 6:42 pm
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.

Re: Render entity preview like during item placement

Posted: Sun Apr 24, 2016 9:52 pm
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.