Quickbar confusion when playing without character

Bugs that are actually features.
Post Reply
neoc
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Sun Apr 24, 2016 4:31 pm
Contact:

Quickbar confusion when playing without character

Post by neoc »

If playing with player.character=nil, quickbar and main inventory are swapped:

player.get_inventory(defines.inventory.player_quickbar) will give you the main inventory while

player.get_inventory(defines.inventory.player_main) will give you the quickbar.

Since I can't see any good reason for this behavior, I consider it a bug.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7351
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Quickbar confusion when playing without character

Post by bobingabout »

If it does work as you say, then I would say it is a bug.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Quickbar confusion when playing without character

Post by posila »

That's because without character your are in god mode, and therefore you should be using different constants

Code: Select all

defines.inventory.god_quickbar	
defines.inventory.god_main
Personally, I think it is annoying and unnecessary behavior, but I can't foresee consequences of changing it and previously it was qualified as Not a bug by other developers, I am going to do the same.

neoc
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Sun Apr 24, 2016 4:31 pm
Contact:

Re: Quickbar confusion when playing without character

Post by neoc »

posila wrote:That's because without character your are in god mode, and therefore you should be using different constants

Code: Select all

defines.inventory.god_quickbar	
defines.inventory.god_main
Personally, I think it is annoying and unnecessary behavior, but I can't foresee consequences of changing it and previously it was qualified as Not a bug by other developers, I am going to do the same.
I still can't see why those constants are defined in the opposite way. You could just define them as the normal ones and everything should be fine.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Quickbar confusion when playing without character

Post by Rseding91 »

Changing the inventory index order changes the order they're iterated when you do something like "insert" or "remove_item".
If you want to get ahold of me I'm almost always on Discord.

neoc
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Sun Apr 24, 2016 4:31 pm
Contact:

Re: Quickbar confusion when playing without character

Post by neoc »

Rseding91 wrote:Changing the inventory index order changes the order they're iterated when you do something like "insert" or "remove_item".
That means you're not using the definitions in the code but iterate over numbers, how dare you! ;)

Well, it's a minor issue, but annoying when I have to manually fix mods like autofill every time (I strongly prefer playing in RTS mode without a character, playing with a character is just too annoying and pointless to me).

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Quickbar confusion when playing without character

Post by Rseding91 »

Mod(s) should really just use player.get_quickbar() and player.get_inventory() which does exactly what you'd want for character entities or the god controller.
If you want to get ahold of me I'm almost always on Discord.

neoc
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Sun Apr 24, 2016 4:31 pm
Contact:

Re: Quickbar confusion when playing without character

Post by neoc »

Rseding91 wrote:Mod(s) should really just use player.get_quickbar() and player.get_inventory() which does exactly what you'd want for character entities or the god controller.
Didn't know these APIs, thanks for the hint, I will try to get the author of autofill to fix this!

Post Reply

Return to “Not a bug”