Page 1 of 1

[0.16.51] god quickbar maps to player main and vice versa

Posted: Thu Jun 21, 2018 9:11 pm
by tristynstimpson
It's me again ya boy

as a character controller:
game.player.get_inventory(defines.inventory.god_quickbar).insert("steel-plate") -- inserts into player main
game.player.get_inventory(defines.inventory.god_main).insert("steel-plate") -- inserts into player quickbar
game.print(game.player.get_inventory(defines.inventory.god_quickbar).index == defines.inventory.player_main) -- true

as a god controller:
game.player.get_inventory(defines.inventory.player_quickbar).insert("steel-plate") -- inserts into god main
game.player.get_inventory(defines.inventory.player_main).insert("steel-plate") -- inserts into god quickbar
game.print(game.player.get_inventory(defines.inventory.player_quickbar).index == defines.inventory.god_main) -- true

I'd expect if you put something in the player quickbar as a god, it would either go in the god quickbar or throw an error. I like that when a player doesn't have an inventory you guys fallback to an available one, but they're all mismatched :p such a minor bug

Re: [0.16.51] god quickbar maps to player main and vice versa

Posted: Thu Jun 21, 2018 9:21 pm
by Rseding91
tristynstimpson wrote:I'd expect if you put something in the player quickbar as a god, it would either go in the god quickbar or throw an error. I like that when a player doesn't have an inventory you guys fallback to an available one, but they're all mismatched :p such a minor bug
Thanks for the report however you expect wrong.

A "defines" for an inventory is a simple number. In this case 1 and 2. Which one means which inventory depends on what you call it on. If you actually looked at all of the values in defines.inventory you'd find that most (> 90%) are the value "1". They simply mean different things based off what entity you're interacting with

If you use god_main it only gives you back correct values if you use it on a god controller. The same for player_main only giving correct values on a player controller.

Finally: if you want the main inventory then just use get_main_inventory() and if you want the quickbar use get_quickbar().