0.12.30 LuaPlayer.can_insert vs LuaPlayer.insert

This subforum contains all the issues which we already resolved.
Post Reply
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

0.12.30 LuaPlayer.can_insert vs LuaPlayer.insert

Post by Choumiko »

I noticed a little mismatch between LuaPlayer.can_insert and LuaPlayer.insert when dealing with a full main inventory and a full quickbar when one item of the quickbar is on the cursor.

To reproduce:
Fill main inventory and quickbar with items. Pick one stack from the quickbar onto your cursor and run:

Code: Select all

/c local p = game.local_player; p.print(serpent.line(p.can_insert{name="iron-plate", count=1}));p.print(serpent.line(p.insert{name="iron-plate", count=1}))
This results in:

Code: Select all

true
Cannot insert Iron Plate. Player's inventory full.
0
Guess it should either be: false 0 or true 1

Using the inventory directly is consistent:

Code: Select all

/c local p, item = game.local_player, "medium-electric-pole"
local main, quick = p.get_inventory(1), p.get_inventory(2)

p.print("quick:"..serpent.line(quick.can_insert{name=item, count=1}))
p.print("insert quick:"..serpent.line(quick.insert{name=item, count=1}))
results in true 1, placing the item in the slot of the item you have on the cursor

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

Re: 0.12.30 LuaPlayer.can_insert vs LuaPlayer.insert

Post by Rseding91 »

I've fixed this issue for 0.13 but the changes where more complex than I'd like to put into 0.12 and risk breaking something on the stable branch :)

The quickbar logic for can_insert wasn't the same as the actual insertion logic.
If you want to get ahold of me I'm almost always on Discord.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: 0.12.30 LuaPlayer.can_insert vs LuaPlayer.insert

Post by Choumiko »

Rseding91 wrote:I've fixed this issue for 0.13 but the changes where more complex than I'd like to put into 0.12 and risk breaking something on the stable branch :)
That's interesting, i would have thought it should be fairly simple :) "Fixing" it in lua isn't a big deal though, but still: can't wait!! :lol:

Post Reply

Return to “Resolved Problems and Bugs”