forked from kanium/starcheese
22 lines
787 B
GDScript3
22 lines
787 B
GDScript3
|
|
extends Button
|
||
|
|
|
||
|
|
@onready var cargo_system = get_node("/root/Main/spaceship/CargoSystem")
|
||
|
|
@onready var debug_console = get_node("/root/Main/DebugConsole")
|
||
|
|
|
||
|
|
@export var item_to_remove: String = "cheese"
|
||
|
|
@export var quantity_to_remove: int = 1
|
||
|
|
|
||
|
|
func _ready() -> void:
|
||
|
|
connect("pressed", Callable(self, "_on_button_pressed"))
|
||
|
|
|
||
|
|
func _on_button_pressed():
|
||
|
|
if cargo_system:
|
||
|
|
if (cargo_system.remove_item(item_to_remove, quantity_to_remove)):
|
||
|
|
if debug_console:
|
||
|
|
debug_console.log_message("Removed: %d x %s from cargo." %[quantity_to_remove, item_to_remove], Color(1, 0, 0))
|
||
|
|
print("Removed: ", quantity_to_remove,"x ", item_to_remove, " from cargo.")
|
||
|
|
else:
|
||
|
|
print("Failed to remove item. Item not found or insufficient quantity.")
|
||
|
|
else:
|
||
|
|
print("Error: Cargo System not found.")
|