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

@ -12,6 +12,6 @@ region = Rect2(0, 0, 5, 5)
script = ExtResource("1_2pbm1") script = ExtResource("1_2pbm1")
display_name = &"Test" display_name = &"Test"
preview = SubResource("AtlasTexture_trycy") preview = SubResource("AtlasTexture_trycy")
stack_size = 999 stack_size = 100
scene = ExtResource("2_1hrh7") scene = ExtResource("2_1hrh7")
metadata/_custom_type_script = "uid://p5327ibxtyfs" metadata/_custom_type_script = "uid://p5327ibxtyfs"

View file

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://b7du4vul4bmpq" path="res://scenes/player_platform.tscn" id="1_4ia00"] [ext_resource type="PackedScene" uid="uid://b7du4vul4bmpq" path="res://scenes/player_platform.tscn" id="1_4ia00"]
[ext_resource type="Script" uid="uid://db37xmo8ygwhg" path="res://scripts/gui/construction_button.gd" id="2_27lod"] [ext_resource type="Script" uid="uid://db37xmo8ygwhg" path="res://scripts/gui/construction_button.gd" id="2_27lod"]
[ext_resource type="Resource" uid="uid://dj524jjal1f0n" path="res://generic/prototypes/conveyor.tres" id="3_2crwe"] [ext_resource type="Resource" uid="uid://dj524jjal1f0n" path="res://generic/prototypes/belt.tres" id="3_2crwe"]
[ext_resource type="Script" uid="uid://b4nkk0ndqcto" path="res://scripts/placement_manager.gd" id="4_i7yte"] [ext_resource type="Script" uid="uid://b4nkk0ndqcto" path="res://scripts/placement_manager.gd" id="4_i7yte"]
[ext_resource type="PackedScene" uid="uid://bac552xgua68e" path="res://scenes/other_platform.tscn" id="5_mnxrb"] [ext_resource type="PackedScene" uid="uid://bac552xgua68e" path="res://scenes/other_platform.tscn" id="5_mnxrb"]
[ext_resource type="Resource" uid="uid://yn1iesx30nfu" path="res://generic/prototypes/dbg_assembler.tres" id="5_ymyc2"] [ext_resource type="Resource" uid="uid://yn1iesx30nfu" path="res://generic/prototypes/dbg_assembler.tres" id="5_ymyc2"]

View file

@ -9,7 +9,9 @@
[sub_resource type="Resource" id="Resource_t4je2"] [sub_resource type="Resource" id="Resource_t4je2"]
resource_local_to_scene = true resource_local_to_scene = true
script = ExtResource("3_ruvuk") script = ExtResource("3_ruvuk")
capacity = 4 capacity = 8
progress_speed = 2.0
pop_treshold = 0.95
internal_array = Array[ExtResource("2_54w8r")]([Object(RefCounted,"script":ExtResource("2_54w8r"),"held_item":null,"amount":0) internal_array = Array[ExtResource("2_54w8r")]([Object(RefCounted,"script":ExtResource("2_54w8r"),"held_item":null,"amount":0)
, Object(RefCounted,"script":ExtResource("2_54w8r"),"held_item":null,"amount":0) , Object(RefCounted,"script":ExtResource("2_54w8r"),"held_item":null,"amount":0)
, Object(RefCounted,"script":ExtResource("2_54w8r"),"held_item":null,"amount":0) , Object(RefCounted,"script":ExtResource("2_54w8r"),"held_item":null,"amount":0)

View file

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

View file

@ -14,7 +14,8 @@ func _draw() -> void:
for i in range(inventory.capacity): for i in range(inventory.capacity):
if inventory.internal_array[i].amount > 0: if inventory.internal_array[i].amount > 0:
var calculated_position = calculate_position(i) - inventory.internal_array[i].held_item.preview.get_size()/2.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: func _process(delta: float) -> void:
inventory.advance(delta) inventory.advance(delta)

View file

@ -4,6 +4,6 @@ const test_item :=preload("res://generic/items/dbg_item.tres")
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
for point in [Vector2(-1,0),Vector2(1,0),Vector2(0,1),Vector2(0,-1)]: 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: 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))