diff --git a/project.godot b/project.godot index 0a66f97..5d46001 100644 --- a/project.godot +++ b/project.godot @@ -20,7 +20,7 @@ config/icon="res://icon.svg" GuiEventBus="*res://scripts/gui/gui_event_bus.gd" RuntimePlayerData="*res://scripts/autoloads/runtime_player_data.gd" Registry="*res://scripts/autoloads/registry.gd" -BeltManager="*res://scripts/autoloads/belt_manager.gd" +ConveyorManager="*res://scripts/autoloads/conveyor_manager.gd" [display] diff --git a/scenes/conveyor.tscn b/scenes/conveyor.tscn index 3887af2..41d461a 100644 --- a/scenes/conveyor.tscn +++ b/scenes/conveyor.tscn @@ -3,8 +3,8 @@ [ext_resource type="Texture2D" uid="uid://gfkhedfdi7ug" path="res://sprites/atlasses/Popekko.png" id="1_kqxj7"] [ext_resource type="Script" uid="uid://bbd7o2st8kmgl" path="res://scripts/structure.gd" id="1_y326v"] [ext_resource type="Script" uid="uid://bd4ojfqrl8idm" path="res://scripts/inventory/inventory_slot.gd" id="2_54w8r"] -[ext_resource type="Script" uid="uid://v0hkuo3gda1b" path="res://scripts/inventory/belt_inventory.gd" id="3_ruvuk"] -[ext_resource type="Script" uid="uid://bp341eiwvfvyl" path="res://scripts/structures/belt.gd" id="5_54w8r"] +[ext_resource type="Script" uid="uid://v0hkuo3gda1b" path="res://scripts/inventory/conveyor_inventory.gd" id="3_ruvuk"] +[ext_resource type="Script" uid="uid://bp341eiwvfvyl" path="res://scripts/structures/conveyor.gd" id="5_54w8r"] [sub_resource type="Resource" id="Resource_t4je2"] resource_local_to_scene = true diff --git a/scripts/autoloads/belt_manager.gd b/scripts/autoloads/conveyor_manager.gd similarity index 100% rename from scripts/autoloads/belt_manager.gd rename to scripts/autoloads/conveyor_manager.gd diff --git a/scripts/autoloads/belt_manager.gd.uid b/scripts/autoloads/conveyor_manager.gd.uid similarity index 100% rename from scripts/autoloads/belt_manager.gd.uid rename to scripts/autoloads/conveyor_manager.gd.uid diff --git a/scripts/inventory/belt_inventory.gd b/scripts/inventory/conveyor_inventory.gd similarity index 99% rename from scripts/inventory/belt_inventory.gd rename to scripts/inventory/conveyor_inventory.gd index e60cec7..0b2a71b 100644 --- a/scripts/inventory/belt_inventory.gd +++ b/scripts/inventory/conveyor_inventory.gd @@ -1,7 +1,7 @@ @tool extends Inventory -class_name BeltInventory +class_name ConveyorInventory ## Amount of stacks that can be held in storage @export var capacity : int: diff --git a/scripts/inventory/belt_inventory.gd.uid b/scripts/inventory/conveyor_inventory.gd.uid similarity index 100% rename from scripts/inventory/belt_inventory.gd.uid rename to scripts/inventory/conveyor_inventory.gd.uid diff --git a/scripts/inventory/inventory.gd b/scripts/inventory/inventory.gd index 6512556..17faa33 100644 --- a/scripts/inventory/inventory.gd +++ b/scripts/inventory/inventory.gd @@ -13,14 +13,10 @@ func _init() -> void: ## Tries to add an item into inventory. Returns not stored stack of item. @abstract func add(stack : Stack) -> Stack -@abstract -func add_from_side(stack : Stack, ang_diff : float) -> Stack ## Returns if conditions of adding are met @abstract func can_add() -> bool -@abstract -func can_add_from_side(ang_diff : float) -> bool ## Tries to take first item. Returns null if no items in inventory @abstract diff --git a/scripts/inventory/queue.gd b/scripts/inventory/queue.gd index 45ee8cc..511fc79 100644 --- a/scripts/inventory/queue.gd +++ b/scripts/inventory/queue.gd @@ -44,18 +44,12 @@ func add(stack: Stack) -> Stack: return null return stack -func add_from_side(stack : Stack, _ang_diff : float) -> Stack: - return add(stack) - func can_add() -> bool: for i in range(capacity): if internal_array[i].amount == 0: return true return false -func can_add_from_side(_ang_diff : float) -> bool: - return can_add() - ## Tries to take first item. Returns null if no items in inventory func pop() -> Stack: if internal_array[0].held_item == null: diff --git a/scripts/inventory/storage.gd b/scripts/inventory/storage.gd index f1d2dfe..dd58e21 100644 --- a/scripts/inventory/storage.gd +++ b/scripts/inventory/storage.gd @@ -48,18 +48,12 @@ func add(stack: Stack) -> Stack: return null return stack -func add_from_side(stack : Stack, _ang_diff : float) -> Stack: - return add(stack) - func can_add() -> bool: for i in range(capacity): if internal_array[i].amount == 0: return true return false -func can_add_from_side(_ang_diff : float) -> bool: - return can_add() - ## Tries to take first item. Returns null if no items in inventory func pop() -> Stack: for i in range(len(internal_array)): diff --git a/scripts/structures/belt.gd b/scripts/structures/conveyor.gd similarity index 89% rename from scripts/structures/belt.gd rename to scripts/structures/conveyor.gd index be88879..02cf5ef 100644 --- a/scripts/structures/belt.gd +++ b/scripts/structures/conveyor.gd @@ -1,14 +1,14 @@ extends Node2D @onready var parent_structure : Structure = get_parent() -@onready var inventory : BeltInventory = parent_structure.inventory +@onready var inventory : ConveyorInventory = parent_structure.inventory @onready var animator : AnimationPlayer = $"../AnimationPlayer" func _ready() -> void: sync_animations.call_deferred() func sync_animations() -> void: - animator.seek(BeltManager.sync_time,true) + animator.seek(ConveyorManager.sync_time,true) func _draw() -> void: for i in range(inventory.capacity): @@ -20,7 +20,7 @@ func _process(delta: float) -> void: inventory.advance(delta) queue_redraw() var next : Structure = get_next() - if next == null or next.inventory == null or next.inventory.can_add_from_side(Globals.facing_difference(next.facing,parent_structure.facing)) == false: + if next == null or next.inventory.can_add_from_side(Globals.facing_difference(next.facing,parent_structure.facing)) == false: return var popped = inventory.pop() if popped == null: diff --git a/scripts/structures/belt.gd.uid b/scripts/structures/conveyor.gd.uid similarity index 100% rename from scripts/structures/belt.gd.uid rename to scripts/structures/conveyor.gd.uid