belt improvements

This commit is contained in:
Rendo 2025-10-15 09:35:37 +05:00
commit 4bae29f29f
7 changed files with 10 additions and 7 deletions

View file

@ -15,7 +15,7 @@ class_name BeltInventory
return capacity
@export var progress_speed : float = 1.0
@export var pop_treshold : float = 0.95
@export var pop_treshold : float = 0.99
## :3
@export_storage var internal_array : Array[InventorySlot] = []

View file

@ -14,7 +14,8 @@ func _draw() -> void:
for i in range(inventory.capacity):
if inventory.internal_array[i].amount > 0:
var calculated_position = calculate_position(i) - inventory.internal_array[i].held_item.preview.get_size()/2.0
draw_texture(inventory.internal_array[i].held_item.preview,calculated_position)
for j in range(inventory.internal_array[i].amount/10):
draw_texture(inventory.internal_array[i].held_item.preview,calculated_position + Vector2(0,-j))
func _process(delta: float) -> void:
inventory.advance(delta)

View file

@ -4,6 +4,6 @@ const test_item :=preload("res://generic/items/dbg_item.tres")
func _process(_delta: float) -> void:
for point in [Vector2(-1,0),Vector2(1,0),Vector2(0,1),Vector2(0,-1)]:
var found_structure = get_parent().get_relative(point)
var found_structure :Structure = get_parent().get_relative(point)
if found_structure and found_structure.inventory:
found_structure.inventory.add(Stack.new(test_item,1))
found_structure.inventory.add_from_side(Stack.new(test_item,randi_range(1,test_item.stack_size)),Structure.facing_to_vector(found_structure.facing).angle_to(point))