Refactoring

This commit is contained in:
2026-01-07 22:09:56 -06:00
parent fff088a0a7
commit b7716201d8
62 changed files with 110 additions and 78 deletions

5
ConversationElement.gd Normal file
View File

@@ -0,0 +1,5 @@
extends Resource
class_name ConversationElement
@export_node_path("Entity") var entity:NodePath
@export_multiline var label: String

View File

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

View File

@@ -2,7 +2,6 @@ class_name OverworldSingleton extends Node
signal mapChanged(map:PackedScene, playerDestinationNodeName:String)
var newMapPath:String
var hasFadedOut:bool = false
var playerDestinationNodeName:String

View File

@@ -1,4 +1,5 @@
class_name Entity extends CharacterBody3D
const ConversationElement = preload("res://ConversationElement.gd")
enum MovementType {
NONE,
@@ -8,11 +9,15 @@ enum MovementType {
enum InteractType {
NONE,
CONVERSATION,
};
# Movement settings
@export_category("Movement")
@export var movementType:MovementType = MovementType.NONE
# Interaction settings
@export var interactType:InteractType = InteractType.NONE
@export_category("Interactions")
@export var interactType:InteractType = InteractType.NONE
@export var conversation:Array[ConversationElement] = []

View File

@@ -0,0 +1 @@
uid://55jotw6snoi

View File

@@ -4,13 +4,29 @@ const Entity = preload("res://overworld/entity/Entity.gd")
@export var entity:Entity
func isInteractable() -> bool:
return entity && entity.interactType != Entity.InteractType.NONE
func onInteract() -> void:
if !isInteractable():
return
if !entity:
return false
if entity.interactType == Entity.InteractType.NONE:
return
return false
print("Entity Interacted")
if entity.interactType == Entity.InteractType.CONVERSATION:
if entity.conversation.size() == 0:
return false
return true
func _onConversationInteract(_other:Entity) -> void:
print("Starting conversation with ", entity.name)
pass
func onInteract(other:Entity) -> void:
if entity.interactType == Entity.InteractType.NONE:
return
match entity.interactType:
Entity.InteractType.CONVERSATION:
_onConversationInteract(other)
return
_:
pass

View File

@@ -5,11 +5,15 @@ var interactableAreas:Array[EntityInteractableArea] = []
@export var entity:Entity
func hasInteraction() -> bool:
return true
return interactableAreas.size() > 0
func interact() -> void:
for area in interactableAreas:
area.onInteract()
if !area.isInteractable():
continue
area.onInteract(self.entity)
break
func _enter_tree() -> void:
self.area_entered.connect(_onAreaEntered)
@@ -23,11 +27,7 @@ func _onAreaEntered(area:Area3D) -> void:
if area is EntityInteractableArea:
if area.entity == entity:
return
if !area.isInteractable():
return
print("EntityInteractingArea: Area Entered")
interactableAreas.append(area)
func _onAreaExited(area:Area3D) -> void:
print("EntityInteractingArea: Area Exited")
interactableAreas.erase(area)

View File

@@ -1,5 +1,6 @@
class_name EntityMovement extends Node
const GRAVITY = Vector3.DOWN * 100
const FRICTION = 0.01
const WALK_SPEED_DEFAULT = 8
const RUN_SPEED_DEFAULT = 12
@@ -18,7 +19,7 @@ const RUN_SPEED_DEFAULT = 12
#
func _applyGravity() -> void:
if !entity.is_on_floor():
entity.velocity += PHYSICS.GRAVITY * get_process_delta_time()
entity.velocity += GRAVITY * get_process_delta_time()
func _applyPlayerMovement(_delta:float):
if Input.is_action_just_pressed("interact") && interactingArea && interactingArea.hasInteraction():

View File

@@ -1,14 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://d0ywgijpuqy0r"]
[gd_scene load_steps=6 format=3 uid="uid://d0ywgijpuqy0r"]
[ext_resource type="Script" uid="uid://xe6pcuq741xi" path="res://overworld/map/TestMap.gd" id="1_6ms5s"]
[ext_resource type="PackedScene" uid="uid://cluuhtfjeodwb" path="res://overworld/map/TestMapBase.tscn" id="1_ox0si"]
[ext_resource type="PackedScene" uid="uid://by4a0r2hp0w6s" path="res://overworld/entity/Entity.tscn" id="2_jmygs"]
[ext_resource type="Script" uid="uid://b40rstjkpompc" path="res://ConversationElement.gd" id="3_p7git"]
[sub_resource type="Resource" id="Resource_p7git"]
script = ExtResource("3_p7git")
entity = NodePath(".")
label = "Hello!"
metadata/_custom_type_script = "uid://b40rstjkpompc"
[node name="TestMap" type="Node3D"]
script = ExtResource("1_6ms5s")
[node name="NotPlayer" parent="." instance=ExtResource("2_jmygs")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00883961, 1.11219, 0.0142021)
interactType = 1
conversation = Array[ExtResource("3_p7git")]([SubResource("Resource_p7git")])
[node name="TestMapBase" parent="." instance=ExtResource("1_ox0si")]

View File

@@ -17,13 +17,12 @@ config/icon="res://icon.svg"
[autoload]
PHYSICS="*res://singleton/GamePhysics.gd"
PAUSE="*res://singleton/Pause.gd"
TRANSITION="*res://singleton/Transition.tscn"
UI="*res://singleton/UI.tscn"
QUEST="*res://singleton/Quest.tscn"
OVERWORLD="*res://singleton/Overworld.gd"
SCENE="*res://singleton/Scene.gd"
UI="*res://ui/UI.tscn"
QUEST="*res://quest/Quest.tscn"
OVERWORLD="*res://overworld/Overworld.gd"
SCENE="*res://scene/Scene.gd"
ControllerIcons="*res://addons/controller_icons/ControllerIcons.gd"
[debug]

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dodd3jx81w40c"]
[ext_resource type="Script" uid="uid://cd4lf5sm2aquv" path="res://singleton/Quest.gd" id="1_u2r0s"]
[ext_resource type="Script" uid="uid://cd4lf5sm2aquv" path="res://quest/Quest.gd" id="1_u2r0s"]
[node name="Quest" type="Node"]
script = ExtResource("1_u2r0s")

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://c0k1t3tyiaojl"]
[ext_resource type="Script" uid="uid://dpvccegdmn7s6" path="res://meta/OverworldScene.gd" id="1_fa54r"]
[ext_resource type="Script" uid="uid://dpvccegdmn7s6" path="res://scene/OverworldScene.gd" id="1_fa54r"]
[node name="OverworldScene" type="Node3D" node_paths=PackedStringArray("map")]
script = ExtResource("1_fa54r")

View File

@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://ckkewlcugc8ro"]
[ext_resource type="Script" uid="uid://ml70iui7qpo4" path="res://meta/RootScene.gd" id="1_nky1x"]
[ext_resource type="PackedScene" uid="uid://bs41nqi3ocih3" path="res://meta/InitialScene.tscn" id="2_hkmoa"]
[ext_resource type="PackedScene" uid="uid://c0k1t3tyiaojl" path="res://meta/OverworldScene.tscn" id="2_o1wvd"]
[ext_resource type="Script" uid="uid://ml70iui7qpo4" path="res://scene/RootScene.gd" id="1_nky1x"]
[ext_resource type="PackedScene" uid="uid://bs41nqi3ocih3" path="res://scene/InitialScene.tscn" id="2_hkmoa"]
[ext_resource type="PackedScene" uid="uid://c0k1t3tyiaojl" path="res://scene/OverworldScene.tscn" id="2_o1wvd"]
[node name="RootScene" type="Node3D" node_paths=PackedStringArray("overworld", "initial")]
script = ExtResource("1_nky1x")

View File

@@ -16,4 +16,4 @@ func setScene(newScene:SceneType) -> void:
if currentScene == newScene:
return
currentScene = newScene
sceneChanged.emit(currentScene)
sceneChanged.emit(currentScene)

View File

@@ -1,3 +0,0 @@
class_name GamePhysicsSingleton extends Node
const GRAVITY = Vector3.DOWN * 100

View File

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

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://baos0arpiskbp"]
[ext_resource type="PackedScene" uid="uid://bkx3l0kckf4a8" path="res://ui/component/VNTextbox.tscn" id="1_1mtk3"]
[ext_resource type="Script" uid="uid://dq3qyyayugt5l" path="res://singleton/UI.gd" id="1_son71"]
[ext_resource type="Script" uid="uid://dq3qyyayugt5l" path="res://ui/UI.gd" id="1_son71"]
[ext_resource type="PackedScene" uid="uid://c0i5e2dj11d8c" path="res://ui/pause/PauseMenu.tscn" id="2_atyu8"]
[node name="UI" type="Control" node_paths=PackedStringArray("TEXTBOX", "PAUSE")]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://bnodbj3rhtd8v"
path="res://.godot/imported/IllusionBook-Regular.otf-a48250df46ace3f831871b997ec2974c.fontdata"
path="res://.godot/imported/IllusionBook-Regular.otf-4e37b6d8b8e633c2c137ff4f64dc2865.fontdata"
[deps]
source_file="res://fonts/IllusionBook/IllusionBook-Regular.otf"
dest_files=["res://.godot/imported/IllusionBook-Regular.otf-a48250df46ace3f831871b997ec2974c.fontdata"]
source_file="res://ui/fonts/IllusionBook/IllusionBook-Regular.otf"
dest_files=["res://.godot/imported/IllusionBook-Regular.otf-4e37b6d8b8e633c2c137ff4f64dc2865.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://bgmgoufsglbsi"
path="res://.godot/imported/ark-pixel-10px-monospaced-ja.otf-38ba4666a3e1990287b02155293b9445.fontdata"
path="res://.godot/imported/ark-pixel-10px-monospaced-ja.otf-99ae7328f3c4e7aabdea2463a0407d28.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-ja.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-ja.otf-38ba4666a3e1990287b02155293b9445.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-ja.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-ja.otf-99ae7328f3c4e7aabdea2463a0407d28.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://58epv4f0dajy"
path="res://.godot/imported/ark-pixel-10px-monospaced-ko.otf-8341a65ffaff79c5f8b69a457b6b9819.fontdata"
path="res://.godot/imported/ark-pixel-10px-monospaced-ko.otf-07aa893f10acd24fc76958bf5d87853b.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-ko.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-ko.otf-8341a65ffaff79c5f8b69a457b6b9819.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-ko.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-ko.otf-07aa893f10acd24fc76958bf5d87853b.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://37b5j0x5hkfw"
path="res://.godot/imported/ark-pixel-10px-monospaced-latin.otf-9c9dff89c11fd86fe704be6e11ed4ec5.fontdata"
path="res://.godot/imported/ark-pixel-10px-monospaced-latin.otf-830e367b2047379b2ab45987472976bf.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-latin.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-latin.otf-9c9dff89c11fd86fe704be6e11ed4ec5.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-latin.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-latin.otf-830e367b2047379b2ab45987472976bf.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://ctflok6kaqmmr"
path="res://.godot/imported/ark-pixel-10px-monospaced-zh_cn.otf-27baa59740a2826e03022b066005666c.fontdata"
path="res://.godot/imported/ark-pixel-10px-monospaced-zh_cn.otf-1b2d5f435ab9fc2dbdb8cc4da179e90f.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-zh_cn.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-zh_cn.otf-27baa59740a2826e03022b066005666c.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-zh_cn.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-zh_cn.otf-1b2d5f435ab9fc2dbdb8cc4da179e90f.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://bqxsxe2db2cse"
path="res://.godot/imported/ark-pixel-10px-monospaced-zh_hk.otf-bc34ed3d5ef13f516e1e9f634f6c40f9.fontdata"
path="res://.godot/imported/ark-pixel-10px-monospaced-zh_hk.otf-b560e6a7c560c23831b7d7e514396f6f.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-zh_hk.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-zh_hk.otf-bc34ed3d5ef13f516e1e9f634f6c40f9.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-zh_hk.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-zh_hk.otf-b560e6a7c560c23831b7d7e514396f6f.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://b84su101onshd"
path="res://.godot/imported/ark-pixel-10px-monospaced-zh_tr.otf-70b638161ad4133cb5afc42af4d32b4e.fontdata"
path="res://.godot/imported/ark-pixel-10px-monospaced-zh_tr.otf-2fb7bdb96127596e3b077485518866b8.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-zh_tr.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-zh_tr.otf-70b638161ad4133cb5afc42af4d32b4e.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-zh_tr.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-zh_tr.otf-2fb7bdb96127596e3b077485518866b8.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://be77yaondpu24"
path="res://.godot/imported/ark-pixel-10px-monospaced-zh_tw.otf-8ff41aa3f7b844697a8e2fa357d158c0.fontdata"
path="res://.godot/imported/ark-pixel-10px-monospaced-zh_tw.otf-89a0b80ffd53e9723518701b8c2c7e6b.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-zh_tw.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-zh_tw.otf-8ff41aa3f7b844697a8e2fa357d158c0.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/10px/monospaced/ark-pixel-10px-monospaced-zh_tw.otf"
dest_files=["res://.godot/imported/ark-pixel-10px-monospaced-zh_tw.otf-89a0b80ffd53e9723518701b8c2c7e6b.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://bh385kaiy3gju"
path="res://.godot/imported/ark-pixel-12px-monospaced-ja.otf-04d55f6dd91df9f963dc22d5cb3e011e.fontdata"
path="res://.godot/imported/ark-pixel-12px-monospaced-ja.otf-3d9cd72ea3bb06c5b0dfcd78ab3a5b1c.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-ja.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-ja.otf-04d55f6dd91df9f963dc22d5cb3e011e.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-ja.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-ja.otf-3d9cd72ea3bb06c5b0dfcd78ab3a5b1c.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://c8cc3xaq3fkpb"
path="res://.godot/imported/ark-pixel-12px-monospaced-ko.otf-b1318c2eff65e7d693111f676a62222a.fontdata"
path="res://.godot/imported/ark-pixel-12px-monospaced-ko.otf-8c62206e895b40b4d06f67b2d735ecaf.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-ko.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-ko.otf-b1318c2eff65e7d693111f676a62222a.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-ko.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-ko.otf-8c62206e895b40b4d06f67b2d735ecaf.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://ck4rsg0nvvxtq"
path="res://.godot/imported/ark-pixel-12px-monospaced-latin.otf-252d3af5082843874088eb2a25b164b0.fontdata"
path="res://.godot/imported/ark-pixel-12px-monospaced-latin.otf-42f68d985e893bfd95218622eaf3b160.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-latin.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-latin.otf-252d3af5082843874088eb2a25b164b0.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-latin.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-latin.otf-42f68d985e893bfd95218622eaf3b160.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://bdrf0h5ee0d8h"
path="res://.godot/imported/ark-pixel-12px-monospaced-zh_cn.otf-68b621c1e7601219a85b563834031d13.fontdata"
path="res://.godot/imported/ark-pixel-12px-monospaced-zh_cn.otf-917e23c2ab0ca66bf0894f3bad2cdae4.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-zh_cn.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-zh_cn.otf-68b621c1e7601219a85b563834031d13.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-zh_cn.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-zh_cn.otf-917e23c2ab0ca66bf0894f3bad2cdae4.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://87qflu7rgg4l"
path="res://.godot/imported/ark-pixel-12px-monospaced-zh_hk.otf-529004a90ae5661e0d8ee5aa35fa2591.fontdata"
path="res://.godot/imported/ark-pixel-12px-monospaced-zh_hk.otf-9a2cbd8e74c01e3e7e6309684fe87271.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-zh_hk.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-zh_hk.otf-529004a90ae5661e0d8ee5aa35fa2591.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-zh_hk.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-zh_hk.otf-9a2cbd8e74c01e3e7e6309684fe87271.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://detvyvcqc6y1n"
path="res://.godot/imported/ark-pixel-12px-monospaced-zh_tr.otf-a037d4b14237e45c066bf079220cf7ac.fontdata"
path="res://.godot/imported/ark-pixel-12px-monospaced-zh_tr.otf-81d56ce5ad8d6a349efc87b0a7f296b3.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-zh_tr.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-zh_tr.otf-a037d4b14237e45c066bf079220cf7ac.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-zh_tr.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-zh_tr.otf-81d56ce5ad8d6a349efc87b0a7f296b3.fontdata"]
[params]

View File

@@ -3,12 +3,12 @@
importer="font_data_dynamic"
type="FontFile"
uid="uid://bt0devpfk1mt2"
path="res://.godot/imported/ark-pixel-12px-monospaced-zh_tw.otf-027d9d78140dcdd6a0d64a2f7912eaa4.fontdata"
path="res://.godot/imported/ark-pixel-12px-monospaced-zh_tw.otf-33fbe616ea58daa0f8a2a737331425ab.fontdata"
[deps]
source_file="res://fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-zh_tw.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-zh_tw.otf-027d9d78140dcdd6a0d64a2f7912eaa4.fontdata"]
source_file="res://ui/fonts/ark-pixel-font/12px/monospaced/ark-pixel-12px-monospaced-zh_tw.otf"
dest_files=["res://.godot/imported/ark-pixel-12px-monospaced-zh_tw.otf-33fbe616ea58daa0f8a2a737331425ab.fontdata"]
[params]