EntityPrototype.picker_result = item_name (Q-key behavior addition)

Things that already exist in the current mod API
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

EntityPrototype.picker_result = item_name (Q-key behavior addition)

Post by eradicator »

What?

I'd like to specify what type of item a player gets into the cursor when using the Q key to "pick" an item for the selected entity.

Why?

I have an entity that is conditionally converted from a "placer entity". The player uses itemA to build entityA. EntityA is later converted to entityB via script. entityB can not be built directly. But i want the player to get a stack of itemA when they Q-key entityB.

I'd implement this manually, but i don't see a way to put an ItemStack from the main_inventory to the cursor_stack while reserving the slot with a "hand icon" like vanilla does. If that is possible (or was made possible) i'd also be quite happy.
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.

Bilka
Factorio Staff
Factorio Staff
Posts: 3133
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: EntityPrototype.picker_result = item_name (Q-key behavior addition)

Post by Bilka »

I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: EntityPrototype.picker_result = item_name (Q-key behavior addition)

Post by eradicator »

Hm. I wasn't aware that placeable_by would change the picker result :).
Also entityB *shouldn't* be placeable at all. But...replacing entityB ghosts might actually be better than blueprint editing.

Thanks for the answer.

Btw, the wiki page on flags for "player-creation" should state that it is also required for entities to become blueprintable. (And honestly i'd prefer if the AI didn't attack these entities :|)
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.

Bilka
Factorio Staff
Factorio Staff
Posts: 3133
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: EntityPrototype.picker_result = item_name (Q-key behavior addition)

Post by Bilka »

The player-creation description is completely inaccurate :p It's used in too many places in the code to be able to document it easily.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: EntityPrototype.picker_result = item_name (Q-key behavior addition)

Post by eradicator »

Bilka wrote:
Fri May 31, 2019 4:09 pm
The player-creation description is completely inaccurate :p It's used in too many places in the code to be able to document it easily.
Well duh. It *is* required for blueprintability though, i can saw that much now, just found that out by randomly trying flags \o/. An unexperienced modder might be less lucky.

If it's inaccurate maybe make a note of that at least. Inaccuracy is not something i'm used to from the wiki ;).
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.

Bilka
Factorio Staff
Factorio Staff
Posts: 3133
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: EntityPrototype.picker_result = item_name (Q-key behavior addition)

Post by Bilka »

Okay, you convinced me. I updated the page with the most "important"/"obvious" effects of the flag.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: EntityPrototype.picker_result = item_name (Q-key behavior addition)

Post by eradicator »

Thanks again. You're doing a great job so close to the weekend ;).
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.

Post Reply

Return to “Already exists”