[0.12]LuaPlayer.can_insert() [kovarex] unexpected behaviour
Posted: Mon Aug 24, 2015 9:28 am
Pretty minor but:
LuaPlayer.can_insert(stack) returns true if the only free slots are the logistics trash slots, calling .insert(stack) after can_insert returns true fails.
Reproduce:
- completely fill your inventory and quickbar
run these commands:
I'd expect to see "Inventory full", instead i get "Cannot insert Rocket Silo. Player's inventory full."
LuaPlayer.can_insert(stack) returns true if the only free slots are the logistics trash slots, calling .insert(stack) after can_insert returns true fails.
Reproduce:
- completely fill your inventory and quickbar
run these commands:
Code: Select all
/c
if game.player.can_insert{name="rocket-silo", count=1} then
game.player.insert{name="rocket-silo", count=1}
else
game.player.print("Inventory full")
end