This commit is contained in:
2025-04-29 05:55:53 -05:00
parent 7dd814453e
commit b98fdd0f29
137 changed files with 0 additions and 2021 deletions

View File

@@ -1,11 +0,0 @@
class_name BattleSystem extends Node
const Battle = preload("res://scripts/Battle/Battle.gd");
var battle:Battle = null;
func getSystems():
return get_tree().current_scene.get_node("Systems");
func startBattle(battle:Battle) -> void:
print("start battle");
self.battle = battle;

View File

@@ -1 +0,0 @@
uid://mr6i8copcn37

View File

@@ -1,11 +0,0 @@
class_name CookingSystem extends Node;
const CookingGame = preload("res://scripts/Cooking/CookingGame.gd");
var game:CookingGame = null;
func getSystems():
return get_tree().current_scene.get_node("Systems");
func setCookingGame(game:CookingGame):
self.game = game;
print("CookingSystem: CookingGame set");

View File

@@ -1 +0,0 @@
uid://drcaiuyla2psa

View File

@@ -1,27 +0,0 @@
class_name CutsceneSystem extends Node
const Cutscene = preload("res://scripts/Cutscene/Cutscene.gd");
const PauseSystem = preload("res://scripts/System/PauseSystem.gd");
var currentCutscene:Cutscene = null;
func getSystems():
return get_tree().current_scene.get_node("Systems");
func _process(delta: float) -> void:
if getSystems().PAUSE.getPauseState() == PauseSystem.PauseType.FULLY_PAUSED:
return;
if currentCutscene != null:
currentCutscene.update(delta);
func _exit_tree() -> void:
if currentCutscene != null:
currentCutscene.clear();
func setCurrentCutscene(cutscene:Cutscene) -> void:
if currentCutscene != null:
currentCutscene.clear();
currentCutscene = cutscene;
cutscene.cutsceneSystem = self;
currentCutscene.setupCutscene();

View File

@@ -1 +0,0 @@
uid://d2b7r3t5ownc5

View File

@@ -1,105 +0,0 @@
class_name ItemSystem extends Node
const Item = preload("res://scripts/Item/Item.gd");
const ItemStack = preload("res://scripts/Item/ItemStack.gd");
enum ItemSortType {
NAME,
TYPE
};
class ItemStackNameComparator:
static func _sort(a, b):
return a.item.getName().to_lower() < b.item.getName().to_lower()
class ItemStackTypeComparator:
static func _sort(a, b):
return a.item.getCategory() < b.item.getCategory()
# Constants
const ITEM_STACK_SIZE_MAX = 99;
static var ITEM_POTION = preload("res://scripts/Item/Potion.gd").new();
# Class
var inventory:Array[ItemStack] = [];
# Methods
func addItem(item: Item, quantity: int = 1) -> void:
print("Adding ", quantity, "x ", item.getName());
if !item.isStackable():
# Item cannot be stacked, add each item to inv
for i in range(quantity):
inventory.append(ItemStack.new(item, 1))
return
# Check for existing stacks
for stack in inventory:
if stack.item != item or stack.quantity >= ITEM_STACK_SIZE_MAX:
continue
var spaceAvailable = ITEM_STACK_SIZE_MAX - stack.quantity
if quantity <= spaceAvailable:
stack.quantity += quantity;
return
stack.quantity = ITEM_STACK_SIZE_MAX;
quantity -= spaceAvailable;
# Add any remaining inventory as new stack.
while quantity > 0:
var newStackQuantity = min(quantity, ITEM_STACK_SIZE_MAX);
inventory.append(ItemStack.new(item, newStackQuantity));
quantity -= newStackQuantity;
func removeItem(item: Item, quantity: int) -> void:
var totalQuantity = 0
# Calculate total quantity of the item in the inventory
for stack in inventory:
if stack.item != item:
continue
totalQuantity += stack.quantity
if totalQuantity < quantity:
push_error("Not enough quantity to remove");
return
# Remove the quantity from the stacks
for stack in inventory:
if stack.item != item:
continue
if stack.quantity < quantity:
quantity -= stack.quantity
inventory.erase(stack)
stack.quantity -= quantity
if stack.quantity == 0:
inventory.erase(stack)
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:
inventory.sort_custom(ItemStackNameComparator._sort)
ItemSortType.TYPE:
inventory.sort_custom(ItemStackTypeComparator._sort)

