summaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-11-22 15:19:42 +0100
committertpart <tpart120@proton.me>2024-11-22 15:19:42 +0100
commit43b84664344b461bfb4128bb10111c3099029c7a (patch)
tree79ee577607305f57456759dea4707d36c70916e2 /client/menu
parent98cd943e493e23932e5ddf031dd004306c7314b0 (diff)
downloadhurrycurry-43b84664344b461bfb4128bb10111c3099029c7a.tar
hurrycurry-43b84664344b461bfb4128bb10111c3099029c7a.tar.bz2
hurrycurry-43b84664344b461bfb4128bb10111c3099029c7a.tar.zst
Fix document crash
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/document/document.gd13
1 files changed, 8 insertions, 5 deletions
diff --git a/client/menu/document/document.gd b/client/menu/document/document.gd
index 9cca0443..194b88d1 100644
--- a/client/menu/document/document.gd
+++ b/client/menu/document/document.gd
@@ -1,5 +1,6 @@
# Hurry Curry! - a game about cooking
# Copyright 2024 nokoe
+# Copyright 2024 tpart
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -21,7 +22,7 @@ func _ready():
super()
$ScrollContainer/VBoxContainer.add_child(build_document(data))
-func build_document(element: Dictionary) -> Control:
+func build_document(element: Dictionary, bullet: bool = false) -> Control:
var node: Control
match element["t"]:
"document":
@@ -50,7 +51,7 @@ func build_document(element: Dictionary) -> Control:
node = VBoxContainer.new()
node.name = "List"
for e in element["es"]:
- node.add_child(text_node(e, true))
+ node.add_child(build_document(e, true))
"table":
node = VBoxContainer.new()
node.name = "Rows"
@@ -70,7 +71,9 @@ func build_document(element: Dictionary) -> Control:
for e in element["es"]:
node.add_child(build_document(e))
"text":
- node = text_node(element, false)
+ node = text_node(element, bullet)
+ _:
+ push_error("Error building document: Unknown type \"%s\"" % element["t"])
return node
func text_node(element: Dictionary, bullet: bool) -> Control:
@@ -103,9 +106,9 @@ func text_node(element: Dictionary, bullet: bool) -> Control:
label.add_theme_color_override("font_color", Color(element["color"]))
return node
-func background(page_name: String) -> SubViewportContainer:
+func background(background_name: String) -> SubViewportContainer:
var item_name: String
- match page_name:
+ match background_name:
"cover": item_name = "plate:plate,plate,plate,dirt"
"toc": item_name = "tomato"
"tomato_soup": item_name = "plate:tomato-soup"