diff --git a/Cirno.sln.DotSettings.user b/Cirno.sln.DotSettings.user
new file mode 100644
index 00000000..99e56389
--- /dev/null
+++ b/Cirno.sln.DotSettings.user
@@ -0,0 +1,2 @@
+
+ ForceIncluded
\ No newline at end of file
diff --git a/Scenes/test.tscn b/Scenes/test.tscn
index a83d340c..beb9cd9b 100644
--- a/Scenes/test.tscn
+++ b/Scenes/test.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=29 format=4 uid="uid://bv451a8wgty4u"]
+[gd_scene load_steps=28 format=4 uid="uid://bv451a8wgty4u"]
[ext_resource type="Script" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"]
@@ -14,7 +14,6 @@
[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Interactable/Control_Pad.tscn" id="12_hfkf1"]
[ext_resource type="PackedScene" uid="uid://l84on3kv2s52" path="res://Scenes/Door_Horizontal.tscn" id="12_i7i2m"]
[ext_resource type="PackedScene" uid="uid://bnhck5eh0tqxf" path="res://Scenes/Props/MediumTerminal.tscn" id="13_acrmt"]
-[ext_resource type="Script" path="res://addons/ButtonLink/DoorButtonVisualizer.cs" id="14_6cydc"]
[ext_resource type="PackedScene" uid="uid://bqq3q37hugdlj" path="res://Scenes/Door.tscn" id="14_y363m"]
[ext_resource type="PackedScene" uid="uid://bgk7fgwiis425" path="res://Scenes/Props/Box_Red.tscn" id="15_m0y0j"]
[ext_resource type="PackedScene" uid="uid://bc64lr3vlwchq" path="res://Scenes/Door_Vertical.tscn" id="15_mgtvp"]
@@ -286,10 +285,6 @@ Target = NodePath("../Door_vertical")
position = Vector2(-824, 167)
Target = NodePath("../Door_vertical2")
-[node name="ButtonDoorVisualizer" type="Node2D" parent="Factory Tilemaps/ControlPad2"]
-script = ExtResource("14_6cydc")
-TargetPath = NodePath("../../Door_vertical2")
-
[node name="ControlPad4" parent="Factory Tilemaps" node_paths=PackedStringArray("Target") instance=ExtResource("12_hfkf1")]
position = Vector2(-856, 167)
Target = NodePath("../Door_vertical2")
diff --git a/addons/ButtonLink/DoorButtonVisualizer.cs b/addons/ButtonLink/DoorButtonVisualizer.cs
index 0fbcddec..0c80539f 100644
--- a/addons/ButtonLink/DoorButtonVisualizer.cs
+++ b/addons/ButtonLink/DoorButtonVisualizer.cs
@@ -3,25 +3,55 @@
[Tool]
public partial class DoorButtonVisualizer : Node2D
{
- [Export] public NodePath TargetPath; // Expose the Target NodePath in the editor
+ // [Export] public NodePath TargetPath; // Expose the Target NodePath in the editor
+
+ // public override void _Ready()
+ // {
+ //
+ // }
+
+ private Interactable _parent;
+
+ public override void _EnterTree()
+ {
+ var p = GetParent();
+ if (p == null) return;
+ if (p is Interactable parent)
+ {
+ _parent = parent;
+ }
+ //if (_parent == null) return;
+
+
+ }
public override void _Draw()
{
- if (TargetPath == null || !Engine.IsEditorHint())
- return;
+ //var parent = GetParent();
+ if (_parent != null) return;
+
+ //if (GetParent() is not Interactable parent) return;
+ if (!Engine.IsEditorHint()) return;
+
+ // if (TargetPath == null || !Engine.IsEditorHint())
+ // return;
+
+ if (_parent is not Interactable p) return;
+
+ if (p.Target == null) return;
// Get the target node
- Node targetNode = GetNodeOrNull(TargetPath);
- if (targetNode == null || !(targetNode is Node2D target))
- return;
+ // Node targetNode = GetNodeOrNull(TargetPath);
+ // if (targetNode == null || !(targetNode is Node2D target))
+ // return;
// Draw a line to the target
- Vector2 start = GlobalPosition;
- Vector2 end = target.GlobalPosition;
+ var start = GlobalPosition;
+ var end = p.Target.GlobalPosition;
DrawLine(ToLocal(start), ToLocal(end), Colors.Green, 2);
}
-
+
public override void _Process(double delta)
{
// Update the visualization in the editor