@ -1,10 +1,13 @@ | |||||
[gd_scene load_steps=3 format=3 uid="uid://cgx0nawwjjj7g"] | |||||
[gd_scene load_steps=4 format=3 uid="uid://cgx0nawwjjj7g"] | |||||
[ext_resource type="PackedScene" uid="uid://c0epfh4sqjcjq" path="res://data_structure/db_items.tscn" id="1_pyidc"] | [ext_resource type="PackedScene" uid="uid://c0epfh4sqjcjq" path="res://data_structure/db_items.tscn" id="1_pyidc"] | ||||
[ext_resource type="PackedScene" uid="uid://mkfitwqnerku" path="res://scenes/world/world.tscn" id="2_vvh5c"] | [ext_resource type="PackedScene" uid="uid://mkfitwqnerku" path="res://scenes/world/world.tscn" id="2_vvh5c"] | ||||
[ext_resource type="PackedScene" uid="uid://c7fj7wla8bd70" path="res://scenes/ui/ui.tscn" id="3_vvh5c"] | |||||
[node name="Root" type="Node"] | [node name="Root" type="Node"] | ||||
[node name="DBItems" parent="." instance=ExtResource("1_pyidc")] | [node name="DBItems" parent="." instance=ExtResource("1_pyidc")] | ||||
[node name="World" parent="." instance=ExtResource("2_vvh5c")] | [node name="World" parent="." instance=ExtResource("2_vvh5c")] | ||||
[node name="UI" parent="." instance=ExtResource("3_vvh5c")] |
@ -0,0 +1,12 @@ | |||||
extends RayCast3D | |||||
func _process(_delta: float) -> void: | |||||
if is_colliding(): | |||||
var collider: Object = get_collider() | |||||
if collider is Block: | |||||
var id: String = collider.get_id() | |||||
Waila.ref.hook_target(id) | |||||
else: | |||||
Waila.ref.release_target() # Not seeing anything |
@ -0,0 +1 @@ | |||||
uid://bruuttf8j7wet |
@ -0,0 +1,24 @@ | |||||
[gd_scene load_steps=2 format=3 uid="uid://c7fj7wla8bd70"] | |||||
[ext_resource type="PackedScene" uid="uid://dvogu3djluqsn" path="res://scenes/ui/waila.tscn" id="1_u7n8c"] | |||||
[node name="UI" type="CanvasLayer"] | |||||
[node name="Crosshair" type="CenterContainer" parent="."] | |||||
anchors_preset = 15 | |||||
anchor_right = 1.0 | |||||
anchor_bottom = 1.0 | |||||
grow_horizontal = 2 | |||||
grow_vertical = 2 | |||||
[node name="HSeparator" type="HSeparator" parent="Crosshair"] | |||||
custom_minimum_size = Vector2(16, 16) | |||||
layout_mode = 2 | |||||
mouse_filter = 2 | |||||
[node name="VSeparator" type="VSeparator" parent="Crosshair"] | |||||
custom_minimum_size = Vector2(16, 16) | |||||
layout_mode = 2 | |||||
mouse_filter = 2 | |||||
[node name="Waila" parent="." instance=ExtResource("1_u7n8c")] |
@ -0,0 +1,33 @@ | |||||
## What Am I Looking At (Waila) | |||||
class_name Waila | |||||
extends MarginContainer | |||||
#region Singleton | |||||
static var ref: Waila | |||||
func _init() -> void: | |||||
if not ref: | |||||
ref = self | |||||
else: | |||||
queue_free() | |||||
#endregion | |||||
@onready var name_label: Label = $PanelContainer/MarginContainer/VBoxContainer/Name | |||||
@onready var description_label: Label = $PanelContainer/MarginContainer/VBoxContainer/Description | |||||
func _ready() -> void: | |||||
release_target() | |||||
func hook_target(id: String) -> void: | |||||
var item: ItemResource = DBItems.ref.data[id] | |||||
name_label.text = item.name | |||||
description_label.text = item.description | |||||
visible = true | |||||
## Not looking at anything, hide Waila | |||||
func release_target() -> void: | |||||
visible = false |
@ -0,0 +1 @@ | |||||
uid://b76vloo54ieyo |
@ -0,0 +1,42 @@ | |||||
[gd_scene load_steps=2 format=3 uid="uid://dvogu3djluqsn"] | |||||
[ext_resource type="Script" uid="uid://b76vloo54ieyo" path="res://scenes/ui/waila.gd" id="1_j6ccr"] | |||||
[node name="Waila" type="MarginContainer"] | |||||
editor_description = "What am I looking at (Waila)" | |||||
anchors_preset = 5 | |||||
anchor_left = 0.5 | |||||
anchor_right = 0.5 | |||||
offset_left = -20.0 | |||||
offset_right = 20.0 | |||||
offset_bottom = 40.0 | |||||
grow_horizontal = 2 | |||||
theme_override_constants/margin_left = 8 | |||||
theme_override_constants/margin_top = 8 | |||||
theme_override_constants/margin_right = 8 | |||||
theme_override_constants/margin_bottom = 8 | |||||
script = ExtResource("1_j6ccr") | |||||
[node name="PanelContainer" type="PanelContainer" parent="."] | |||||
layout_mode = 2 | |||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] | |||||
layout_mode = 2 | |||||
theme_override_constants/margin_left = 8 | |||||
theme_override_constants/margin_top = 8 | |||||
theme_override_constants/margin_right = 8 | |||||
theme_override_constants/margin_bottom = 8 | |||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"] | |||||
layout_mode = 2 | |||||
[node name="Name" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"] | |||||
layout_mode = 2 | |||||
theme_type_variation = &"HeaderSmall" | |||||
text = "Entity Name" | |||||
horizontal_alignment = 1 | |||||
[node name="Description" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"] | |||||
layout_mode = 2 | |||||
text = "Entity Description (longer than name usually)" | |||||
horizontal_alignment = 1 |