1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00

One more thing to fix - dual queuing (copper plates and iron plates, for example), and count only empty slots in player's inventory

This commit is contained in:
Maxim Martyanov 2020-07-21 15:12:09 +03:00
parent 340ee13fb9
commit 81f810aab8
No known key found for this signature in database
GPG Key ID: AA1D28E3259F7731

View File

@ -615,11 +615,11 @@ local function on_player_cancelled_crafting(event)
local player = game.players[event.player_index]
local crafting_queue_item_count = event.items.get_item_count()
local player_inventory_maximum_slot_count = #player.get_main_inventory()
local player_inventory_free_slot_count = player.get_main_inventory().count_empty_stacks()
local crafting_queue_canceled_item_slot_count = #event.items
if crafting_queue_canceled_item_slot_count > player_inventory_maximum_slot_count then
player.character.character_inventory_slots_bonus = crafting_queue_canceled_item_slot_count + player_inventory_maximum_slot_count
if crafting_queue_canceled_item_slot_count > player_inventory_free_slot_count then
player.character.character_inventory_slots_bonus = crafting_queue_canceled_item_slot_count + player_inventory_free_slot_count
for i = 1, crafting_queue_canceled_item_slot_count do
player.character.get_main_inventory().insert(event.items[i])
end