From 319e30e3d43c6b422e7492253fd37557d2749720 Mon Sep 17 00:00:00 2001 From: Tabby <41929769+tabby-cat-nya@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:30:44 +1100 Subject: [PATCH] fancy printer list, time to get ready for twenty10 --- Library.gd.uid | 1 + application_cmds/printer-status.gd | 23 +++++++++++++++++++++++ application_cmds/printer-status.gd.uid | 1 + datatypes/printer.gd | 22 ++++++++++++++++++++++ library.gd | 3 ++- 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 Library.gd.uid create mode 100644 application_cmds/printer-status.gd create mode 100644 application_cmds/printer-status.gd.uid diff --git a/Library.gd.uid b/Library.gd.uid new file mode 100644 index 0000000..8b97b82 --- /dev/null +++ b/Library.gd.uid @@ -0,0 +1 @@ +uid://ow8cfjxy4fio diff --git a/application_cmds/printer-status.gd b/application_cmds/printer-status.gd new file mode 100644 index 0000000..497cdbc --- /dev/null +++ b/application_cmds/printer-status.gd @@ -0,0 +1,23 @@ +extends RefCounted + +#func on_ready(main, bot: DiscordBot) -> void: +# pass +# +#func on_autocomplete(main, bot: DiscordBot, interaction: DiscordInteraction, options: Array) -> void: +# pass + +func execute(main, bot: DiscordBot, interaction: DiscordInteraction, options: Array) -> void: + + var response : String = "Listing printers..." + var embed = Embed.new().set_description(Library.list_printers()) + + interaction.reply({ + "content": response, + "embeds":[embed] + }) + pass + +var data = ApplicationCommand.new()\ + .set_name("printer-status")\ + .set_description("view the status of all printers")\ + diff --git a/application_cmds/printer-status.gd.uid b/application_cmds/printer-status.gd.uid new file mode 100644 index 0000000..019eb3d --- /dev/null +++ b/application_cmds/printer-status.gd.uid @@ -0,0 +1 @@ +uid://ble32gllmjgwm diff --git a/datatypes/printer.gd b/datatypes/printer.gd index 93a4472..08be1c1 100644 --- a/datatypes/printer.gd +++ b/datatypes/printer.gd @@ -3,3 +3,25 @@ class_name Printer @export var name : String @export var spool : Spool +@export var nozzle : String = "0.4mm" + +static var nozzles : Array[String] = [ + "0.6mm", + "0.4mm", + "0.2mm", +] + + +func list_string() -> String: + var result = name + ": " + + if spool: + result += spool.name + " " + if spool.link: + result += "[Link]("+spool.link+")" + else: + result += "***Unloaded***" + + result += " (Nozzle: "+nozzle+")" + + return result diff --git a/library.gd b/library.gd index 95e828e..eb97d3c 100644 --- a/library.gd +++ b/library.gd @@ -3,6 +3,7 @@ extends Node var save_path : String = "user://librarySave.tres" var save : LibrarySave +# nozzles here or in save maybe? # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -41,7 +42,7 @@ func save_new(): func list_printers() -> String: var response : String = "Current Printers:" for printer : Printer in save.printers: - response += "\n- " + printer.name + response += "\n- " + printer.list_string() return response func printer_choies() -> Array[Dictionary]: