-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_scene.gd
More file actions
52 lines (40 loc) · 1.64 KB
/
Copy pathtest_scene.gd
File metadata and controls
52 lines (40 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
extends Control
#NOTE: This scene is just for testing only it is not required for the inventory to function
#in order to make an invetory, simply add the node to your actual scene
@export var grid: Inventory
#NOTE: remove this shit later,
#NOTE: revised 2025-11-17, this shit is relevant for debugging
@onready var debugger_label: Label = %DebuggerLabel
@onready var quantity: QuantityPicker = %Quantity
@onready var grid_width_le: LineEdit = %GridWidth
@onready var grid_height_le: LineEdit = %GridHeight
@onready var item_list: OptionButton = %ItemOptionDropdown
#------------------------DEBUGGING-------------------------#
func _ready() -> void:
_prep_itemList()
func _process(_delta: float) -> void:
debugger_label.text = str(grid.item_held)
func _on_add_item_button_pressed() -> void:
var selected_item = item_list.get_selected_id()
var item_id: String = item_list.get_item_text(selected_item)
var qt: int = quantity.value
grid.add_item(item_id, qt)
func _on_change_grid_size_pressed() -> void:
var width: int = int(grid_width_le.text)
var height: int = int(grid_height_le.text)
grid.grid_height = height
grid.grid_width = width
grid.custom_minimum_size = Vector2i(grid.cell_size * grid.grid_width, grid.cell_size * grid.grid_height)
func _prep_itemList() -> void:
for ids in grid.data.items:
item_list.add_item(ids.name)
item_list.add_item("null")
func _on_save_btn_pressed() -> void:
grid.save_items(grid.Save_file_path)
func _on_load_btn_pressed() -> void:
grid.load_items(grid.Save_file_path)
func _on_view_btn_pressed() -> void:
# NOTE: fix this
print("ohno")
func _on_restart_btn_pressed() -> void:
get_tree().reload_current_scene()