From 9897acffacba95960469c83801e98c917f30e6f6 Mon Sep 17 00:00:00 2001 From: Zenny Date: Wed, 21 Jan 2026 00:50:21 -0800 Subject: [PATCH] Unlockable door implementation (currently opens with regular attack) --- Zennysoft.Game.Ma/project.godot | 1 + Zennysoft.Game.Ma/src/map/UnlockableDoor.cs | 17 ++++++++++ .../src/map/dungeon/door/UnlockableDoor.tscn | 17 ++++++++-- .../floors/Special Floors/Overworld.tscn | 32 +++++++++++++++---- 4 files changed, 59 insertions(+), 8 deletions(-) diff --git a/Zennysoft.Game.Ma/project.godot b/Zennysoft.Game.Ma/project.godot index 2c153926..876d4b82 100644 --- a/Zennysoft.Game.Ma/project.godot +++ b/Zennysoft.Game.Ma/project.godot @@ -267,6 +267,7 @@ locale/translations_pot_files=PackedStringArray("res://src/dialog/Dialogue.dialo 3d_physics/layer_10="Minimap" 3d_physics/layer_11="ItemRescue" 3d_physics/layer_12="EnemyHitbox" +3d_physics/layer_13="UnlockableDoor" 3d_physics/layer_32="Navigation" [navigation] diff --git a/Zennysoft.Game.Ma/src/map/UnlockableDoor.cs b/Zennysoft.Game.Ma/src/map/UnlockableDoor.cs index b91ca7e5..8e043d73 100644 --- a/Zennysoft.Game.Ma/src/map/UnlockableDoor.cs +++ b/Zennysoft.Game.Ma/src/map/UnlockableDoor.cs @@ -1,6 +1,23 @@ +using Chickensoft.AutoInject; +using Chickensoft.Introspection; using Godot; +[Meta(typeof(IAutoNode))] public partial class UnlockableDoor : Node3D, IDoor { + public override void _Notification(int what) => this.Notify(what); + [Node] public Area3D UnlockArea { get; set; } + + public void OnReady() + { + UnlockArea.AreaEntered += UnlockArea_AreaEntered; + } + + private void UnlockArea_AreaEntered(Area3D area) + { + var children = GetChildren(); + foreach (var child in children) + child.QueueFree(); + } } diff --git a/Zennysoft.Game.Ma/src/map/dungeon/door/UnlockableDoor.tscn b/Zennysoft.Game.Ma/src/map/dungeon/door/UnlockableDoor.tscn index 0a9ed4aa..e8d4613e 100644 --- a/Zennysoft.Game.Ma/src/map/dungeon/door/UnlockableDoor.tscn +++ b/Zennysoft.Game.Ma/src/map/dungeon/door/UnlockableDoor.tscn @@ -1,6 +1,19 @@ -[gd_scene load_steps=2 format=3 uid="uid://bn5egdkg03f5d"] +[gd_scene load_steps=3 format=3 uid="uid://bn5egdkg03f5d"] [ext_resource type="Script" uid="uid://bxs2sugex0p0i" path="res://src/map/UnlockableDoor.cs" id="4_om2kn"] -[node name="Node3D" type="Node3D"] +[sub_resource type="CylinderShape3D" id="CylinderShape3D_ng7o6"] +height = 4.92334 +radius = 3.72363 + +[node name="UnlockableDoor" type="Node3D"] script = ExtResource("4_om2kn") + +[node name="UnlockArea" type="Area3D" parent="."] +unique_name_in_owner = true +collision_layer = 6144 +collision_mask = 6144 + +[node name="CollisionShape3D" type="CollisionShape3D" parent="UnlockArea"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0334928, -0.760235, 0.758362) +shape = SubResource("CylinderShape3D_ng7o6") diff --git a/Zennysoft.Game.Ma/src/map/dungeon/floors/Special Floors/Overworld.tscn b/Zennysoft.Game.Ma/src/map/dungeon/floors/Special Floors/Overworld.tscn index a365f5c7..dfdb4288 100644 --- a/Zennysoft.Game.Ma/src/map/dungeon/floors/Special Floors/Overworld.tscn +++ b/Zennysoft.Game.Ma/src/map/dungeon/floors/Special Floors/Overworld.tscn @@ -1,10 +1,10 @@ -[gd_scene load_steps=533 format=4 uid="uid://dvnc26rebk6o0"] +[gd_scene load_steps=535 format=4 uid="uid://dvnc26rebk6o0"] [ext_resource type="Script" uid="uid://cuhfkyh3d7noa" path="res://src/map/dungeon/code/Overworld.cs" id="1_5hmt3"] [ext_resource type="Texture2D" uid="uid://co6h8vyi11sl2" path="res://src/map/overworld/Models/Overworld_CLOUD_RINGS_INNER_63.png" id="2_g6b7b"] -[ext_resource type="AudioStream" uid="uid://dv045ax11vybl" path="res://src/audio/AMB/amb_perlin.wav" id="2_wbbo3"] -[ext_resource type="AudioStream" uid="uid://dsc8xu78llst6" path="res://src/audio/AMB/amb_white_noise.wav" id="3_c2gp5"] -[ext_resource type="AudioStream" uid="uid://7hb71ilkd7qh" path="res://src/audio/AMB/amb_beach.wav" id="3_pvi8n"] +[ext_resource type="AudioStream" uid="uid://dqmsaok6fyhe7" path="res://src/audio/AMB/amb_perlin.wav" id="2_wbbo3"] +[ext_resource type="AudioStream" uid="uid://dl07vg00se7hd" path="res://src/audio/AMB/amb_white_noise.wav" id="3_c2gp5"] +[ext_resource type="AudioStream" uid="uid://boypvgaweep8a" path="res://src/audio/AMB/amb_beach.wav" id="3_pvi8n"] [ext_resource type="Texture2D" uid="uid://w33fr6exryiy" path="res://src/map/overworld/Models/Overworld_CLOUD_RINGS_INNER_37.png" id="3_uyygh"] [ext_resource type="Texture2D" uid="uid://dv10yaqvp3mub" path="res://src/map/overworld/Models/Overworld_CLOUD_RINGS_INNER_71.png" id="4_r8r3k"] [ext_resource type="Shader" uid="uid://brhf7s3riyag5" path="res://src/map/map shaders/Metal.gdshader" id="5_d1qcb"] @@ -10110,6 +10110,9 @@ _surfaces = [{ blend_shape_mode = 0 shadow_mesh = SubResource("ArrayMesh_mhnv1") +[sub_resource type="BoxShape3D" id="BoxShape3D_dmxjq"] +size = Vector3(2.49086, 4.52832, 1) + [sub_resource type="ArrayMesh" id="ArrayMesh_1annr"] _surfaces = [{ "aabb": AABB(-0.586693, -2.91569, -0.245125, 1.3548, 4.0161, 0.542034), @@ -10188,6 +10191,9 @@ _surfaces = [{ blend_shape_mode = 0 shadow_mesh = SubResource("ArrayMesh_1annr") +[sub_resource type="BoxShape3D" id="BoxShape3D_q7hpd"] +size = Vector3(2.49086, 4.52832, 1) + [node name="Overworld" type="Node3D"] script = ExtResource("1_5hmt3") @@ -10914,18 +10920,32 @@ collision_mask = 256 shape = SubResource("CylinderShape3D_yksd7") [node name="UnlockableDoor1" parent="." instance=ExtResource("109_dmxjq")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -292.514, 5.53958, 12.2985) [node name="PROS DOOR2" type="MeshInstance3D" parent="UnlockableDoor1"] -transform = Transform3D(0.652364, 0, 0, 0, 0.652364, 0, 0, 0, 0.652364, -292.514, 5.53958, 12.2985) +transform = Transform3D(0.652364, 0, 0, 0, 0.652364, 0, 0, 0, 0.652364, 0, 0, 0) mesh = SubResource("ArrayMesh_jclb5") skeleton = NodePath("") +[node name="StaticBody3D" type="StaticBody3D" parent="UnlockableDoor1"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="UnlockableDoor1/StaticBody3D"] +transform = Transform3D(0.865703, 0, 0.500559, 0, 1, 0, -0.500559, 0, 0.865703, -0.19574, -0.637752, -0.0847492) +shape = SubResource("BoxShape3D_dmxjq") + [node name="UnlockableDoor2" parent="." instance=ExtResource("109_dmxjq")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -181.439, 4.86177, 30.3582) [node name="PROS DOOR 3" type="MeshInstance3D" parent="UnlockableDoor2"] -transform = Transform3D(0.496666, 0, 0, 0, 0.496666, 0, 0, 0, 0.496666, -181.439, 4.86177, 30.3582) +transform = Transform3D(0.496666, 0, 0, 0, 0.496666, 0, 0, 0, 0.496666, 0, 0, 0) mesh = SubResource("ArrayMesh_0kwx0") skeleton = NodePath("") +[node name="StaticBody3D" type="StaticBody3D" parent="UnlockableDoor2"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="UnlockableDoor2/StaticBody3D"] +transform = Transform3D(0.943674, 0, -0.330877, 0, 1, 0, 0.330877, 0, 0.943674, -0.0489807, -0.637752, -0.318357) +shape = SubResource("BoxShape3D_q7hpd") + [editable path="Node3D/Actors/Clalo"] [editable path="Node3D/Actors/Caretaker of Saints"]