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

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

View File

@@ -1,4 +1,8 @@
class_name CookingRecipe
const ItemStack = preload("res://scripts/Item/ItemStack.gd")
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"
const ItemSystem = preload("res://scripts/System/ItemSystem.gd")
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"
const OverworldEntity = preload("res://scripts/Entities/OverworldEntity.gd");
const TextboxEvent = preload("res://scripts/Cutscene/Event/VisualNovel/TextboxEvent.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");
const CookingStartEvent = preload("res://scripts/Cutscene/Cooking/CookingStartEvent.gd");
var battle:Battle = null;
var cook:CookingGame;
func _init(speaker:OverworldEntity, interacted:OverworldEntity ) -> void:
battle = Battle.new();
cook = CookingGame.new(VerticalSlice.new());
pass
func setupCutscene() -> void:
add([
BattleStartEvent.new(battle),
CookingStartEvent.new(cook),
]);

View File

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

View File

@@ -17,7 +17,9 @@ class ItemStackTypeComparator:
# Constants
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] = [];
# Methods
@@ -78,6 +80,23 @@ func removeItem(item: Item, quantity: int) -> void:
if quantity == 0:
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:
match by:
ItemSortType.NAME:

View File

@@ -1,7 +1,7 @@
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
]

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