Document that player.get_main_inventory() will be nil while in remote view

Place to report issues and suggest improvements to the API documentation.
i142857
Burner Inserter
Burner Inserter
Posts: 11
Joined: Mon Nov 04, 2024 9:56 am
Contact:

Document that player.get_main_inventory() will be nil while in remote view

Post by i142857 »

The current documentation seems to suggest that the only case where it can be nil is if the entity is not a player. But in my testing, it's also nil if you're looking at the map/remote view. This is unexpected (intuitively, why would player.get_main_inventory() not work just because the player is looking at the map?). So I would suggest documenting this.
User avatar
PennyJim
Long Handed Inserter
Long Handed Inserter
Posts: 87
Joined: Wed Jan 18, 2023 3:49 am
Contact:

Re: Document that player.get_main_inventory() will be nil while in remote view

Post by PennyJim »

There is an angle where this is a bug rather than a documentation issue. I think I sit in that angle
curiosity
Filter Inserter
Filter Inserter
Posts: 559
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Document that player.get_main_inventory() will be nil while in remote view

Post by curiosity »

PennyJim wrote: Thu Dec 19, 2024 2:33 pm There is an angle where this is a bug rather than a documentation issue. I think I sit in that angle
The only report is listed as "not a bug", you might consider trying your luck with an API request.
User avatar
PennyJim
Long Handed Inserter
Long Handed Inserter
Posts: 87
Joined: Wed Jan 18, 2023 3:49 am
Contact:

Re: Document that player.get_main_inventory() will be nil while in remote view

Post by PennyJim »

Bah :(

I can kind of understand it.. with a get physical inventory, I think I'd be more okay
curiosity
Filter Inserter
Filter Inserter
Posts: 559
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Document that player.get_main_inventory() will be nil while in remote view

Post by curiosity »

Personally, I think the current behavior makes sense. You don't have an inventory when in remote view. And I bet it would return nil for some other controllers too, like spectator. All of them should be documented.
Post Reply

Return to “Documentation Improvement Requests”