Page 1 of 1
Quickbar confusion when playing without character
Posted: Thu Jan 18, 2018 8:57 am
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.
Re: Quickbar confusion when playing without character
Posted: Thu Jan 18, 2018 9:21 am
by bobingabout
If it does work as you say, then I would say it is a bug.
Re: Quickbar confusion when playing without character
Posted: Fri Jan 19, 2018 7:24 pm
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.
Re: Quickbar confusion when playing without character
Posted: Fri Jan 19, 2018 7:33 pm
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.
Re: Quickbar confusion when playing without character
Posted: Mon Jan 22, 2018 8:47 am
by Rseding91
Changing the inventory index order changes the order they're iterated when you do something like "insert" or "remove_item".
Re: Quickbar confusion when playing without character
Posted: Mon Jan 22, 2018 9:29 am
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).
Re: Quickbar confusion when playing without character
Posted: Mon Jan 22, 2018 9:36 am
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.
Re: Quickbar confusion when playing without character
Posted: Mon Jan 22, 2018 9:40 am
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!