View File

@@ -1 +0,0 @@
uid://bc4c4eqfrnegb

View File

@@ -1,37 +0,0 @@
class_name PauseSystem extends Node
enum PauseType {
# Completely unpaused
NOT_PAUSED,
# Fully paused, with no exceptions to anything
FULLY_PAUSED,
# Specific entities are paused
ENTITY_PAUSED,
# All entities are paused unless specified
CUTSCENE_PAUSED
};
var pauseType:PauseType = PauseType.NOT_PAUSED;
var entities:Array = [];
var playerPaused:bool = false;
func getPauseState() -> PauseType:
if isPlayerPaused():
return PauseType.FULLY_PAUSED;
return pauseType;
func pause(
pauseType:PauseType,
entities:Array = [],
) -> void:
self.pauseType = pauseType;
self.entities = entities;
func unpause() -> void:
self.pauseType = PauseType.NOT_PAUSED;
func isPlayerPaused() -> bool:
return playerPaused;
func playerPauseToggle() -> void:
playerPaused = !playerPaused;

View File

@@ -1 +0,0 @@
uid://bontk8ex2kxkb

View File

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

View File

@@ -1 +0,0 @@
uid://dnlg1e8une55l

View File

@@ -1,45 +0,0 @@
class_name SceneSystem extends Node
const MainMenu = preload("res://scenes/MainMenu.tscn");
const OverworldScene = preload("res://scenes/Meta/Overworld.tscn");
enum DawnScene {
MAIN_MENU,
OVERWORLD,
BATTLE,
COOKING
};
var scene:DawnScene = DawnScene.OVERWORLD;
func getMainMenuScene():
return get_tree().current_scene.get_node("MainMenu");
func setScene(newScene:DawnScene) -> void:
print("Setting scene to " + str(newScene));
scene = newScene;
if newScene == DawnScene.MAIN_MENU:
# Remove all non essential scenes
# Add Main menu scene if not present
var mainMenu = getMainMenuScene();
if mainMenu == null:
var instance = MainMenu.instantiate(PackedScene.GEN_EDIT_STATE_DISABLED);
get_tree().current_scene.add_child(instance);
return
if newScene == DawnScene.OVERWORLD:
# Remove all non essential scenes
var mainMenuScene = getMainMenuScene();
if mainMenuScene != null:
mainMenuScene.queue_free();
# Add Overworld scene if not present
var overworld = get_tree().current_scene.get_node("OverworldScene");
if overworld == null:
var instance = OverworldScene.instantiate(PackedScene.GEN_EDIT_STATE_DISABLED);
get_tree().current_scene.add_child(instance);
return
# error
print("Scene not found: " + str(newScene));

View File

@@ -1 +0,0 @@
uid://bbd8gcx6byjhf

View File

@@ -1,31 +0,0 @@
class_name Systems extends Node
const ItemSystem = preload("res://scripts/System/ItemSystem.gd");
const CutsceneSystem = preload("res://scripts/System/CutsceneSystem.gd");
const QuestSystem = preload("res://scripts/System/QuestSystem.gd");
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;
var QUEST:QuestSystem;
var VN:VNSystem;
var PAUSE:PauseSystem;
var BATTLE:BattleSystem;
var COOKING:CookingSystem;
var SCENE:SceneSystem;
func _ready():
ITEM = $Item;
CUTSCENE = $Cutscene;
QUEST = $Quest;
VN = $VN;
PAUSE = $Pause;
BATTLE = $Battle;
COOKING = $Cooking;
SCENE = $Scene;
func _process(delta):
pass

View File

@@ -1 +0,0 @@
uid://cj8athi16655p

View File

@@ -1,8 +0,0 @@
class_name VNSystem extends Node
const VNTextbox = preload("res://scripts/UI/VNTextbox.gd")
func getSystems():
return get_tree().current_scene.get_node("Systems");
func getTextbox() -> VNTextbox:
return get_tree().current_scene.get_node("UI/VNTextbox") as VNTextbox;

View File

@@ -1 +0,0 @@
uid://chux5imw4pse6