diff --git a/locale/en_AU.mo b/locale/en_AU.mo new file mode 100644 index 0000000..5451277 Binary files /dev/null and b/locale/en_AU.mo differ diff --git a/locale/en_AU.po b/locale/en_AU.po new file mode 100644 index 0000000..b4a5967 --- /dev/null +++ b/locale/en_AU.po @@ -0,0 +1,99 @@ +# Dawn Translation Strings +# Copyright (C) 2025 Dominic Masters +# This file is distributed under the same license as the Dawn Godot project. +# FIRST AUTHOR dominic@domsplace.com, 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Dawn\n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: en_AU\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4.4\n" + +# +# UI +# +msgid "ui.debug_menu.main_menu" +msgstr "Go to main menu" + +msgid "ui.debug_menu.overworld" +msgstr "Go to overworld" + +msgid "ui.debug_menu.quest" +msgstr "View Quests" + +msgid "ui.debug_menu.inventory" +msgstr "View Inventory" + +msgid "ui.debug_menu.event" +msgstr "Debug Events" + +msgid "ui.debug_menu.cutscene" +msgstr "Debug Cutscenes" + +msgid "ui.debug_menu.cooking" +msgstr "Debug Cooking" + +msgid "ui.debug_menu.battle" +msgstr "Debug Battle" + +# +# QUESTS +# +msgid "quest.test_quest.title" +msgstr "Test Quest" + +msgid "quest.test_quest.objective_onion.title" +msgstr "Savenge an Onion" + +# +# ITEMS +# +msgid "item.onion.title" +msgid_plural "item.onion.title_plural" +msgstr[0] "Onion" +msgstr[1] "Onions" + +msgid "item.onion.description" +msgstr "An onion, a staple of many dishes. It can be used in cooking or eaten raw." + +msgid "item.sweet_potato.name" +msgid_plural "item.sweet_potato.name_plural" +msgstr[0] "Sweet Potato" +msgstr[1] "Sweet Potatoes" + +msgid "item.sweet_potato.description" +msgstr "A sweet potato, a nutritious and versatile vegetable. It can be used in cooking or eaten raw." + +msgid "item.potion.name" +msgid_plural "item.potion.name_plural" +msgstr[0] "Potion" +msgstr[1] "Potions" + +msgid "item.potion.description" +msgstr "A potion that restores health. It can be consumed to regain vitality." + +msgid "item.baked_sweet_potato.name" +msgid_plural "item.baked_sweet_potato.name_plural" +msgstr[0] "Baked Sweet Potato" +msgstr[1] "Baked Sweet Potatoes" + +msgid "item.baked_sweet_potato.description" +msgstr "A sweet potato that has been baked to perfection. It is warm and comforting, perfect for a chilly day." + +# +# SCENES +# +msgid "main_menu.label" +msgstr "" +"Thyme and Fire\n" +"\n" +"Press {inputIcon} to open the debug menu" diff --git a/locale/en_US.mo b/locale/en_US.mo deleted file mode 100644 index 0e5f0c4..0000000 Binary files a/locale/en_US.mo and /dev/null differ diff --git a/locale/en_US.po b/locale/en_US.po deleted file mode 100644 index 1d7feda..0000000 --- a/locale/en_US.po +++ /dev/null @@ -1,77 +0,0 @@ -# LANGUAGE translation for Dawn Godot for the following files: -# res://scenes/UI/DebugMenu.tscn -# -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Dawn Godot\n" -"POT-Creation-Date: \n" -"PO-Revision-Date: \n" -"Last-Translator: \n" -"Language-Team: \n" -"Language: en_US\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 3.4.4\n" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.main_menu" -msgstr "Main Menu" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.overworld" -msgstr "Overworld" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.quest" -msgstr "Quest" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.inventory" -msgstr "Inventory" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.event" -msgstr "Event" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.cutscene" -msgstr "Cutscene" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.cooking" -msgstr "Cooking" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.battle" -msgstr "Battle" - -#~ msgid "UI_DEBUG_MAIN_MENU" -#~ msgstr "Main Menu" - -#~ msgid "UI_DEBUG_OVERWORLD" -#~ msgstr "Overworld" - -#~ msgid "UI_DEBUG_QUESTS" -#~ msgstr "Quests" - -#~ msgid "UI_DEBUG_INVENTORY" -#~ msgstr "Inventory" - -#~ msgid "UI_DEBUG_EVENTS" -#~ msgstr "Events" - -#~ msgid "UI_DEBUG_CUTSCENES" -#~ msgstr "Cutscenes" - -#~ msgid "UI_DEBUG_COOKING" -#~ msgstr "Cooking" - -#~ msgid "UI_DEBUG_BATTLE" -#~ msgstr "Battle" - -#~ msgid "SOME_STRING_TRANSLATED" -#~ msgstr "This is english" diff --git a/locale/ja_JP.mo b/locale/ja_JP.mo deleted file mode 100644 index 17b9f7d..0000000 Binary files a/locale/ja_JP.mo and /dev/null differ diff --git a/locale/ja_JP.po b/locale/ja_JP.po deleted file mode 100644 index cda92e7..0000000 --- a/locale/ja_JP.po +++ /dev/null @@ -1,77 +0,0 @@ -# LANGUAGE translation for Dawn Godot for the following files: -# res://scenes/UI/DebugMenu.tscn -# -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Dawn Godot\n" -"POT-Creation-Date: \n" -"PO-Revision-Date: \n" -"Last-Translator: \n" -"Language-Team: \n" -"Language: ja_JP\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 3.4.4\n" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.main_menu" -msgstr "メインメニュー" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.overworld" -msgstr "オーバーワールド" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.quest" -msgstr "クエスト" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.inventory" -msgstr "インベントリ" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.event" -msgstr "イベント" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.cutscene" -msgstr "カットシーン" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.cooking" -msgstr "料理" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.battle" -msgstr "バトル" - -#~ msgid "UI_DEBUG_MAIN_MENU" -#~ msgstr "メインメニュー" - -#~ msgid "UI_DEBUG_OVERWORLD" -#~ msgstr "オーバーワールド" - -#~ msgid "UI_DEBUG_QUESTS" -#~ msgstr "クエスト" - -#~ msgid "UI_DEBUG_INVENTORY" -#~ msgstr "インベントリ" - -#~ msgid "UI_DEBUG_EVENTS" -#~ msgstr "イベント" - -#~ msgid "UI_DEBUG_CUTSCENES" -#~ msgstr "カットシーン" - -#~ msgid "UI_DEBUG_COOKING" -#~ msgstr "料理" - -#~ msgid "UI_DEBUG_BATTLE" -#~ msgstr "バトル" - -#~ msgid "SOME_STRING_TRANSLATED" -#~ msgstr "これは英語です" diff --git a/locale/messages.pot b/locale/messages.pot deleted file mode 100644 index ea33212..0000000 --- a/locale/messages.pot +++ /dev/null @@ -1,44 +0,0 @@ -# LANGUAGE translation for Dawn Godot for the following files: -# res://scenes/UI/DebugMenu.tscn -# -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Dawn Godot\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8-bit\n" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.main_menu" -msgstr "" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.overworld" -msgstr "" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.quest" -msgstr "" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.inventory" -msgstr "" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.event" -msgstr "" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.cutscene" -msgstr "" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.cooking" -msgstr "" - -#: scenes/UI/DebugMenu.tscn -msgid "ui.debug_menu.battle" -msgstr "" diff --git a/project.godot b/project.godot index 482cf99..7831b38 100644 --- a/project.godot +++ b/project.godot @@ -19,8 +19,8 @@ config/icon="res://icon.svg" BATTLE="*res://scripts/Singleton/Battle.gd" COOKING="*res://scripts/Singleton/Cooking.gd" -ITEM="*res://scripts/Singleton/Item.gd" OVERWORLD="*res://scripts/Singleton/Overworld.gd" +ITEM="*res://scenes/Singletons/Item.tscn" PAUSE="*res://scripts/Singleton/Pause.gd" QUEST="*res://scenes/Singletons/Quest.tscn" SCENE_MANAGER="*res://scripts/Singleton/SceneManager.gd" @@ -111,8 +111,7 @@ run={ [internationalization] -locale/translations=PackedStringArray("res://locale/en_US.mo", "res://locale/ja_JP.mo") -locale/translations_pot_files=PackedStringArray("res://scenes/UI/DebugMenu.tscn") +locale/translations=PackedStringArray("res://locale/en_AU.mo") locale/language_filter=["ja"] locale/country_filter=["JP"] diff --git a/scenes/MainMenu.tscn b/scenes/MainMenu.tscn index d2e1f7f..2125e57 100644 --- a/scenes/MainMenu.tscn +++ b/scenes/MainMenu.tscn @@ -1,6 +1,9 @@ -[gd_scene format=3 uid="uid://w1q5eoiejmy3"] +[gd_scene load_steps=2 format=3 uid="uid://w1q5eoiejmy3"] + +[ext_resource type="Script" uid="uid://cak4lch21nq30" path="res://scripts/Scene/MainMenuScene.gd" id="1_yqorp"] [node name="MainMenu" type="Node"] +script = ExtResource("1_yqorp") [node name="Control" type="Control" parent="."] layout_mode = 3 @@ -10,7 +13,8 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -[node name="Label" type="Label" parent="Control"] +[node name="Label" type="RichTextLabel" parent="Control"] +auto_translate_mode = 2 layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 @@ -23,7 +27,6 @@ offset_right = 133.5 offset_bottom = 37.5 grow_horizontal = 2 grow_vertical = 2 -text = "Thyme and Magic - Prototype - -Press tab to bring up debug menu." +bbcode_enabled = true +text = "main_menu.label" horizontal_alignment = 1 diff --git a/scenes/Singletons/Item.tscn b/scenes/Singletons/Item.tscn new file mode 100644 index 0000000..d558c9d --- /dev/null +++ b/scenes/Singletons/Item.tscn @@ -0,0 +1,45 @@ +[gd_scene load_steps=5 format=3 uid="uid://mfxht4d8pvjj"] + +[ext_resource type="Script" uid="uid://1vd57s0j3b2o" path="res://scripts/Singleton/Item.gd" id="1_sv510"] +[ext_resource type="Script" uid="uid://dipe47ljyvycv" path="res://scripts/Item/ingredients/ItemOnion.gd" id="2_w2ka5"] +[ext_resource type="Script" uid="uid://b6v2o563casay" path="res://scripts/Item/medicine/ItemPotion.gd" id="3_q4yin"] +[ext_resource type="Script" uid="uid://c6t5tprnd23t0" path="res://scripts/Item/Item.gd" id="3_v1lpn"] + +[node name="Item" type="Node"] +script = ExtResource("1_sv510") +metadata/_custom_type_script = "uid://1vd57s0j3b2o" + +[node name="Ingredients" type="Node" parent="."] + +[node name="Onion" type="Node" parent="Ingredients"] +script = ExtResource("2_w2ka5") +title = "item.onion.title" +description_text = "item.onion.description" +type = 2 +metadata/_custom_type_script = "uid://b6v2o563casay" + +[node name="Item" type="Node" parent="Ingredients"] +script = ExtResource("3_v1lpn") +title = "item.sweet_potato.name" +description_text = "item.sweet_potato.description" +type = 3 +metadata/_custom_type_script = "uid://c6t5tprnd23t0" + +[node name="Medicine" type="Node" parent="."] + +[node name="Item" type="Node" parent="Medicine"] +script = ExtResource("3_q4yin") +title = "item.potion.name" +description_text = "item.potion.description" +category = 0 +metadata/_custom_type_script = "uid://b6v2o563casay" + +[node name="Food" type="Node" parent="."] + +[node name="Item" type="Node" parent="Food"] +script = ExtResource("3_v1lpn") +title = "item.baked_sweet_potato.name" +description_text = "item.baked_sweet_potato.description" +type = 4 +category = 3 +metadata/_custom_type_script = "uid://c6t5tprnd23t0" diff --git a/scenes/Singletons/Quest.tscn b/scenes/Singletons/Quest.tscn index 8eef6db..3869432 100644 --- a/scenes/Singletons/Quest.tscn +++ b/scenes/Singletons/Quest.tscn @@ -6,13 +6,16 @@ [node name="QuestSystem" type="Node"] script = ExtResource("1_v2h4q") +metadata/_custom_type_script = "uid://d0060jeyftia7" [node name="Quests" type="Node" parent="."] -[node name="Some Quest" type="Node" parent="Quests"] +[node name="Test Quest" type="Node" parent="Quests"] script = ExtResource("2_n4ii1") +title = "quest.test_quest.title" +metadata/_custom_type_script = "uid://dn0kxbe85n40f" -[node name="Find Onion" type="Node" parent="Quests/Some Quest"] +[node name="Find Onion" type="Node" parent="Quests/Test Quest"] script = ExtResource("3_l8p7p") -objectiveName = "Find Onions" -itemType = 1 +title = "quest.test_quest.objective_onion.title" +metadata/_custom_type_script = "uid://de1ao4huhy0hm" diff --git a/scenes/Singletons/Recipe.tscn b/scenes/Singletons/Recipe.tscn index 5f17cd5..62bee23 100644 --- a/scenes/Singletons/Recipe.tscn +++ b/scenes/Singletons/Recipe.tscn @@ -22,7 +22,6 @@ metadata/_custom_type_script = "uid://j87s6jrx8unn" [node name="Ash-Baked Sweet Potato" type="Node" parent="."] script = ExtResource("2_f5akq") -recipe_text = "Ash-Baked Sweet Potato" ingredients = Array[ExtResource("3_b8y03")]([SubResource("Resource_3dxl6")]) outputs = Array[ExtResource("3_b8y03")]([SubResource("Resource_b8y03")]) metadata/_custom_type_script = "uid://dipvg4uwjv6p2" diff --git a/scripts/Cooking/Recipe.gd b/scripts/Cooking/Recipe.gd index fddb6cf..7b09e6c 100644 --- a/scripts/Cooking/Recipe.gd +++ b/scripts/Cooking/Recipe.gd @@ -1,6 +1,6 @@ class_name Recipe extends Node -@export var recipe_text:String = "" +@export var title:String = "" @export var ingredients:Array[ItemResource] = [] @export var outputs:Array[ItemResource] = [] diff --git a/scripts/Event/Item/EventGetItem.gd b/scripts/Event/Item/EventGetItem.gd index 3db0fba..7bac4c1 100644 --- a/scripts/Event/Item/EventGetItem.gd +++ b/scripts/Event/Item/EventGetItem.gd @@ -18,9 +18,9 @@ func start() -> void: var text:String = ""; match getType: GetType.FOUND: - text = "Found " + str(quantity) + " " + Item.getItemName(itemType, quantity) + "."; + text = "Found " + str(quantity) + " " + ITEM.getItemName(itemType, quantity) + "."; GetType.GIVEN: - text = "Received " + str(quantity) + " " + Item.getItemName(itemType, quantity) + "."; + text = "Received " + str(quantity) + " " + ITEM.getItemName(itemType, quantity) + "."; _: pass VN.getTextbox().setText(text); diff --git a/scripts/Item/Ingredient/Onion.gd b/scripts/Item/Ingredient/Onion.gd deleted file mode 100644 index b4449bc..0000000 --- a/scripts/Item/Ingredient/Onion.gd +++ /dev/null @@ -1,13 +0,0 @@ -class_name Onion extends "res://scripts/Item/Item.gd" - -func getName() -> String: - return "Onion" - -func getCategory() -> ItemCategory: - return ItemCategory.MEDICINE; - -func isConsumable() -> bool: - return true; - -func consume() -> void: - print("Consuming Potion"); diff --git a/scripts/Item/Ingredient/Onion.gd.uid b/scripts/Item/Ingredient/Onion.gd.uid deleted file mode 100644 index 757e0ba..0000000 --- a/scripts/Item/Ingredient/Onion.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bmfaw3kid1pqx diff --git a/scripts/Item/Inventory.gd b/scripts/Item/Inventory.gd index 33ff9d5..7e13177 100644 --- a/scripts/Item/Inventory.gd +++ b/scripts/Item/Inventory.gd @@ -7,7 +7,7 @@ enum ItemSortType { class ItemStackNameComparator: static func _sort(a, b): - return Item.getItemName(a).to_lower() < Item.getItemName(b).to_lower() + return ITEM.getItemName(a).to_lower() < ITEM.getItemName(b).to_lower() class ItemStackTypeComparator: static func _sort(a, b): @@ -22,7 +22,7 @@ func isPlayerInventory() -> bool: return self == ITEM.PLAYER_INVENTORY func addItem(type:Item.Type, quantity: int = 1) -> void: - if !Item.isStackable(type): + if !ITEM.isStackable(type): # Item cannot be stacked, add each item to inv for i in range(quantity): contents.append(ItemStack.new(type, 1)) diff --git a/scripts/Item/Item.gd b/scripts/Item/Item.gd index bcafd74..69f9350 100644 --- a/scripts/Item/Item.gd +++ b/scripts/Item/Item.gd @@ -1,4 +1,4 @@ -class_name Item +class_name Item extends Node enum Type { # Items @@ -9,7 +9,7 @@ enum Type { SWEET_POTATO = 3, # Recipe outputs - ASH_BAKED_SWEET_POTATO = 4, + BAKED_SWEET_POTATO = 4, }; enum Category { @@ -19,70 +19,8 @@ enum Category { FOOD }; -static func isStackable(itemType:Type) -> bool: - match itemType: - - _: - return true - -static func getItemName(itemType:Type, count:int = 1) -> String: - match itemType: - Type.POTION: - if count != 1: - return "Potions" - return "Potion" - - Type.ONION: - if count != 1: - return "Onions" - return "Onion" - - Type.SWEET_POTATO: - if count != 1: - return "Sweet Potatoes" - return "Sweet Potato" - - Type.ASH_BAKED_SWEET_POTATO: - if count != 1: - return "Ash-Baked Sweet Potatoes" - return "Ash-Baked Sweet Potato" - - _: - assert(false, "Invalid item type") - return "" - -static func getItemDescription(itemType:Type) -> String: - match itemType: - Type.POTION: - return "A potent healing drink, infused with magical properties. Restores health and stamina." - - Type.ONION: - return "A common vegetable, known for its strong flavor and aroma. Can be used in cooking." - - Type.SWEET_POTATO: - return "A nutritious root vegetable, sweet and starchy. Can be used in cooking." - - Type.ASH_BAKED_SWEET_POTATO: - return "Tender, warm, and sweet meal, made by baking a sweet potato in campfire embers. Comforting, simple, and gently filling." - - _: - assert(false, "Invalid item type") - return "" - -static func getItemCategory(itemType:Type) -> Category: - match itemType: - Type.POTION: - return Category.MEDICINE - - Type.ONION: - return Category.INGREDIENT - - Type.SWEET_POTATO: - return Category.INGREDIENT - - Type.ASH_BAKED_SWEET_POTATO: - return Category.FOOD - - _: - assert(false, "Invalid item type") - return Category.KEY_ITEM +@export var title:String = "" +@export var description_text:String = "" +@export var type:Type = Type.POTION +@export var category:Category = Category.INGREDIENT +@export var stackable:bool = true diff --git a/scripts/Item/Potion.gd b/scripts/Item/Potion.gd deleted file mode 100644 index 956e2a8..0000000 --- a/scripts/Item/Potion.gd +++ /dev/null @@ -1,13 +0,0 @@ -class_name Potion extends "res://scripts/Item/Item.gd" - -func getName() -> String: - return "Potion" - -func getCategory() -> ItemCategory: - return ItemCategory.MEDICINE; - -func isConsumable() -> bool: - return true; - -func consume() -> void: - print("Consuming Potion"); diff --git a/scripts/Item/ingredients/ItemOnion.gd b/scripts/Item/ingredients/ItemOnion.gd new file mode 100644 index 0000000..e920a35 --- /dev/null +++ b/scripts/Item/ingredients/ItemOnion.gd @@ -0,0 +1 @@ +class_name ItemOnion extends "res://scripts/Item/Item.gd" diff --git a/scripts/Item/ingredients/ItemOnion.gd.uid b/scripts/Item/ingredients/ItemOnion.gd.uid new file mode 100644 index 0000000..8e84340 --- /dev/null +++ b/scripts/Item/ingredients/ItemOnion.gd.uid @@ -0,0 +1 @@ +uid://dipe47ljyvycv diff --git a/scripts/Item/medicine/ItemPotion.gd b/scripts/Item/medicine/ItemPotion.gd new file mode 100644 index 0000000..baab434 --- /dev/null +++ b/scripts/Item/medicine/ItemPotion.gd @@ -0,0 +1 @@ +class_name ItemPotion extends Item \ No newline at end of file diff --git a/scripts/Item/medicine/ItemPotion.gd.uid b/scripts/Item/medicine/ItemPotion.gd.uid new file mode 100644 index 0000000..f0d1657 --- /dev/null +++ b/scripts/Item/medicine/ItemPotion.gd.uid @@ -0,0 +1 @@ +uid://b6v2o563casay diff --git a/scripts/Quest/Quest.gd b/scripts/Quest/Quest.gd index 63e64f0..b068831 100644 --- a/scripts/Quest/Quest.gd +++ b/scripts/Quest/Quest.gd @@ -1,6 +1,6 @@ class_name Quest extends Node -@export var questName:String = "Some quest" +@export var title:String = "" @export var questKey:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST var questStarted:bool = false diff --git a/scripts/Quest/QuestObjective.gd b/scripts/Quest/QuestObjective.gd index 99bfb70..bb6a50e 100644 --- a/scripts/Quest/QuestObjective.gd +++ b/scripts/Quest/QuestObjective.gd @@ -4,7 +4,7 @@ enum Type { Item, } -@export var objectiveName:String = "Some objective" +@export var title:String = "" @export var objectiveType:Type = Type.Item @export var itemType:Item.Type = Item.Type.POTION diff --git a/scripts/Scene/MainMenuScene.gd b/scripts/Scene/MainMenuScene.gd new file mode 100644 index 0000000..9f02978 --- /dev/null +++ b/scripts/Scene/MainMenuScene.gd @@ -0,0 +1,6 @@ +class_name MainMenuScene extends Node + +func _enter_tree() -> void: + $Control/Label.text = tr("main_menu.label").format({ + inputIcon = "[img=32x32]res://icon.svg[/img]" + }) \ No newline at end of file diff --git a/scripts/Singleton/Item.gd b/scripts/Singleton/Item.gd index badc24b..42e3e09 100644 --- a/scripts/Singleton/Item.gd +++ b/scripts/Singleton/Item.gd @@ -1,9 +1,57 @@ -extends Node +class_name ItemSystem extends Node const Inventory = preload("res://scripts/Item/Inventory.gd") -# # Item Constants -# static var POTION = preload("res://scripts/Item/Potion.gd").new(); -# static var ONION = preload("res://scripts/Item/Ingredient/Onion.gd").new(); -# Static inventories static var PLAYER_INVENTORY = Inventory.new(); +static var ITEM_MAP:Dictionary[Item.Type,Item] + +func _addItemRecursively(node:Node) -> void: + if node is Item: + if ITEM_MAP.has(node.type): + assert(false, "Duplicate item type found: " + str(node.type)) + ITEM_MAP[node.type] = node + + for childIndex in node.get_child_count(): + _addItemRecursively(node.get_child(childIndex)) + +func _enter_tree() -> void: + # Add all items + ITEM_MAP = {} + _addItemRecursively(self) + + # Check if we are missing any item types. + for itemType in Item.Type.values(): + if !ITEM_MAP.has(itemType): + assert(false, "Missing item type: " + Item.Type.find_key(itemType)) + + +static func isStackable(itemType:Item.Type) -> bool: + if not ITEM_MAP.has(itemType): + return false + + var item:Item = ITEM_MAP[itemType] + return item.stackable + +static func getItemName(itemType:Item.Type, count:int = 1) -> String: + if not ITEM_MAP.has(itemType): + return "" + + var item:Item = ITEM_MAP[itemType] + if count > 1: + return str(count) + "x " + item.title + else: + return item.title + +static func getItemDescription(itemType:Item.Type) -> String: + if not ITEM_MAP.has(itemType): + return "" + + var item:Item = ITEM_MAP[itemType] + return item.description_text + +static func getItemCategory(itemType:Item.Type) -> Item.Category: + if not ITEM_MAP.has(itemType): + return Item.Category.INGREDIENT + + var item:Item = ITEM_MAP[itemType] + return item.category diff --git a/scripts/Singleton/Locale.gd b/scripts/Singleton/Locale.gd index 8f833d0..5c6bda8 100644 --- a/scripts/Singleton/Locale.gd +++ b/scripts/Singleton/Locale.gd @@ -36,7 +36,7 @@ var region:Region = -1 signal localeChanged func _init() -> void: - var preferred = OS.get_locale_language() + var preferred = OS.get_locale() self.setLocaleFromLocaleString(preferred) func setLocaleFromLocaleString(localeString:String) -> void: @@ -77,7 +77,6 @@ func setLocaleFromLocaleString(localeString:String) -> void: self.setLocale(lang, reg) func setLocale(language:Language, region:Region) -> void: - print("Setting locale to: " + str(language) + "_" + str(region)) if self.language == language and self.region == region: return diff --git a/scripts/Singleton/Recipe.gd b/scripts/Singleton/Recipe.gd index d7056f3..e6b426f 100644 --- a/scripts/Singleton/Recipe.gd +++ b/scripts/Singleton/Recipe.gd @@ -1 +1,11 @@ class_name RecipeSystem extends Node + +enum Type { + ASH_BAKED_SWEET_POTATO, +} + + + +func _init() -> void: + + pass diff --git a/scripts/UI/Inventory/ItemLine.gd b/scripts/UI/Inventory/ItemLine.gd index e481b28..caaff1a 100644 --- a/scripts/UI/Inventory/ItemLine.gd +++ b/scripts/UI/Inventory/ItemLine.gd @@ -1,5 +1,5 @@ class_name ItemLine extends HBoxContainer func setStack(stack:ItemStack) -> void: - $ItemName.text = Item.getItemName(stack.type, 1) + $ItemName.text = ITEM.getItemName(stack.type, 1) $ItemQuantity.text = str(stack.quantity) diff --git a/scripts/UI/QuestMenu.gd b/scripts/UI/QuestMenu.gd index cd02ad0..b5dfd0b 100644 --- a/scripts/UI/QuestMenu.gd +++ b/scripts/UI/QuestMenu.gd @@ -9,7 +9,6 @@ class_name QuestMenu extends Panel var currentQuestKey var currentQuestObjective - func _ready() -> void: hide() @@ -43,11 +42,11 @@ func setQuest(questKey = null): var quest = QUEST.quests[questKey]; questList.select(questKey) - questName.text = quest.questName + questName.text = quest.title questObjectiveList.clear() questObjectiveList.deselect_all() for objective in quest.objectives: - questObjectiveList.add_item(objective.objectiveName) + questObjectiveList.add_item(objective.title) func setQuestObjective(objective = null): @@ -63,7 +62,7 @@ func setQuestObjective(objective = null): var questObjective = quest.objectives[objective] questObjectiveList.select(objective) - questObjectiveInfo.text = questObjective.objectiveName + "\n" + questObjectiveInfo.text = questObjective.title + "\n" func open(questKey = null) -> void: @@ -85,7 +84,7 @@ func _updateQuestList(): questList.deselect_all() for questKey in QUEST.quests: var q = QUEST.quests[questKey] - var n = q.questName; + var n = q.title; if q.isCompleted(): n += " (Complete)" elif q.isStarted():