From ffc758262295bb9b33facebd8969a6e7fb06cef4 Mon Sep 17 00:00:00 2001 From: Rendo Date: Fri, 17 Oct 2025 01:36:13 +0500 Subject: [PATCH] Assembler fix --- scripts/structures/assembler.gd | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/structures/assembler.gd b/scripts/structures/assembler.gd index c85e616..d76534a 100644 --- a/scripts/structures/assembler.gd +++ b/scripts/structures/assembler.gd @@ -6,10 +6,7 @@ extends StructureBehaviour func _ready() -> void: inventory.stack_added.connect(check_for_recipe) - await get_tree().process_frame - switch_recipe(selected_recipe) - for i in len(selected_recipe.ingridients): - inventory.input_array[i].filter = selected_recipe.ingridients[i].item + switch_recipe.call_deferred(selected_recipe) func switch_recipe(recipe: Recipe) -> void: selected_recipe = recipe @@ -36,7 +33,11 @@ func get_output_position() -> Vector2: return to_global(Vector2(1.5,-0.5).rotated(structure_parent.direction)+Vector2(0.5,0.5)) func check_for_recipe(_stack : Stack, _position : int) -> void: - if inventory.output_slot.held_item != null and inventory.output_slot.amount == inventory.output_slot.held_item.stack_size: + var flag:bool = false + for i in range(inventory.input_capacity): + if inventory.input_array[i].can_be_merged(_stack.held_item): + flag = true + if flag == false: return for i in range(len(selected_recipe.ingridients)): if inventory.input_array[i].amount < selected_recipe.ingridients[i].amount: