This commit is contained in:
Rendo 2025-10-14 21:55:24 +05:00
commit 222960a824
19 changed files with 282 additions and 22 deletions

View file

@ -0,0 +1,20 @@
extends Node2D
@onready var inventory : ConveyorInventory = get_parent().inventory
func _draw() -> void:
for i in range(inventory.capacity):
if inventory.internal_array[i].amount > 0:
var calculated_position = Vector2(-8,0)+Vector2(16/inventory.capacity*i+16/inventory.capacity*inventory.progress_array[i],0)
draw_texture(inventory.internal_array[i].held_item.preview,calculated_position - inventory.internal_array[i].held_item.preview.get_size()/2.0)
func _process(delta: float) -> void:
inventory.advance(delta)
queue_redraw()
var right : Structure = get_parent().get_relative(Vector2.RIGHT)
if right == null or right.inventory.can_add() == false:
return
var popped = inventory.pop()
if popped == null:
return
right.inventory.add(popped)