Skip to content

Commit

Permalink
fix: hides root
Browse files Browse the repository at this point in the history
  • Loading branch information
OctoD committed Feb 5, 2024
1 parent c658ee1 commit 051bd59
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 1 deletion.
6 changes: 6 additions & 0 deletions project/.ggs/1.0.0/equipment/body.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_resource type="EquipmentSlot" format=3 uid="uid://bd54ja7t86kgv"]

[resource]
slot_name = &"body"
accepts_items_with_tags = PackedStringArray("type.armor.torso")
resource_name = "body.tres"
6 changes: 6 additions & 0 deletions project/.ggs/1.0.0/equipment/head.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_resource type="EquipmentSlot" format=3 uid="uid://bwrj6axrvi22f"]

[resource]
slot_name = &"head"
accepts_items_with_tags = PackedStringArray("type.armor.helm")
resource_name = "head.tres"
6 changes: 6 additions & 0 deletions project/.ggs/1.0.0/equipment/ring.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_resource type="EquipmentSlot" format=3 uid="uid://dwpj8cbdscluy"]

[resource]
slot_name = &"ring"
accepts_items_with_tags = PackedStringArray("type.armor.ring")
resource_name = "ring.tres"
6 changes: 6 additions & 0 deletions project/.ggs/1.0.0/equipment/weapon_1.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_resource type="EquipmentSlot" format=3 uid="uid://baqo6tpxywpys"]

[resource]
slot_name = &"weapon_1"
accepts_items_with_tags = PackedStringArray("type.weapon.1h", "type.weapon.2h")
resource_name = "weapon_1.tres"
6 changes: 6 additions & 0 deletions project/.ggs/1.0.0/equipment/weapon_2.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_resource type="EquipmentSlot" format=3 uid="uid://dom3adsfay6i1"]

[resource]
slot_name = &"weapon_2"
accepts_items_with_tags = PackedStringArray("type.weapon.1h")
resource_name = "weapon_2.tres"
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,11 @@ void EquipmentSlotScene::_render_slots_tree()

TypedArray<EquipmentSlot> slots = EquipmentManager::get_singleton()->slots;

TreeItem *root = slots_tree->create_item();

for (int i = 0; i < slots.size(); i++)
{
TreeItem *slot_item = slots_tree->create_item();
TreeItem *slot_item = root->create_child();
Variant slot_variant = slots[i];
EquipmentSlot *slot = cast_to<EquipmentSlot>(slot_variant);

Expand Down Expand Up @@ -344,6 +346,7 @@ void EquipmentSlotScene::_ready()
slots_tree->connect("button_clicked", Callable(this, "_handle_slot_tree_button_clicked"));
slots_tree->connect("item_edited", Callable(this, "_handle_item_edited"));
slots_tree->connect("item_selected", Callable(this, "_handle_slot_item_selected"));
slots_tree->set_hide_root(true);
slots_tree->set_columns(4);
slots_tree->set_column_title(0, tr("Slot name"));
slots_tree->set_column_title(1, tr("Accepts items with tags"));
Expand Down

0 comments on commit 051bd59

Please sign in to comment.