From d413c211b5b1d45e09377490561134fddb6dc53d Mon Sep 17 00:00:00 2001 From: Rendo Date: Thu, 16 Oct 2025 19:52:27 +0500 Subject: [PATCH] Return of smooth belt --- scripts/structure_behaviour.gd | 1 - scripts/structures/assembler.gd | 2 ++ scripts/structures/belt.gd | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/structure_behaviour.gd b/scripts/structure_behaviour.gd index d8736de..789184b 100644 --- a/scripts/structure_behaviour.gd +++ b/scripts/structure_behaviour.gd @@ -4,4 +4,3 @@ extends Node2D class_name StructureBehaviour @onready var structure_parent : Structure = get_parent() -@onready var inventory : Inventory = structure_parent.inventory diff --git a/scripts/structures/assembler.gd b/scripts/structures/assembler.gd index 3bbd48f..d3a5614 100644 --- a/scripts/structures/assembler.gd +++ b/scripts/structures/assembler.gd @@ -1,7 +1,9 @@ extends StructureBehaviour +@onready var inventory : InOutInventory = structure_parent.inventory @export var selected_recipe : Recipe + func _ready() -> void: inventory.stack_added.connect(check_for_recipe) await get_tree().process_frame diff --git a/scripts/structures/belt.gd b/scripts/structures/belt.gd index 7c0c2ba..4150055 100644 --- a/scripts/structures/belt.gd +++ b/scripts/structures/belt.gd @@ -1,6 +1,6 @@ extends StructureBehaviour -@onready var animator : AnimationPlayer = $"../AnimationPlayer" +@onready var inventory : BeltInventory = structure_parent.inventory func _draw() -> void: for i in range(inventory.capacity): @@ -23,7 +23,7 @@ func get_next() -> Structure: return structure_parent.get_relative(structure_parent.direction_vector()) func try_transfer(structure : Structure) -> void: - if structure == null or inventory.internal_array[inventory.capacity-1].amount == 0: + if structure == null or inventory.internal_array[inventory.capacity-1].amount == 0 or inventory.progress_array[inventory.capacity-1] < inventory.pop_treshold: return var last_slot = inventory.internal_array[inventory.capacity-1] var ang_diff = structure_parent.direction_difference(structure)