Assembler fix

This commit is contained in:
Rendo 2025-10-17 01:36:13 +05:00
commit ffc7582622

View file

@ -6,10 +6,7 @@ extends StructureBehaviour
func _ready() -> void: func _ready() -> void:
inventory.stack_added.connect(check_for_recipe) inventory.stack_added.connect(check_for_recipe)
await get_tree().process_frame switch_recipe.call_deferred(selected_recipe)
switch_recipe(selected_recipe)
for i in len(selected_recipe.ingridients):
inventory.input_array[i].filter = selected_recipe.ingridients[i].item
func switch_recipe(recipe: Recipe) -> void: func switch_recipe(recipe: Recipe) -> void:
selected_recipe = recipe 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)) 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: 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 return
for i in range(len(selected_recipe.ingridients)): for i in range(len(selected_recipe.ingridients)):
if inventory.input_array[i].amount < selected_recipe.ingridients[i].amount: if inventory.input_array[i].amount < selected_recipe.ingridients[i].amount: