This commit is contained in:
Marek Lenczewski
2026-04-02 19:30:44 +02:00
parent c7e6f8f4b5
commit 73af6abeb7
90 changed files with 138 additions and 133 deletions

View File

@@ -0,0 +1,44 @@
extends Node
const PORTAL_SCENE: PackedScene = preload("res://scenes/portal/portal.tscn")
const GATE_SCENE: PackedScene = preload("res://scenes/portal/gate.tscn")
const SPAWN_INTERVAL := 30.0
const MAX_PORTALS := 3
const MIN_DISTANCE := 20.0
const MAX_DISTANCE := 40.0
var portals: Array[Node] = []
var timer := 0.0
func _ready() -> void:
if GameState.portal_position != Vector3.ZERO and not GameState.dungeon_cleared:
call_deferred("_restore_gate")
else:
if GameState.dungeon_cleared:
GameState.clear()
call_deferred("_spawn_portal")
func _restore_gate() -> void:
var gate: Node3D = GATE_SCENE.instantiate()
get_parent().add_child(gate)
gate.global_position = GameState.portal_position
func _process(delta: float) -> void:
timer += delta
if timer >= SPAWN_INTERVAL:
timer = 0.0
_cleanup_dead()
if portals.size() < MAX_PORTALS:
_spawn_portal()
func _spawn_portal() -> void:
var angle: float = randf() * TAU
var distance: float = randf_range(MIN_DISTANCE, MAX_DISTANCE)
var pos := Vector3(cos(angle) * distance, 0, sin(angle) * distance)
var portal: Node3D = PORTAL_SCENE.instantiate()
get_parent().add_child(portal)
portal.global_position = pos
portals.append(portal)
func _cleanup_dead() -> void:
portals = portals.filter(func(p: Node) -> bool: return is_instance_valid(p))

View File

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

129
scenes/world/world.tscn Normal file
View File

@@ -0,0 +1,129 @@
[gd_scene format=3 uid="uid://dy1icabu2ssbw"]
[ext_resource type="Script" uid="uid://h0hts425epc6" path="res://systems/ability_system.gd" id="ability_system"]
[ext_resource type="Script" uid="uid://cysg30lud2ta2" path="res://systems/aggro/aggro_decay.gd" id="aggro_decay"]
[ext_resource type="Script" uid="uid://cyffo1g4uhmwh" path="res://systems/aggro/aggro_events.gd" id="aggro_events"]
[ext_resource type="Script" uid="uid://cm7ehl2pexcst" path="res://systems/aggro/aggro_system.gd" id="aggro_system"]
[ext_resource type="Script" uid="uid://c7gsu2qddsor6" path="res://systems/aggro/aggro_tracker.gd" id="aggro_tracker"]
[ext_resource type="Script" uid="uid://da2jm0awq2lnh" path="res://systems/buff_system.gd" id="buff_system"]
[ext_resource type="Script" uid="uid://ddos7mo8rahou" path="res://systems/cooldown_system.gd" id="cooldown_system"]
[ext_resource type="Script" uid="uid://cbd1bryh0e2dw" path="res://systems/damage_system.gd" id="damage_system"]
[ext_resource type="Script" uid="uid://bwhxu5586lc1l" path="res://systems/enemy_ai_system.gd" id="enemy_ai_system"]
[ext_resource type="Script" uid="uid://b3wkn5118dimy" path="res://systems/health_system.gd" id="health_system"]
[ext_resource type="PackedScene" path="res://scenes/hud/hud.tscn" id="hud"]
[ext_resource type="PackedScene" uid="uid://cdnkbt1f0db7e" path="res://scenes/player/player.tscn" id="player"]
[ext_resource type="Script" uid="uid://cskx6o07iukwh" path="res://scenes/world/portal_spawner.gd" id="portal_spawner"]
[ext_resource type="Script" uid="uid://b1qkvoqvmd21h" path="res://systems/respawn_system.gd" id="respawn_system"]
[ext_resource type="Script" uid="uid://rsnpuf77o0sn" path="res://systems/shield_system.gd" id="shield_system"]
[ext_resource type="Script" uid="uid://c84voxmnaifyt" path="res://systems/spawn_system.gd" id="spawn_system"]
[sub_resource type="NavigationMesh" id="NavigationMesh_1"]
vertices = PackedVector3Array(-49.5, 0.5, -49.5, -49.5, 0.5, 49.5, 49.5, 0.5, 49.5, 49.5, 0.5, -49.5)
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)]
[sub_resource type="Gradient" id="Gradient_1"]
colors = PackedColorArray(0.15, 0.35, 0.05, 1, 0.3, 0.55, 0.1, 1)
[sub_resource type="FastNoiseLite" id="FastNoiseLite_1"]
frequency = 0.05
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_1"]
noise = SubResource("FastNoiseLite_1")
color_ramp = SubResource("Gradient_1")
seamless = true
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ground"]
albedo_texture = SubResource("NoiseTexture2D_1")
uv1_scale = Vector3(15, 15, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_1"]
material = SubResource("StandardMaterial3D_ground")
size = Vector2(100, 100)
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_1"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tavern"]
albedo_color = Color(0.45, 0.3, 0.15, 1)
[sub_resource type="BoxMesh" id="BoxMesh_tavern"]
material = SubResource("StandardMaterial3D_tavern")
size = Vector3(5, 3, 5)
[sub_resource type="BoxShape3D" id="BoxShape3D_tavern"]
size = Vector3(5, 3, 5)
[node name="World" type="Node3D" unique_id=1865233338]
[node name="Systems" type="Node" parent="." unique_id=1813416478]
[node name="HealthSystem" type="Node" parent="Systems" unique_id=221270411]
script = ExtResource("health_system")
[node name="ShieldSystem" type="Node" parent="Systems" unique_id=1790230220]
script = ExtResource("shield_system")
[node name="DamageSystem" type="Node" parent="Systems" unique_id=2146323526]
script = ExtResource("damage_system")
[node name="AbilitySystem" type="Node" parent="Systems" unique_id=391120092]
script = ExtResource("ability_system")
[node name="CooldownSystem" type="Node" parent="Systems" unique_id=99457358]
script = ExtResource("cooldown_system")
[node name="AggroSystem" type="Node" parent="Systems" unique_id=1539448343]
script = ExtResource("aggro_system")
[node name="AggroTracker" type="Node" parent="Systems/AggroSystem" unique_id=1597893665]
script = ExtResource("aggro_tracker")
[node name="AggroDecay" type="Node" parent="Systems/AggroSystem" unique_id=1571705506]
script = ExtResource("aggro_decay")
[node name="AggroEvents" type="Node" parent="Systems/AggroSystem" unique_id=1936723580]
script = ExtResource("aggro_events")
[node name="EnemyAISystem" type="Node" parent="Systems" unique_id=2089718042]
script = ExtResource("enemy_ai_system")
[node name="RespawnSystem" type="Node" parent="Systems" unique_id=1586865573]
script = ExtResource("respawn_system")
[node name="SpawnSystem" type="Node" parent="Systems" unique_id=1099032666]
script = ExtResource("spawn_system")
[node name="BuffSystem" type="Node" parent="Systems" unique_id=1219368182]
script = ExtResource("buff_system")
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="." unique_id=1265843679]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0027503967, 0.014227867, 0.023231506)
navigation_mesh = SubResource("NavigationMesh_1")
[node name="Boden" type="MeshInstance3D" parent="NavigationRegion3D" unique_id=593226019]
mesh = SubResource("PlaneMesh_1")
[node name="BodenCollision" type="StaticBody3D" parent="." unique_id=1112667638]
[node name="CollisionShape3D" type="CollisionShape3D" parent="BodenCollision" unique_id=621554623]
shape = SubResource("WorldBoundaryShape3D_1")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1797472817]
transform = Transform3D(1, 0, 0, 0, 0.707, 0.707, 0, -0.707, 0.707, 0, 10, 0)
shadow_enabled = true
[node name="Taverne" type="StaticBody3D" parent="." unique_id=1978646562]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
[node name="Mesh" type="MeshInstance3D" parent="Taverne" unique_id=2043279810]
mesh = SubResource("BoxMesh_tavern")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Taverne" unique_id=2108564286]
shape = SubResource("BoxShape3D_tavern")
[node name="Player" parent="." unique_id=585018813 instance=ExtResource("player")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -5)
[node name="HUD" parent="." unique_id=763693646 instance=ExtResource("hud")]
[node name="PortalSpawner" type="Node" parent="." unique_id=2100621428]
script = ExtResource("portal_spawner")