enough for tonight, thinking about adding a custom tooltip but maybe i should focus on other things

This commit is contained in:
Tabby 2026-01-10 23:40:52 +11:00
parent 76c957236b
commit 270dd2a6f6
15 changed files with 213 additions and 5 deletions

BIN
assets/battery.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b0kddtrrun1tc"
path="res://.godot/imported/battery.webp-29ebbc4ec04c0f993175279e162374d5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/battery.webp"
dest_files=["res://.godot/imported/battery.webp-29ebbc4ec04c0f993175279e162374d5.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/big psu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB

40
assets/big psu.png.import Normal file
View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dd5u5obr0c61q"
path="res://.godot/imported/big psu.png-d20e94e5a552e1303554bd6972afdc56.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/big psu.png"
dest_files=["res://.godot/imported/big psu.png-d20e94e5a552e1303554bd6972afdc56.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/small psu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bmstxerbgdq61"
path="res://.godot/imported/small psu.png-8910d553249f30fc51a0f97c315ad4aa.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/small psu.png"
dest_files=["res://.godot/imported/small psu.png-8910d553249f30fc51a0f97c315ad4aa.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -3,3 +3,4 @@ class_name ItemData
@export var item_name : String
@export var icon : Texture2D
@export var value : String

View file

@ -3,6 +3,7 @@ class_name ItemSlot
@export var icon : TextureRect
@export var item: ItemData
@export var label : Label
func _ready() -> void:
update_ui()
@ -10,10 +11,13 @@ func _ready() -> void:
func update_ui():
if not item:
icon.texture = null
label.text = ""
return
icon.texture = item.icon
tooltip_text = item.item_name
label.text = item.value
func _get_drag_data(at_position: Vector2) -> Variant:
if not item:

View file

@ -1,12 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://dgqs20xf7l8c"]
[gd_scene load_steps=4 format=3 uid="uid://dgqs20xf7l8c"]
[ext_resource type="Script" uid="uid://cpd04flfh5nlc" path="res://inv_system/item_slot.gd" id="1_m11ft"]
[ext_resource type="Texture2D" uid="uid://b7jp850fqpa0j" path="res://icon.svg" id="3_0tnt0"]
[node name="ItemSlot" type="Panel" node_paths=PackedStringArray("icon")]
[sub_resource type="LabelSettings" id="LabelSettings_ab1u2"]
outline_size = 5
outline_color = Color(0, 0, 0, 1)
[node name="ItemSlot" type="Panel" node_paths=PackedStringArray("icon", "label")]
custom_minimum_size = Vector2(64, 64)
script = ExtResource("1_m11ft")
icon = NodePath("Icon")
label = NodePath("Icon/Label")
[node name="Icon" type="TextureRect" parent="."]
layout_mode = 1
@ -21,3 +26,20 @@ grow_vertical = 2
texture = ExtResource("3_0tnt0")
expand_mode = 3
stretch_mode = 4
[node name="Label" type="Label" parent="Icon"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -31.0
offset_top = -14.599998
offset_right = 30.999998
offset_bottom = 8.400002
grow_horizontal = 2
grow_vertical = 0
text = "120 GB"
label_settings = SubResource("LabelSettings_ab1u2")
horizontal_alignment = 2

10
items/battery_item.tres Normal file
View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="ItemData" load_steps=3 format=3 uid="uid://bcteljob51wfj"]
[ext_resource type="Texture2D" uid="uid://b0kddtrrun1tc" path="res://assets/battery.webp" id="1_lh7dq"]
[ext_resource type="Script" uid="uid://dccraom7a7e8d" path="res://inv_system/item_data.gd" id="2_4u113"]
[resource]
script = ExtResource("2_4u113")
item_name = "Battery"
icon = ExtResource("1_lh7dq")
metadata/_custom_type_script = "uid://dccraom7a7e8d"

10
items/large_psu_item.tres Normal file
View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="ItemData" load_steps=3 format=3 uid="uid://88v5bcyrgpob"]
[ext_resource type="Texture2D" uid="uid://dd5u5obr0c61q" path="res://assets/big psu.png" id="1_rjw1c"]
[ext_resource type="Script" uid="uid://dccraom7a7e8d" path="res://inv_system/item_data.gd" id="2_i66kx"]
[resource]
script = ExtResource("2_i66kx")
item_name = "Large Power Supply Unit"
icon = ExtResource("1_rjw1c")
metadata/_custom_type_script = "uid://dccraom7a7e8d"

10
items/small_psu_item.tres Normal file
View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="ItemData" load_steps=3 format=3 uid="uid://swd1m0hvep4c"]
[ext_resource type="Texture2D" uid="uid://bmstxerbgdq61" path="res://assets/small psu.png" id="1_62foo"]
[ext_resource type="Script" uid="uid://dccraom7a7e8d" path="res://inv_system/item_data.gd" id="2_x1n7s"]
[resource]
script = ExtResource("2_x1n7s")
item_name = "Small Power Supply Unit"
icon = ExtResource("1_62foo")
metadata/_custom_type_script = "uid://dccraom7a7e8d"

View file

@ -1,12 +1,16 @@
[gd_scene load_steps=8 format=3 uid="uid://dsfal3m4siap2"]
[gd_scene load_steps=12 format=3 uid="uid://dsfal3m4siap2"]
[ext_resource type="Script" uid="uid://c6oycdae5wvjf" path="res://inv_system/inventory.gd" id="1_6uqi0"]
[ext_resource type="Texture2D" uid="uid://dj487wauiay6i" path="res://assets/ewase bins.png" id="1_g14j6"]
[ext_resource type="Script" uid="uid://dal8g1ce37r3w" path="res://demo_scene.gd" id="1_vbegm"]
[ext_resource type="Script" uid="uid://dccraom7a7e8d" path="res://inv_system/item_data.gd" id="2_ehkex"]
[ext_resource type="Resource" uid="uid://bepkdyf7dn1y0" path="res://items/hdd_item.tres" id="3_ykrsh"]
[ext_resource type="Resource" uid="uid://bcteljob51wfj" path="res://items/battery_item.tres" id="5_00tp4"]
[ext_resource type="Resource" uid="uid://c2wbqelme8vy1" path="res://items/ram_item.tres" id="5_g14j6"]
[ext_resource type="Resource" uid="uid://88v5bcyrgpob" path="res://items/large_psu_item.tres" id="6_77dp3"]
[ext_resource type="Resource" uid="uid://swd1m0hvep4c" path="res://items/small_psu_item.tres" id="7_5tkv4"]
[ext_resource type="PackedScene" uid="uid://dgqs20xf7l8c" path="res://inv_system/item_slot.tscn" id="7_xersf"]
[ext_resource type="Script" uid="uid://cbta38dhunndc" path="res://tooltip.gd" id="11_77dp3"]
[node name="Control" type="Control" node_paths=PackedStringArray("bin_inventory", "loot_button")]
layout_mode = 3
@ -18,7 +22,7 @@ grow_vertical = 2
script = ExtResource("1_vbegm")
bin_inventory = NodePath("BinPanel")
loot_button = NodePath("LootButton")
loot_pool = Array[ExtResource("2_ehkex")]([ExtResource("3_ykrsh"), ExtResource("5_g14j6")])
loot_pool = Array[ExtResource("2_ehkex")]([ExtResource("3_ykrsh"), ExtResource("5_g14j6"), ExtResource("5_00tp4"), ExtResource("6_77dp3"), ExtResource("7_5tkv4")])
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1
@ -66,7 +70,6 @@ columns = 5
[node name="ItemSlot" parent="InventoryPanel/MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("7_xersf")]
layout_mode = 2
item = ExtResource("3_ykrsh")
[node name="ItemSlot2" parent="InventoryPanel/MarginContainer/VBoxContainer/ScrollContainer/GridContainer" instance=ExtResource("7_xersf")]
layout_mode = 2
@ -189,4 +192,19 @@ grow_horizontal = 2
grow_vertical = 0
text = "Return to workshop"
[node name="Tooltip" type="PanelContainer" parent="." node_paths=PackedStringArray("tooltip_label")]
layout_mode = 1
offset_right = 161.0
offset_bottom = 40.0
mouse_filter = 2
script = ExtResource("11_77dp3")
tooltip_label = NodePath("VBoxContainer/Label")
[node name="VBoxContainer" type="VBoxContainer" parent="Tooltip"]
layout_mode = 2
[node name="Label" type="Label" parent="Tooltip/VBoxContainer"]
layout_mode = 2
text = "Item Name"
[connection signal="pressed" from="LootButton" to="." method="_on_loot_button_pressed"]

12
tooltip.gd Normal file
View file

@ -0,0 +1,12 @@
extends PanelContainer
@export var tooltip_label : Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
global_position = get_global_mouse_position() + Vector2(1,1)

1
tooltip.gd.uid Normal file
View file

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