Page 1 of 1

Inserter placement preview

Posted: Fri Oct 27, 2017 8:00 am
by bobingabout
Since a large part of the recent FFFs are about previews showing accurately, I have a question.

Is there anything you can do about the placement preview of inserters, where in my mod the script modifies the pickup and drop locations of the hands immediately after placement?

Currently, I know of no way to do anything about the pickup and drop positions (Short of creating an entity for every possibility) until after the entity has been placed, therefore the item in hand always shows the default positions. This is confusing if you're holding a standard inserter that will change to a longhand inserter when placed. (or worse, 90 degree inserter, diagonal inserter, shuffle inserter etc. basically anything but the default configuration)

if it would be possible to detect that the player is holding an inserter in his hand and allow me to specify pickup and drop locations to the curser stack, rather than waiting for the item to be placed before I update, this would help. (Even if I still have to update the inserter after placement)

Re: Inserter placement preview

Posted: Mon Nov 13, 2017 11:00 am
by bobingabout
Have any developers looked at this yet?

any response would be appreciated, even if it's to tell me it's not going to happen.

Re: Inserter placement preview

Posted: Mon Nov 13, 2017 12:09 pm
by Zool
I‘m strongly supporting this request :D

Re: Inserter placement preview

Posted: Mon Nov 13, 2017 12:19 pm
by Rseding91
I've been thinking about it but there's no simple way to do what you've asked for.

Rendering happens in multiple threads outside the normal game loop and is not allowed to change the game state in any way. If it had to do a Lua call every time an inserter was rendered there would be so many complications and performance problems.

Re: Inserter placement preview

Posted: Mon Nov 13, 2017 12:29 pm
by eradicator
Rseding91 wrote:I've been thinking about it but there's no simple way to do what you've asked for.

Rendering happens in multiple threads outside the normal game loop and is not allowed to change the game state in any way. If it had to do a Lua call every time an inserter was rendered there would be so many complications and performance problems.
That's bad news. I was really hoping that some time in the far future we might eventually get a method to customize the contruction-preview. Personally i'd only want to have arbitrary overlays (circular range, square range, etc) but inserter preview would have been even more awesome.

Re: Inserter placement preview

Posted: Mon Nov 13, 2017 12:38 pm
by Rseding91
eradicator wrote:
Rseding91 wrote:I've been thinking about it but there's no simple way to do what you've asked for.

Rendering happens in multiple threads outside the normal game loop and is not allowed to change the game state in any way. If it had to do a Lua call every time an inserter was rendered there would be so many complications and performance problems.
That's bad news. I was really hoping that some time in the far future we might eventually get a method to customize the contruction-preview. Personally i'd only want to have arbitrary overlays (circular range, square range, etc) but inserter preview would have been even more awesome.
The main concern is that mods can't change the game state when rendering. Trusting them to do that would mean you have zero access to the normal lua information and it would have to be run in some different context. It would be slow and error prone without providing much utility.

Simple things like "draw a radius around the player until I say stop" is easy - if you had a better idea how it would work and why you wanted it I might look into doing that. In a different post though.

Re: Inserter placement preview

Posted: Mon Nov 13, 2017 1:10 pm
by bobingabout
A thought...

could you add extra (otherwise useless) data to the item stack (Item itself, or entity itself wouldn't be a viable place, as those would be global) tags for pickup_position and drop_position?

The tags wouldn't need to just be for the preview image, they could be used by the actual entity once placed too.

I mean, from how I understand it, there is just one ghost entity, and special properties that are usually on a per entity type basis can be applied to it, so it wouldn't be the first time you add in a work around for special cases.

oh wait, that's still a LUA call...

Re: Inserter placement preview

Posted: Fri Nov 17, 2017 11:00 am
by bobingabout
A question though... would it need to Lua call every frame?

It could do a Lua call on initial load, then it SHOULD only need to do another lua call on certain GUI click and button press events.

Also... how detrimental could it be to do a lua call on player hover ghost anyway?



If you haven't already, play around with the bob's pre-place inserter menu in bob logistics, and you'll see what I mean, and we I want this. (I really need to move it out to the bob's inserters GUI mod with everything else)