Working meta scenes

This commit is contained in:
2025-01-15 22:18:44 -06:00
parent 5344fc4aeb
commit f767dbf966
15 changed files with 144 additions and 86 deletions

View File

@@ -0,0 +1,40 @@
[gd_scene load_steps=8 format=3 uid="uid://tmbx2kit0jyq"]
[ext_resource type="PackedScene" uid="uid://yhtpoum3eek7" path="res://scenes/Entities/Rosa.tscn" id="1_xny00"]
[ext_resource type="PackedScene" uid="uid://dr4b2pmsknuhc" path="res://scenes/Entities/TestNPC.tscn" id="2_p8bk2"]
[ext_resource type="PackedScene" uid="uid://7wjfo6u4dp3h" path="res://scenes/Maps/test.tscn" id="3_dyt66"]
[ext_resource type="PackedScene" uid="uid://cy4r0tp2htivb" path="res://scenes/MapBounds.tscn" id="4_584ld"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_asdol"]
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
sky_energy_multiplier = 0.0
ground_bottom_color = Color(0, 0, 0, 1)
ground_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
[sub_resource type="Sky" id="Sky_weucl"]
sky_material = SubResource("ProceduralSkyMaterial_asdol")
[sub_resource type="Environment" id="Environment_pyuof"]
sky = SubResource("Sky_weucl")
ambient_light_source = 1
[node name="Overworld" type="Node3D"]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_pyuof")
[node name="Rosa" parent="." instance=ExtResource("1_xny00")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.651853, 0.684572, -0.0593004)
[node name="TestNpc" parent="." instance=ExtResource("2_p8bk2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.68747, 0.459578, -0.399262)
[node name="OmniLight3D" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -38.1432, 54.7591, -25.7675)
light_energy = 15.315
omni_range = 281.646
[node name="Map" parent="." instance=ExtResource("3_dyt66")]
[node name="MapBounds" parent="." instance=ExtResource("4_584ld")]
transform = Transform3D(22.0363, 0, 0, 0, 7.5201, 0, 0, 0, 19.278, 1.48402, 2.89779, 1.65935)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://iibqlagufwhm"] [gd_scene load_steps=10 format=3 uid="uid://iibqlagufwhm"]
[ext_resource type="Script" path="res://scripts/System/Systems.gd" id="1_uen2c"] [ext_resource type="Script" path="res://scripts/System/Systems.gd" id="1_uen2c"]
[ext_resource type="Script" path="res://scripts/System/CutsceneSystem.gd" id="2_sf62c"] [ext_resource type="Script" path="res://scripts/System/CutsceneSystem.gd" id="2_sf62c"]
@@ -8,23 +8,24 @@
[ext_resource type="Script" path="res://scripts/System/PauseSystem.gd" id="6_hdi8m"] [ext_resource type="Script" path="res://scripts/System/PauseSystem.gd" id="6_hdi8m"]
[ext_resource type="Script" path="res://scripts/System/BattleSystem.gd" id="7_miqgj"] [ext_resource type="Script" path="res://scripts/System/BattleSystem.gd" id="7_miqgj"]
[ext_resource type="Script" path="res://scripts/System/CookingSystem.gd" id="7_nou1j"] [ext_resource type="Script" path="res://scripts/System/CookingSystem.gd" id="7_nou1j"]
[ext_resource type="Script" path="res://scripts/System/SceneSystem.gd" id="9_budbk"]
[node name="Systems" type="Node3D"] [node name="Systems" type="Node"]
script = ExtResource("1_uen2c") script = ExtResource("1_uen2c")
[node name="Cutscene" type="Node3D" parent="."] [node name="Cutscene" type="Node" parent="."]
script = ExtResource("2_sf62c") script = ExtResource("2_sf62c")
[node name="Item" type="Node3D" parent="."] [node name="Item" type="Node" parent="."]
script = ExtResource("3_nwp6i") script = ExtResource("3_nwp6i")
[node name="Quest" type="Node3D" parent="."] [node name="Quest" type="Node" parent="."]
script = ExtResource("4_d00wi") script = ExtResource("4_d00wi")
[node name="VN" type="Node3D" parent="."] [node name="VN" type="Node" parent="."]
script = ExtResource("5_22p3i") script = ExtResource("5_22p3i")
[node name="Pause" type="Node3D" parent="."] [node name="Pause" type="Node" parent="."]
script = ExtResource("6_hdi8m") script = ExtResource("6_hdi8m")
[node name="Cooking" type="Node" parent="."] [node name="Cooking" type="Node" parent="."]
@@ -32,3 +33,6 @@ script = ExtResource("7_nou1j")
[node name="Battle" type="Node" parent="."] [node name="Battle" type="Node" parent="."]
script = ExtResource("7_miqgj") script = ExtResource("7_miqgj")
[node name="Scene" type="Node" parent="."]
script = ExtResource("9_budbk")

17
scenes/Meta/UI.tscn Normal file
View File

@@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://dfwwtbs3ywcyq"]
[ext_resource type="Theme" uid="uid://dm7ee4aqjr2dl" path="res://Themes/UI Theme.tres" id="1_3b1y4"]
[ext_resource type="PackedScene" uid="uid://bkx3l0kckf4a8" path="res://scenes/UI/VNTextbox.tscn" id="2_x0c4l"]
[node name="UI" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_3b1y4")
[node name="VNTextbox" parent="." instance=ExtResource("2_x0c4l")]
layout_mode = 1
offset_top = -133.0

View File

@@ -1,58 +1,13 @@
[gd_scene load_steps=11 format=3 uid="uid://bdrpqtbwvtivd"] [gd_scene load_steps=4 format=3 uid="uid://bdrpqtbwvtivd"]
[ext_resource type="PackedScene" uid="uid://yhtpoum3eek7" path="res://scenes/Entities/Rosa.tscn" id="1_3u2u0"] [ext_resource type="PackedScene" uid="uid://iibqlagufwhm" path="res://scenes/Meta/Systems.tscn" id="1_3x3uf"]
[ext_resource type="PackedScene" uid="uid://iibqlagufwhm" path="res://scenes/Systems.tscn" id="1_3x3uf"] [ext_resource type="PackedScene" uid="uid://tmbx2kit0jyq" path="res://scenes/Meta/Overworld.tscn" id="2_q3er3"]
[ext_resource type="PackedScene" uid="uid://dr4b2pmsknuhc" path="res://scenes/Entities/TestNPC.tscn" id="2_6f3lj"] [ext_resource type="PackedScene" uid="uid://dfwwtbs3ywcyq" path="res://scenes/Meta/UI.tscn" id="3_jjngg"]
[ext_resource type="PackedScene" uid="uid://7wjfo6u4dp3h" path="res://scenes/Maps/test.tscn" id="4_18e1y"]
[ext_resource type="PackedScene" uid="uid://cy4r0tp2htivb" path="res://scenes/MapBounds.tscn" id="4_gv7tl"]
[ext_resource type="Theme" uid="uid://dm7ee4aqjr2dl" path="res://Themes/UI Theme.tres" id="6_d185f"]
[ext_resource type="PackedScene" uid="uid://bkx3l0kckf4a8" path="res://scenes/UI/VNTextbox.tscn" id="7_nofjj"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_1b6it"]
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
sky_energy_multiplier = 0.0
ground_bottom_color = Color(0, 0, 0, 1)
ground_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
[sub_resource type="Sky" id="Sky_weucl"]
sky_material = SubResource("ProceduralSkyMaterial_1b6it")
[sub_resource type="Environment" id="Environment_18twt"]
sky = SubResource("Sky_weucl")
ambient_light_source = 1
[node name="TestSceneRoot" type="Node3D"] [node name="TestSceneRoot" type="Node3D"]
[node name="Systems" parent="." instance=ExtResource("1_3x3uf")] [node name="Systems" parent="." instance=ExtResource("1_3x3uf")]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="Overworld" parent="." instance=ExtResource("2_q3er3")]
environment = SubResource("Environment_18twt")
[node name="Rosa" parent="." instance=ExtResource("1_3u2u0")] [node name="UI" parent="." instance=ExtResource("3_jjngg")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.651853, 0.684572, -0.0593004)
[node name="TestNpc" parent="." instance=ExtResource("2_6f3lj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.68747, 0.459578, -0.399262)
[node name="OmniLight3D" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -38.1432, 54.7591, -25.7675)
light_energy = 15.315
omni_range = 281.646
[node name="Map" parent="." instance=ExtResource("4_18e1y")]
[node name="MapBounds" parent="." instance=ExtResource("4_gv7tl")]
transform = Transform3D(22.0363, 0, 0, 0, 7.5201, 0, 0, 0, 19.278, 1.48402, 2.89779, 1.65935)
[node name="UI" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("6_d185f")
[node name="VNTextbox" parent="UI" instance=ExtResource("7_nofjj")]
layout_mode = 1
offset_top = -133.0

View File

@@ -1,13 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://dlwauw7qvyxnn"]
[sub_resource type="BoxShape3D" id="BoxShape3D_qpmw6"]
[sub_resource type="BoxMesh" id="BoxMesh_lddii"]
[node name="TestCube" type="StaticBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_qpmw6")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_lddii")

View File

@@ -2,5 +2,6 @@ class_name CookingGame
const VerticalSlice = preload("res://scripts/Cooking/Recipe/VerticalSlice.gd"); const VerticalSlice = preload("res://scripts/Cooking/Recipe/VerticalSlice.gd");
var recipe:CookingRecipe = null; var recipe:CookingRecipe = null;
func _init(recipe:CookingRecipe) -> void: func _init(recipe:CookingRecipe) -> void:
self.recipe = recipe; self.recipe = recipe;

View File

@@ -1,4 +1,8 @@
class_name CookingRecipe class_name CookingRecipe
const ItemStack = preload("res://scripts/Item/ItemStack.gd")
func _init() -> void: func _init() -> void:
pass pass
func getIngredients() -> Array[ItemStack]:
return []

View File

@@ -1,4 +1,10 @@
class_name VerticalSlice extends "res://scripts/Cooking/Recipe/CookingRecipe.gd" class_name VerticalSlice extends "res://scripts/Cooking/Recipe/CookingRecipe.gd"
const ItemSystem = preload("res://scripts/System/ItemSystem.gd")
func _init() -> void: func _init() -> void:
super._init(); super._init();
func getIngredients() -> Array[ItemStack]:
return [
ItemStack.new(ItemSystem.ITEM_POTION, 1)
];

View File

@@ -0,0 +1,11 @@
class_name CookingStartEvent extends "res://scripts/Cutscene/CutsceneEvent.gd"
const CookingGame = preload("res://scripts/Cooking/CookingGame.gd");
var cook:CookingGame;
func _init(cook:CookingGame) -> void:
self.cook = cook;
func start() -> void:
getSystems().COOKING.setCookingGame(self.cook);
getSystems().SCENE.setScene(SceneSystem.DawnScene.COOKING);

View File

@@ -1,17 +1,14 @@
class_name TestCutscene extends "res://scripts/Cutscene/Cutscene.gd" class_name TestCutscene extends "res://scripts/Cutscene/Cutscene.gd"
const OverworldEntity = preload("res://scripts/Entities/OverworldEntity.gd"); const OverworldEntity = preload("res://scripts/Entities/OverworldEntity.gd");
const TextboxEvent = preload("res://scripts/Cutscene/Event/VisualNovel/TextboxEvent.gd"); const CookingStartEvent = preload("res://scripts/Cutscene/Cooking/CookingStartEvent.gd");
const PauseEvent = preload("res://scripts/Cutscene/Event/CutscenePauseEvent.gd");
const OverworldChangeDirectionEvent = preload("res://scripts/Cutscene/Event/Entity/OverworldChangeDirectionEvent.gd");
const BattleStartEvent = preload("res://scripts/Cutscene/Battle/BattleStartEvent.gd");
var battle:Battle = null; var cook:CookingGame;
func _init(speaker:OverworldEntity, interacted:OverworldEntity ) -> void: func _init(speaker:OverworldEntity, interacted:OverworldEntity ) -> void:
battle = Battle.new(); cook = CookingGame.new(VerticalSlice.new());
pass pass
func setupCutscene() -> void: func setupCutscene() -> void:
add([ add([
BattleStartEvent.new(battle), CookingStartEvent.new(cook),
]); ]);

View File

@@ -5,10 +5,10 @@ func interact(interactor:OverworldEntity) -> void:
# var battle = Battle.new(); # var battle = Battle.new();
# getSystems().BATTLE.startBattle(battle); # getSystems().BATTLE.startBattle(battle);
var game = CookingGame.new(VerticalSlice.new()); # var game = CookingGame.new(VerticalSlice.new());
getSystems().COOKING.setCookingGame(game); # getSystems().COOKING.setCookingGame(game);
# getSystems().CUTSCENE.setCurrentCutscene(TestCutscene.new(interactor, self)); getSystems().CUTSCENE.setCurrentCutscene(TestCutscene.new(interactor, self));
pass pass
func updateMovement(delta:float) -> void: func updateMovement(delta:float) -> void:

View File

@@ -17,7 +17,9 @@ class ItemStackTypeComparator:
# Constants # Constants
const ITEM_STACK_SIZE_MAX = 99; const ITEM_STACK_SIZE_MAX = 99;
var ITEM_POTION = preload("res://scripts/Item/Potion.gd").new(); static var ITEM_POTION = preload("res://scripts/Item/Potion.gd").new();
# Class
var inventory:Array[ItemStack] = []; var inventory:Array[ItemStack] = [];
# Methods # Methods
@@ -78,6 +80,23 @@ func removeItem(item: Item, quantity: int) -> void:
if quantity == 0: if quantity == 0:
return return
func removeStack(stack: ItemStack) -> void:
self.removeItem(stack.item, stack.quantity);
func hasItem(item: Item, quantity: int = 1) -> bool:
var totalQuantity = 0
for stack in inventory:
if stack.item != item:
continue
totalQuantity += stack.quantity
if totalQuantity >= quantity:
return true
return false
func sortBy(by:ItemSortType) -> void: func sortBy(by:ItemSortType) -> void:
match by: match by:
ItemSortType.NAME: ItemSortType.NAME:

View File

@@ -1,7 +1,7 @@
class_name QuestSystem extends Node class_name QuestSystem extends Node
var QUEST_EXAMPLE = preload("res://scripts/Quest/QuestExample.gd").new(); static var QUEST_EXAMPLE = preload("res://scripts/Quest/QuestExample.gd").new();
var ALL_QUESTS = [ static var ALL_QUESTS = [
QUEST_EXAMPLE QUEST_EXAMPLE
] ]

View File

@@ -0,0 +1,14 @@
class_name SceneSystem extends Node
enum DawnScene {
MAIN_MENU,
OVERWORLD,
BATTLE,
COOKING
};
var scene:DawnScene = DawnScene.OVERWORLD;
func setScene(newScene:DawnScene) -> void:
print("Setting scene to " + str(newScene));
scene = newScene;

View File

@@ -6,6 +6,7 @@ const VNSystem = preload("res://scripts/System/VNSystem.gd");
const PauseSystem = preload("res://scripts/System/PauseSystem.gd"); const PauseSystem = preload("res://scripts/System/PauseSystem.gd");
const BattleSystem = preload("res://scripts/System/BattleSystem.gd"); const BattleSystem = preload("res://scripts/System/BattleSystem.gd");
const CookingSystem = preload("res://scripts/System/CookingSystem.gd"); const CookingSystem = preload("res://scripts/System/CookingSystem.gd");
const SceneSystem = preload("res://scripts/System/SceneSystem.gd");
var ITEM:ItemSystem; var ITEM:ItemSystem;
var CUTSCENE:CutsceneSystem; var CUTSCENE:CutsceneSystem;
@@ -14,6 +15,7 @@ var VN:VNSystem;
var PAUSE:PauseSystem; var PAUSE:PauseSystem;
var BATTLE:BattleSystem; var BATTLE:BattleSystem;
var COOKING:CookingSystem; var COOKING:CookingSystem;
var SCENE:SceneSystem;
func _ready(): func _ready():
ITEM = $Item; ITEM = $Item;
@@ -23,6 +25,7 @@ func _ready():
PAUSE = $Pause; PAUSE = $Pause;
BATTLE = $Battle; BATTLE = $Battle;
COOKING = $Cooking; COOKING = $Cooking;
SCENE = $Scene;
func _process(delta): func _process(delta):
pass pass