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

This subforum contains all the issues which we already resolved.
Post Reply
lalmec
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri May 22, 2020 9:45 pm
Contact:

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

Post 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 1919 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 1919 times

Loewchen
Global Moderator
Global Moderator
Posts: 8319
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

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

Post by Loewchen »

This is the case when not all weapon slots are occupied and reproducible in 0.18.26 fyi.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

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

Post 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

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

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

Post by Rseding91 »

Ok, it's now 'fixed' as best as I can for the next release.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”