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:
parent
340ee13fb9
commit
81f810aab8
@ -615,11 +615,11 @@ local function on_player_cancelled_crafting(event)
|
|||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
|
|
||||||
local crafting_queue_item_count = event.items.get_item_count()
|
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
|
local crafting_queue_canceled_item_slot_count = #event.items
|
||||||
|
|
||||||
if crafting_queue_canceled_item_slot_count > player_inventory_maximum_slot_count then
|
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_maximum_slot_count
|
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
|
for i = 1, crafting_queue_canceled_item_slot_count do
|
||||||
player.character.get_main_inventory().insert(event.items[i])
|
player.character.get_main_inventory().insert(event.items[i])
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user