Scripting the player inventory "hand" slot.

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

Scripting the player inventory "hand" slot.

Post by eradicator »

handslot.png
handslot.png (18.5 KiB) Viewed 1860 times

What
I've been staring at the doc for too long now and i don't see any methods to:
  1. Given a LuaPlayer -> putting a LuaItemStack into their cursor_stack and properly marking the source slot as "hand slot".
  2. Given a LuaPlayer -> get the index of the "hand slot" of their main inventory.
  3. Given a LuaItemStack -> determine if it currently is the hand slot. (Most important to me - i want to know if a given slot is empty)
Am i being blind, or is there no way to do any of this?
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: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Scripting the player inventory "hand" slot.

Post by Bilka »

From what I know, there is no way (currently).
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: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Scripting the player inventory "hand" slot.

Post by eradicator »

Bilka wrote: Tue Oct 22, 2019 2:23 pm From what I know, there is no way (currently).
Would you mind moving it to interface requests then?
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.
robot256
Filter Inserter
Filter Inserter
Posts: 934
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Scripting the player inventory "hand" slot.

Post by robot256 »

I would like to express my support for this interface request. It would be very helpful when trying to make a "re-usable capsule" and for other things. The topic came up again recently in this forum thread, which I found today because I have the same need.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Scripting the player inventory "hand" slot.

Post by eradicator »

Cross-linking similar request: viewtopic.php?f=28&t=65304
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 “Implemented mod requests”