Add global key events to close game

This commit is contained in:
JonShard
2026-07-25 20:48:36 +02:00
parent 596d777fae
commit 13567e5dd3
7 changed files with 60 additions and 167 deletions
+20
View File
@@ -0,0 +1,20 @@
extends Node
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("quit_game"):
get_tree().quit()
if event.is_action_pressed("satisfy_table_orders"):
satisfy_table_orders()
# Finds any node of class/type Table and calls satisfyAllOrders()
func satisfy_table_orders() -> void:
# Searches all nodes in the current running scene matching the class "Table"
var table_nodes = get_tree().root.find_children("*", "Table", true, false)
for node in table_nodes:
if node.has_method("satisfyAllOrders"):
node.satisfyAllOrders()