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

@@ -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