Inserter placement preview

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Inserter placement preview

Post 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)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Inserter placement preview

Post 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.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Zool
Fast Inserter
Fast Inserter
Posts: 107
Joined: Fri Jul 10, 2015 6:55 pm
Contact:

Re: Inserter placement preview

Post by Zool »

I‘m strongly supporting this request :D
Rseding91
Factorio Staff
Factorio Staff
Posts: 15896
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Inserter placement preview

Post 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.
If you want to get ahold of me I'm almost always on Discord.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Inserter placement preview

Post 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.
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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15896
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Inserter placement preview

Post 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.
If you want to get ahold of me I'm almost always on Discord.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Inserter placement preview

Post 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...
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Inserter placement preview

Post 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)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Post Reply

Return to “Modding interface requests”