Page 1 of 1

[Rseding] [0.17.79] can_insert returns true when should be false

Posted: Fri May 22, 2020 10:14 pm
by lalmec
When a player's inventory is full, can_insert returns true

https://lua-api.factorio.com/latest/Lua ... can_insert


Steps to reproduce:

1. start new game
2. run player command

Code: Select all

/c game.print(game.player.insert{name="submachine-gun", count=1})
3. repeat step #2 until inventory is full:
82158754-be452280-9857-11ea-94f8-82e63320a8ee.png
82158754-be452280-9857-11ea-94f8-82e63320a8ee.png (623.84 KiB) Viewed 2403 times
4. run player command

Code: Select all

 /c game.print(game.player.can_insert{name="submachine-gun", count=1})
expected: false
actual: true
82158773-e46ac280-9857-11ea-969e-96298501eb6b.png
82158773-e46ac280-9857-11ea-969e-96298501eb6b.png (807.82 KiB) Viewed 2403 times

Re: [0.17.79] can_insert returns true when should be false

Posted: Fri May 22, 2020 10:34 pm
by Loewchen
This is the case when not all weapon slots are occupied and reproducible in 0.18.26 fyi.

Re: [0.17.79] can_insert returns true when should be false

Posted: Tue Jun 02, 2020 2:40 pm
by Klonan
You're checking player, not any specific inventory on the player

If you want to check if the main inventory is full, check the specific inventory, not the whole player

Re: [Rseding] [0.17.79] can_insert returns true when should be false

Posted: Tue Jun 02, 2020 8:24 pm
by Rseding91
Ok, it's now 'fixed' as best as I can for the next release.