From 470fd62e2f84ca60b7b941bd201010e50e0bd830 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Sun, 25 May 2025 14:37:30 -0500 Subject: [PATCH] Consistent SYSTEMS --- locale/en_AU.po | 6 +++ project.godot | 16 +++---- scenes/Singletons/Item.tscn | 3 +- scenes/Singletons/Quest.tscn | 3 +- scenes/Singletons/Recipe.tscn | 10 ++-- scenes/Singletons/UI.tscn | 3 +- scripts/Battle/Battle.gd | 48 ------------------- scripts/Battle/Battle.gd.uid | 1 - scripts/Battle/BattleFighter.gd | 10 ---- scripts/Battle/BattleFighter.gd.uid | 1 - scripts/Cooking/Recipe.gd | 7 ++- scripts/Event/EventPause.gd | 2 - scripts/Singleton/Battle.gd | 9 ---- scripts/Singleton/BattleSystem.gd | 1 + scripts/Singleton/Cooking.gd | 1 - scripts/Singleton/CookingSystem.gd | 1 + .../Singleton/{Event.gd => EventSystem.gd} | 0 scripts/Singleton/EventSystem.gd.uid | 1 + scripts/Singleton/{Item.gd => ItemSystem.gd} | 0 scripts/Singleton/Load.gd | 1 - scripts/Singleton/LoadSystem.gd | 1 + scripts/Singleton/LoadSystem.gd.uid | 1 + .../Singleton/{Locale.gd => LocaleSystem.gd} | 0 scripts/Singleton/LocaleSystem.gd.uid | 1 + .../{Overworld.gd => OverworldSystem.gd} | 2 +- .../Singleton/{Pause.gd => PauseSystem.gd} | 0 .../Singleton/{Quest.gd => QuestSystem.gd} | 0 scripts/Singleton/Recipe.gd | 11 ----- scripts/Singleton/RecipeSystem.gd | 27 +++++++++++ scripts/Singleton/RecipeSystem.gd.uid | 1 + .../{SceneManager.gd => SceneSystem.gd} | 2 +- scripts/Singleton/{UI.gd => UISystem.gd} | 0 scripts/Singleton/UISystem.gd.uid | 1 + scripts/Singleton/{VN.gd => VNSystem.gd} | 0 34 files changed, 65 insertions(+), 106 deletions(-) delete mode 100644 scripts/Battle/Battle.gd delete mode 100644 scripts/Battle/Battle.gd.uid delete mode 100644 scripts/Battle/BattleFighter.gd delete mode 100644 scripts/Battle/BattleFighter.gd.uid delete mode 100644 scripts/Singleton/Battle.gd create mode 100644 scripts/Singleton/BattleSystem.gd delete mode 100644 scripts/Singleton/Cooking.gd create mode 100644 scripts/Singleton/CookingSystem.gd rename scripts/Singleton/{Event.gd => EventSystem.gd} (100%) create mode 100644 scripts/Singleton/EventSystem.gd.uid rename scripts/Singleton/{Item.gd => ItemSystem.gd} (100%) delete mode 100644 scripts/Singleton/Load.gd create mode 100644 scripts/Singleton/LoadSystem.gd create mode 100644 scripts/Singleton/LoadSystem.gd.uid rename scripts/Singleton/{Locale.gd => LocaleSystem.gd} (100%) create mode 100644 scripts/Singleton/LocaleSystem.gd.uid rename scripts/Singleton/{Overworld.gd => OverworldSystem.gd} (89%) rename scripts/Singleton/{Pause.gd => PauseSystem.gd} (100%) rename scripts/Singleton/{Quest.gd => QuestSystem.gd} (100%) delete mode 100644 scripts/Singleton/Recipe.gd create mode 100644 scripts/Singleton/RecipeSystem.gd create mode 100644 scripts/Singleton/RecipeSystem.gd.uid rename scripts/Singleton/{SceneManager.gd => SceneSystem.gd} (95%) rename scripts/Singleton/{UI.gd => UISystem.gd} (100%) create mode 100644 scripts/Singleton/UISystem.gd.uid rename scripts/Singleton/{VN.gd => VNSystem.gd} (100%) diff --git a/locale/en_AU.po b/locale/en_AU.po index f578fa0..7425787 100644 --- a/locale/en_AU.po +++ b/locale/en_AU.po @@ -105,6 +105,12 @@ 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." +# +# RECIPES +# +msgid "recipe.baked_sweet_potato.title" +msgstr "Baked Sweet Potato" + # # SCENES # diff --git a/project.godot b/project.godot index 0417f43..f06f725 100644 --- a/project.godot +++ b/project.godot @@ -17,19 +17,19 @@ config/icon="res://icon.svg" [autoload] -BATTLE="*res://scripts/Singleton/Battle.gd" -COOKING="*res://scripts/Singleton/Cooking.gd" -OVERWORLD="*res://scripts/Singleton/Overworld.gd" +BATTLE="*res://scripts/Singleton/BattleSystem.gd" +COOKING="*res://scripts/Singleton/CookingSystem.gd" +OVERWORLD="*res://scripts/Singleton/OverworldSystem.gd" ITEM="*res://scenes/Singletons/Item.tscn" -PAUSE="*res://scripts/Singleton/Pause.gd" +PAUSE="*res://scripts/Singleton/PauseSystem.gd" QUEST="*res://scenes/Singletons/Quest.tscn" -SCENE_MANAGER="*res://scripts/Singleton/SceneManager.gd" +SCENE_MANAGER="*res://scripts/Singleton/SceneSystem.gd" UI="*res://scenes/Singletons/UI.tscn" -VN="*res://scripts/Singleton/VN.gd" +VN="*res://scripts/Singleton/VNSystem.gd" LOAD="*res://scenes/Singletons/Load.tscn" -EVENT="*res://scripts/Singleton/Event.gd" +EVENT="*res://scripts/Singleton/EventSystem.gd" RECIPE="*res://scenes/Singletons/Recipe.tscn" -LOCALE="*res://scripts/Singleton/Locale.gd" +LOCALE="*res://scripts/Singleton/LocaleSystem.gd" ControllerIcons="*res://addons/controller_icons/ControllerIcons.gd" [display] diff --git a/scenes/Singletons/Item.tscn b/scenes/Singletons/Item.tscn index d558c9d..ff62d52 100644 --- a/scenes/Singletons/Item.tscn +++ b/scenes/Singletons/Item.tscn @@ -1,13 +1,12 @@ [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://bc4c4eqfrnegb" path="res://scripts/Singleton/ItemSystem.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="."] diff --git a/scenes/Singletons/Quest.tscn b/scenes/Singletons/Quest.tscn index a0b6347..f7e2cf4 100644 --- a/scenes/Singletons/Quest.tscn +++ b/scenes/Singletons/Quest.tscn @@ -1,12 +1,11 @@ [gd_scene load_steps=4 format=3 uid="uid://cs3kmmd0rfm8w"] -[ext_resource type="Script" uid="uid://d0060jeyftia7" path="res://scripts/Singleton/Quest.gd" id="1_v2h4q"] +[ext_resource type="Script" uid="uid://dnlg1e8une55l" path="res://scripts/Singleton/QuestSystem.gd" id="1_v2h4q"] [ext_resource type="Script" uid="uid://dn0kxbe85n40f" path="res://scripts/Quest/Quest.gd" id="2_n4ii1"] [ext_resource type="Script" uid="uid://de1ao4huhy0hm" path="res://scripts/Quest/QuestObjective.gd" id="3_l8p7p"] [node name="QuestSystem" type="Node"] script = ExtResource("1_v2h4q") -metadata/_custom_type_script = "uid://d0060jeyftia7" [node name="Quests" type="Node" parent="."] diff --git a/scenes/Singletons/Recipe.tscn b/scenes/Singletons/Recipe.tscn index 62bee23..d33af08 100644 --- a/scenes/Singletons/Recipe.tscn +++ b/scenes/Singletons/Recipe.tscn @@ -1,27 +1,27 @@ [gd_scene load_steps=6 format=3 uid="uid://1l0tymk8cfxu"] -[ext_resource type="Script" uid="uid://j87s6jrx8unn" path="res://scripts/Singleton/Recipe.gd" id="1_o4nv4"] +[ext_resource type="Script" uid="uid://b83k8ksk1dpu2" path="res://scripts/Singleton/RecipeSystem.gd" id="1_o4nv4"] [ext_resource type="Script" uid="uid://dipvg4uwjv6p2" path="res://scripts/Cooking/Recipe.gd" id="2_f5akq"] [ext_resource type="Script" uid="uid://c26aptwsjs044" path="res://scripts/Item/ItemResource.gd" id="3_b8y03"] [sub_resource type="Resource" id="Resource_3dxl6"] script = ExtResource("3_b8y03") -itemType = 2 +itemType = 3 count = 1 metadata/_custom_type_script = "uid://c26aptwsjs044" [sub_resource type="Resource" id="Resource_b8y03"] script = ExtResource("3_b8y03") -itemType = 1 +itemType = 4 count = 1 metadata/_custom_type_script = "uid://c26aptwsjs044" [node name="RecipeSystem" type="Node"] script = ExtResource("1_o4nv4") -metadata/_custom_type_script = "uid://j87s6jrx8unn" -[node name="Ash-Baked Sweet Potato" type="Node" parent="."] +[node name="Baked Sweet Potato" type="Node" parent="."] script = ExtResource("2_f5akq") +title = "recipe.baked_sweet_potato.title" 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/scenes/Singletons/UI.tscn b/scenes/Singletons/UI.tscn index c234689..faa8ca5 100644 --- a/scenes/Singletons/UI.tscn +++ b/scenes/Singletons/UI.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=7 format=3 uid="uid://b5bwpsh0gcicf"] -[ext_resource type="Script" uid="uid://dahhuhiu8u88b" path="res://scripts/Singleton/UI.gd" id="1_g3au4"] +[ext_resource type="Script" uid="uid://kvdgrmutu6hl" path="res://scripts/Singleton/UISystem.gd" id="1_g3au4"] [ext_resource type="PackedScene" uid="uid://verg13jtqwvh" path="res://scenes/UI/DebugMenu.tscn" id="2_is0g4"] [ext_resource type="PackedScene" uid="uid://bfioi52hjn2kf" path="res://scenes/UI/QuestMenu.tscn" id="2_mpokx"] [ext_resource type="PackedScene" uid="uid://bkx3l0kckf4a8" path="res://scenes/UI/VNTextbox.tscn" id="3_btpxp"] @@ -16,7 +16,6 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 script = ExtResource("1_g3au4") -metadata/_custom_type_script = "uid://dahhuhiu8u88b" [node name="QuestMenu" parent="." instance=ExtResource("2_mpokx")] visible = false diff --git a/scripts/Battle/Battle.gd b/scripts/Battle/Battle.gd deleted file mode 100644 index bbd5120..0000000 --- a/scripts/Battle/Battle.gd +++ /dev/null @@ -1,48 +0,0 @@ -class_name Battle -const BattleFighter = preload("res://scripts/Battle/BattleFighter.gd"); - -enum FighterPosition { - LEFT_TOP = 0, - LEFT_CENTER = 1, - LEFT_BOTTOM = 2, - - CENTER_TOP = 3, - CENTER_CENTER = 4, - CENTER_BOTTOM = 5, - - RIGHT_TOP = 6, - RIGHT_CENTER = 7, - RIGHT_BOTTOM = 8, - - ENEMY_DEFAULT = LEFT_CENTER, - PLAYER_DEFAULT = RIGHT_CENTER, -}; - -var fighters:Array = []; - -func addFighter(fighter:BattleFighter, position:FighterPosition): - if fighters.has(position): - push_error("Fighter already exists at position"); - return - fighters[position] = fighter; - -func moveFighter(fighter:BattleFighter, position:FighterPosition): - if fighters.has(position): - push_error("Fighter already exists at position"); - return - if not fighters.has(fighter): - push_error("Fighter does not exist"); - return - removeFighter(fighter); - addFighter(fighter, position); - -func getFightersOfTeam(team:BattleFighter.BattleFighterTeam): - var result = []; - for fighter in fighters: - if fighter.team != team: - continue - result.append(fighter); - return result; - -func removeFighter(fighter:BattleFighter): - fighters.erase(fighter); \ No newline at end of file diff --git a/scripts/Battle/Battle.gd.uid b/scripts/Battle/Battle.gd.uid deleted file mode 100644 index ad1bf1b..0000000 --- a/scripts/Battle/Battle.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://kwijyojokkpm diff --git a/scripts/Battle/BattleFighter.gd b/scripts/Battle/BattleFighter.gd deleted file mode 100644 index 7c2b9bf..0000000 --- a/scripts/Battle/BattleFighter.gd +++ /dev/null @@ -1,10 +0,0 @@ -class_name BattleFighter - -enum BattleFighterTeam { - PLAYER, - ENEMY -}; - -var team:BattleFighterTeam; -var health:int = 100; -var maxHealth:int = 100; \ No newline at end of file diff --git a/scripts/Battle/BattleFighter.gd.uid b/scripts/Battle/BattleFighter.gd.uid deleted file mode 100644 index 57d6853..0000000 --- a/scripts/Battle/BattleFighter.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://daksbecm02l3t diff --git a/scripts/Cooking/Recipe.gd b/scripts/Cooking/Recipe.gd index 7b09e6c..4617447 100644 --- a/scripts/Cooking/Recipe.gd +++ b/scripts/Cooking/Recipe.gd @@ -1,6 +1,11 @@ class_name Recipe extends Node -@export var title:String = "" +enum Type { + BAKED_SWEET_POTATO, +} + +@export_multiline var title:String = "" +@export var type:Type = Type.BAKED_SWEET_POTATO @export var ingredients:Array[ItemResource] = [] @export var outputs:Array[ItemResource] = [] diff --git a/scripts/Event/EventPause.gd b/scripts/Event/EventPause.gd index 881c6ee..f42ddfe 100644 --- a/scripts/Event/EventPause.gd +++ b/scripts/Event/EventPause.gd @@ -1,7 +1,5 @@ class_name EventPause extends "res://scripts/Event/Event.gd" -const PauseSystem = preload("res://scripts/Singleton/Pause.gd") - @export var pauseType:PauseSystem.PauseType = PauseSystem.PauseType.ENTITY_PAUSED @export var entities:Array[Entity] = [] @export var includeInteractee:bool = true diff --git a/scripts/Singleton/Battle.gd b/scripts/Singleton/Battle.gd deleted file mode 100644 index e96e348..0000000 --- a/scripts/Singleton/Battle.gd +++ /dev/null @@ -1,9 +0,0 @@ -extends Node - -const Battle = preload("res://scripts/Battle/Battle.gd"); - -var battle:Battle = null; - -func startBattle(battle:Battle) -> void: - print("start battle"); - self.battle = battle; diff --git a/scripts/Singleton/BattleSystem.gd b/scripts/Singleton/BattleSystem.gd new file mode 100644 index 0000000..b807dee --- /dev/null +++ b/scripts/Singleton/BattleSystem.gd @@ -0,0 +1 @@ +class_name BattleSystem extends Node \ No newline at end of file diff --git a/scripts/Singleton/Cooking.gd b/scripts/Singleton/Cooking.gd deleted file mode 100644 index 61679fd..0000000 --- a/scripts/Singleton/Cooking.gd +++ /dev/null @@ -1 +0,0 @@ -extends Node \ No newline at end of file diff --git a/scripts/Singleton/CookingSystem.gd b/scripts/Singleton/CookingSystem.gd new file mode 100644 index 0000000..8f22e42 --- /dev/null +++ b/scripts/Singleton/CookingSystem.gd @@ -0,0 +1 @@ +class_name CookingSystem extends Node \ No newline at end of file diff --git a/scripts/Singleton/Event.gd b/scripts/Singleton/EventSystem.gd similarity index 100% rename from scripts/Singleton/Event.gd rename to scripts/Singleton/EventSystem.gd diff --git a/scripts/Singleton/EventSystem.gd.uid b/scripts/Singleton/EventSystem.gd.uid new file mode 100644 index 0000000..1d66f0e --- /dev/null +++ b/scripts/Singleton/EventSystem.gd.uid @@ -0,0 +1 @@ +uid://dy8gbmwddma3b diff --git a/scripts/Singleton/Item.gd b/scripts/Singleton/ItemSystem.gd similarity index 100% rename from scripts/Singleton/Item.gd rename to scripts/Singleton/ItemSystem.gd diff --git a/scripts/Singleton/Load.gd b/scripts/Singleton/Load.gd deleted file mode 100644 index 8243788..0000000 --- a/scripts/Singleton/Load.gd +++ /dev/null @@ -1 +0,0 @@ -class_name LoadManager extends Node \ No newline at end of file diff --git a/scripts/Singleton/LoadSystem.gd b/scripts/Singleton/LoadSystem.gd new file mode 100644 index 0000000..31662b0 --- /dev/null +++ b/scripts/Singleton/LoadSystem.gd @@ -0,0 +1 @@ +class_name LoadSystem extends Node \ No newline at end of file diff --git a/scripts/Singleton/LoadSystem.gd.uid b/scripts/Singleton/LoadSystem.gd.uid new file mode 100644 index 0000000..31d1741 --- /dev/null +++ b/scripts/Singleton/LoadSystem.gd.uid @@ -0,0 +1 @@ +uid://07tsn64m0l1y diff --git a/scripts/Singleton/Locale.gd b/scripts/Singleton/LocaleSystem.gd similarity index 100% rename from scripts/Singleton/Locale.gd rename to scripts/Singleton/LocaleSystem.gd diff --git a/scripts/Singleton/LocaleSystem.gd.uid b/scripts/Singleton/LocaleSystem.gd.uid new file mode 100644 index 0000000..f295f0f --- /dev/null +++ b/scripts/Singleton/LocaleSystem.gd.uid @@ -0,0 +1 @@ +uid://ggg3o3aawvh5 diff --git a/scripts/Singleton/Overworld.gd b/scripts/Singleton/OverworldSystem.gd similarity index 89% rename from scripts/Singleton/Overworld.gd rename to scripts/Singleton/OverworldSystem.gd index fdd8300..a565bcd 100644 --- a/scripts/Singleton/Overworld.gd +++ b/scripts/Singleton/OverworldSystem.gd @@ -1,4 +1,4 @@ -extends Node +class_name OverworldSystem extends Node const MAPS:Dictionary[String, String] = { "TestMap": "res://scenes/Maps/TestMap/TestMap.tscn" diff --git a/scripts/Singleton/Pause.gd b/scripts/Singleton/PauseSystem.gd similarity index 100% rename from scripts/Singleton/Pause.gd rename to scripts/Singleton/PauseSystem.gd diff --git a/scripts/Singleton/Quest.gd b/scripts/Singleton/QuestSystem.gd similarity index 100% rename from scripts/Singleton/Quest.gd rename to scripts/Singleton/QuestSystem.gd diff --git a/scripts/Singleton/Recipe.gd b/scripts/Singleton/Recipe.gd deleted file mode 100644 index e6b426f..0000000 --- a/scripts/Singleton/Recipe.gd +++ /dev/null @@ -1,11 +0,0 @@ -class_name RecipeSystem extends Node - -enum Type { - ASH_BAKED_SWEET_POTATO, -} - - - -func _init() -> void: - - pass diff --git a/scripts/Singleton/RecipeSystem.gd b/scripts/Singleton/RecipeSystem.gd new file mode 100644 index 0000000..6e52c86 --- /dev/null +++ b/scripts/Singleton/RecipeSystem.gd @@ -0,0 +1,27 @@ +class_name RecipeSystem extends Node + +var RECIPE_MAP:Dictionary[Recipe.Type, Recipe] = {} + +func _recurseChildren(node:Node) -> void: + if node is Recipe: + var recipe:Recipe = node as Recipe + if recipe.type in RECIPE_MAP: + assert(false, "Duplicate recipe type found: " + str(recipe.type)) + RECIPE_MAP[recipe.type] = recipe + else: + for child in node.get_children(): + _recurseChildren(child) + +func _updateRecipes() -> void: + RECIPE_MAP = {} + _recurseChildren(self) + +func _enter_tree() -> void: + _updateRecipes() + + for recipeType in Recipe.Type.values(): + if !RECIPE_MAP.has(recipeType): + assert(false, "Missing recipe type: " + Recipe.Type.find_key(recipeType)) + +func _init() -> void: + _updateRecipes() diff --git a/scripts/Singleton/RecipeSystem.gd.uid b/scripts/Singleton/RecipeSystem.gd.uid new file mode 100644 index 0000000..87a9cd3 --- /dev/null +++ b/scripts/Singleton/RecipeSystem.gd.uid @@ -0,0 +1 @@ +uid://b83k8ksk1dpu2 diff --git a/scripts/Singleton/SceneManager.gd b/scripts/Singleton/SceneSystem.gd similarity index 95% rename from scripts/Singleton/SceneManager.gd rename to scripts/Singleton/SceneSystem.gd index 34d92a1..c1ff31e 100644 --- a/scripts/Singleton/SceneManager.gd +++ b/scripts/Singleton/SceneSystem.gd @@ -1,4 +1,4 @@ -class_name SceneManager extends Node +class_name SceneSystem extends Node const MainMenu = preload("res://scenes/MainMenu.tscn"); const OverworldScene = preload("res://scenes/Overworld.tscn"); diff --git a/scripts/Singleton/UI.gd b/scripts/Singleton/UISystem.gd similarity index 100% rename from scripts/Singleton/UI.gd rename to scripts/Singleton/UISystem.gd diff --git a/scripts/Singleton/UISystem.gd.uid b/scripts/Singleton/UISystem.gd.uid new file mode 100644 index 0000000..323dfd5 --- /dev/null +++ b/scripts/Singleton/UISystem.gd.uid @@ -0,0 +1 @@ +uid://kvdgrmutu6hl diff --git a/scripts/Singleton/VN.gd b/scripts/Singleton/VNSystem.gd similarity index 100% rename from scripts/Singleton/VN.gd rename to scripts/Singleton/VNSystem.gd