From 9a371d6498b739c7d2b0b48aa622f554019bdac2 Mon Sep 17 00:00:00 2001 From: Tabby <41929769+tabby-cat-nya@users.noreply.github.com> Date: Sun, 18 Jan 2026 20:47:16 +1100 Subject: [PATCH] was interesting, but i think i prefered it before --- demo_scene.gd | 1 + inv_system/inventory.gd | 3 + inv_system/trash_slot.gd | 2 +- scenes/everywhere.tscn | 28 +++++++++ scenes/everywhere_controller.gd | 25 ++++++++ scenes/everywhere_controller.gd.uid | 1 + scenes/manager/location_manager.gd | 52 ++++++++++++++-- scenes/manager/locations panel.tscn | 95 ++++++++++++++++++++++++++++- scenes/menu.gd | 1 + scenes/room.gd | 1 + scenes/workshop.gd | 1 + scenes/workshop.tscn | 15 ++++- 12 files changed, 215 insertions(+), 10 deletions(-) create mode 100644 scenes/everywhere.tscn create mode 100644 scenes/everywhere_controller.gd create mode 100644 scenes/everywhere_controller.gd.uid diff --git a/demo_scene.gd b/demo_scene.gd index 3071c04..cb68db6 100644 --- a/demo_scene.gd +++ b/demo_scene.gd @@ -6,6 +6,7 @@ extends Control # Called when the node enters the scene tree for the first time. func _ready() -> void: + bin_inventory._ready() pass # Replace with function body. diff --git a/inv_system/inventory.gd b/inv_system/inventory.gd index 029a0f6..36caf2a 100644 --- a/inv_system/inventory.gd +++ b/inv_system/inventory.gd @@ -11,6 +11,7 @@ class_name Inventory # Called when the node enters the scene tree for the first time. func _ready() -> void: + Locations.update_bubbles(type, filled_slots()) slots.assign(grid.get_children()) inv_label.text = inventory_name for slot in slots: @@ -36,6 +37,7 @@ func _notification(what: int) -> void: if data_bk: data_bk.icon.show() data_bk = null + Locations.update_bubbles(type, filled_slots()) #attempts to add the provided item to the inventory, returns true on success func add_item(item : ItemData) -> bool: @@ -43,6 +45,7 @@ func add_item(item : ItemData) -> bool: if slot.item == null: slot.item = item slot.update_ui() + Locations.update_bubbles(type, filled_slots()) return true # item placed successfully return false # theres no space to add the item diff --git a/inv_system/trash_slot.gd b/inv_system/trash_slot.gd index ca8dd8f..99e227c 100644 --- a/inv_system/trash_slot.gd +++ b/inv_system/trash_slot.gd @@ -1,4 +1,4 @@ -extends PanelContainer +extends Inventory @export var slot : ItemSlot diff --git a/scenes/everywhere.tscn b/scenes/everywhere.tscn new file mode 100644 index 0000000..aed4ba5 --- /dev/null +++ b/scenes/everywhere.tscn @@ -0,0 +1,28 @@ +[gd_scene load_steps=5 format=3 uid="uid://b5p6vsbegoe4y"] + +[ext_resource type="Script" uid="uid://beop315mc4qii" path="res://scenes/everywhere_controller.gd" id="1_mois3"] +[ext_resource type="PackedScene" uid="uid://dsfal3m4siap2" path="res://scenes/ewaste.tscn" id="2_5hq0i"] +[ext_resource type="PackedScene" uid="uid://dbxymsdyvbe2p" path="res://scenes/workshop.tscn" id="3_1kk7g"] +[ext_resource type="PackedScene" uid="uid://cu2yyw3f2avub" path="res://scenes/room.tscn" id="4_j0itd"] + +[node name="Everywhere" type="Control" node_paths=PackedStringArray("node_ewaste", "node_workshop", "node_room")] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("1_mois3") +node_ewaste = NodePath("ewaste") +node_workshop = NodePath("Workshop") +node_room = NodePath("room") + +[node name="ewaste" parent="." instance=ExtResource("2_5hq0i")] +layout_mode = 1 + +[node name="Workshop" parent="." instance=ExtResource("3_1kk7g")] +layout_mode = 1 + +[node name="room" parent="." instance=ExtResource("4_j0itd")] +layout_mode = 1 diff --git a/scenes/everywhere_controller.gd b/scenes/everywhere_controller.gd new file mode 100644 index 0000000..3bbd17e --- /dev/null +++ b/scenes/everywhere_controller.gd @@ -0,0 +1,25 @@ +extends Control + +@export var node_ewaste : Control +@export var node_workshop : Control +@export var node_room : Control + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + Locations.moved.connect(move_detected) + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + node_ewaste.visible = Locations.current_location == Locations.Location.ewaste + node_workshop.visible = Locations.current_location == Locations.Location.workshop + node_room.visible = Locations.current_location == Locations.Location.room + +func move_detected(): + if Locations.current_location == Locations.Location.ewaste: + node_ewaste._ready() + elif Locations.current_location == Locations.Location.workshop: + node_workshop._ready() + elif Locations.current_location == Locations.Location.room: + node_room._ready() diff --git a/scenes/everywhere_controller.gd.uid b/scenes/everywhere_controller.gd.uid new file mode 100644 index 0000000..523a619 --- /dev/null +++ b/scenes/everywhere_controller.gd.uid @@ -0,0 +1 @@ +uid://beop315mc4qii diff --git a/scenes/manager/location_manager.gd b/scenes/manager/location_manager.gd index 13cce5c..4e9c251 100644 --- a/scenes/manager/location_manager.gd +++ b/scenes/manager/location_manager.gd @@ -10,6 +10,11 @@ var current_location : Location @export var move_blocker_panel : PanelContainer @export var selection_indicator : Panel +signal moved +@export var ewaste_bubble : Label +@export var workshop_bubble : Label +@export var room_bubble : Label + enum Location{ ewaste, workshop, @@ -18,6 +23,7 @@ enum Location{ # Called when the node enters the scene tree for the first time. func _ready() -> void: + hide() current_location = Location.workshop pass # Replace with function body. @@ -25,7 +31,7 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - move_blocker_panel.visible = block_moving + #move_blocker_panel.visible = block_moving if current_location == Location.ewaste: ewaste_button.self_modulate = selected_color @@ -48,7 +54,8 @@ func goto_ewaste(): if current_location == Location.ewaste: return current_location = Location.ewaste - get_tree().change_scene_to_file("res://scenes/ewaste.tscn") + moved.emit() + #get_tree().change_scene_to_file("res://scenes/ewaste.tscn") func goto_workshop(): selection_indicator.reparent(workshop_button) @@ -56,7 +63,8 @@ func goto_workshop(): #if current_location == Location.workshop: #return current_location = Location.workshop - get_tree().change_scene_to_file("res://scenes/workshop.tscn") + moved.emit() + #get_tree().change_scene_to_file("res://scenes/workshop.tscn") func goto_room(): selection_indicator.reparent(room_button) @@ -64,4 +72,40 @@ func goto_room(): if current_location == Location.room: return current_location = Location.room - get_tree().change_scene_to_file("res://scenes/room.tscn") + moved.emit() + #get_tree().change_scene_to_file("res://scenes/room.tscn") + +var filled_loot : int = 0 +var filled_crafting : int = 0 +var filled_trash : int = 0 +var filled_sell : int = 0 +var filled_install : int = 0 +func reset_bubbles(): + filled_loot = 0 + filled_crafting = 0 + filled_trash = 0 + filled_sell = 0 + filled_install = 0 + +func update_bubbles(inventory : String, slots_filled : int): + match inventory: + "Loot": + filled_loot = slots_filled + "Crafting": + filled_crafting = slots_filled + "Trash": + filled_trash = slots_filled + "Sell": + filled_sell = slots_filled + "Install": + filled_install = slots_filled + + ewaste_bubble.text = str(filled_loot) + workshop_bubble.text = str(filled_crafting + filled_trash) + room_bubble.text = str(filled_sell + filled_install) + + ewaste_bubble.get_parent().visible = filled_loot > 0 + workshop_bubble.get_parent().visible = filled_crafting + filled_trash > 0 + room_bubble.get_parent().visible = filled_sell + filled_install > 0 + + pass diff --git a/scenes/manager/locations panel.tscn b/scenes/manager/locations panel.tscn index dd5d8f1..865773e 100644 --- a/scenes/manager/locations panel.tscn +++ b/scenes/manager/locations panel.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://b5dh55o5mgima"] +[gd_scene load_steps=9 format=3 uid="uid://b5dh55o5mgima"] [ext_resource type="Script" uid="uid://bxymsudka4nnb" path="res://scenes/manager/location_manager.gd" id="1_o5d0c"] [ext_resource type="Texture2D" uid="uid://m10v3leibbil" path="res://assets/icons/bin.png" id="2_qjxm7"] @@ -18,6 +18,13 @@ corner_radius_bottom_right = 3 corner_radius_bottom_left = 3 corner_detail = 5 +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1ogtx"] +bg_color = Color(0.86303645, 0, 0.34692708, 1) +corner_radius_top_left = 50 +corner_radius_top_right = 50 +corner_radius_bottom_right = 50 +corner_radius_bottom_left = 50 + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qjxm7"] content_margin_left = 0.0 content_margin_top = 0.0 @@ -35,7 +42,7 @@ corner_radius_bottom_right = 3 corner_radius_bottom_left = 3 corner_detail = 5 -[node name="LocationManager" type="Control" node_paths=PackedStringArray("ewaste_button", "workshop_button", "room_button", "move_blocker_panel", "selection_indicator")] +[node name="LocationManager" type="Control" node_paths=PackedStringArray("ewaste_button", "workshop_button", "room_button", "move_blocker_panel", "selection_indicator", "ewaste_bubble", "workshop_bubble", "room_bubble")] z_index = 3 layout_mode = 3 anchors_preset = 15 @@ -52,6 +59,9 @@ workshop_button = NodePath("PanelContainer/VBoxContainer/MoveWorkshop") room_button = NodePath("PanelContainer/VBoxContainer/MoveHome") move_blocker_panel = NodePath("Move blocker") selection_indicator = NodePath("PanelContainer/VBoxContainer/MoveWorkshop/Selected") +ewaste_bubble = NodePath("PanelContainer/VBoxContainer/MoveEwaste/Bubble/ewasteBubble") +workshop_bubble = NodePath("PanelContainer/VBoxContainer/MoveWorkshop/Bubble2/workshopBubble") +room_bubble = NodePath("PanelContainer/VBoxContainer/MoveHome/Bubble3/roomBubble") [node name="PanelContainer" type="PanelContainer" parent="."] layout_mode = 0 @@ -68,6 +78,33 @@ layout_mode = 2 layout_mode = 2 icon = ExtResource("2_qjxm7") +[node name="Bubble" type="Panel" parent="PanelContainer/VBoxContainer/MoveEwaste"] +z_index = 4 +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -14.0 +offset_top = -13.0 +offset_right = 13.0 +offset_bottom = 14.0 +grow_horizontal = 0 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_1ogtx") + +[node name="ewasteBubble" type="Label" parent="PanelContainer/VBoxContainer/MoveEwaste/Bubble"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "10" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="MoveWorkshop" type="Button" parent="PanelContainer/VBoxContainer"] layout_mode = 2 icon = ExtResource("3_1ogtx") @@ -82,10 +119,64 @@ grow_vertical = 2 mouse_filter = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_qjxm7") +[node name="Bubble2" type="Panel" parent="PanelContainer/VBoxContainer/MoveWorkshop"] +z_index = 4 +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -14.0 +offset_top = -13.0 +offset_right = 13.0 +offset_bottom = 14.0 +grow_horizontal = 0 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_1ogtx") + +[node name="workshopBubble" type="Label" parent="PanelContainer/VBoxContainer/MoveWorkshop/Bubble2"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "10" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="MoveHome" type="Button" parent="PanelContainer/VBoxContainer"] layout_mode = 2 icon = ExtResource("4_5p1uq") +[node name="Bubble3" type="Panel" parent="PanelContainer/VBoxContainer/MoveHome"] +z_index = 4 +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -14.0 +offset_top = -13.0 +offset_right = 13.0 +offset_bottom = 14.0 +grow_horizontal = 0 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_1ogtx") + +[node name="roomBubble" type="Label" parent="PanelContainer/VBoxContainer/MoveHome/Bubble3"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "10" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="Move blocker" type="PanelContainer" parent="."] visible = false layout_mode = 0 diff --git a/scenes/menu.gd b/scenes/menu.gd index 6828e5a..8563f2a 100644 --- a/scenes/menu.gd +++ b/scenes/menu.gd @@ -24,6 +24,7 @@ func _on_play_button_pressed() -> void: Clock.show() Locations.show() Locations.goto_workshop() + get_tree().change_scene_to_file("res://scenes/everywhere.tscn") #Locations.current_location = Locations.Location.workshop #get_tree().change_scene_to_file("res://scenes/workshop.tscn") diff --git a/scenes/room.gd b/scenes/room.gd index e400499..8e81483 100644 --- a/scenes/room.gd +++ b/scenes/room.gd @@ -6,6 +6,7 @@ extends Control # Called when the node enters the scene tree for the first time. func _ready() -> void: + sell_panel._ready() pass # Replace with function body. diff --git a/scenes/workshop.gd b/scenes/workshop.gd index f46f546..812931a 100644 --- a/scenes/workshop.gd +++ b/scenes/workshop.gd @@ -6,6 +6,7 @@ extends Control # Called when the node enters the scene tree for the first time. func _ready() -> void: + crafting_inv._ready() pass # Replace with function body. diff --git a/scenes/workshop.tscn b/scenes/workshop.tscn index 6a3ada9..e5b554f 100644 --- a/scenes/workshop.tscn +++ b/scenes/workshop.tscn @@ -62,7 +62,7 @@ offset_top = 189.0 offset_right = 1039.0 offset_bottom = 444.0 -[node name="TrashSlot" type="PanelContainer" parent="." node_paths=PackedStringArray("slot")] +[node name="TrashSlot" type="PanelContainer" parent="." node_paths=PackedStringArray("slot", "slots", "grid", "inv_label")] modulate = Color(1, 0.31965953, 0.2533799, 1) layout_mode = 0 offset_left = 893.0 @@ -70,7 +70,13 @@ offset_top = 486.0 offset_right = 1026.0 offset_bottom = 573.0 script = ExtResource("4_0t7iv") -slot = NodePath("MarginContainer/VBoxContainer/HBoxContainer/ItemSlot") +slot = NodePath("MarginContainer/VBoxContainer/HBoxContainer/GridContainer/ItemSlot") +inventory_name = "Trash Slot" +slots = [NodePath("MarginContainer/VBoxContainer/HBoxContainer/GridContainer/ItemSlot")] +type = "Trash" +grid = NodePath("MarginContainer/VBoxContainer/HBoxContainer/GridContainer") +inv_label = NodePath("MarginContainer/VBoxContainer/Label") +metadata/_custom_type_script = "uid://c6oycdae5wvjf" [node name="MarginContainer" type="MarginContainer" parent="TrashSlot"] layout_mode = 2 @@ -90,7 +96,10 @@ horizontal_alignment = 1 [node name="HBoxContainer" type="HBoxContainer" parent="TrashSlot/MarginContainer/VBoxContainer"] layout_mode = 2 -[node name="ItemSlot" parent="TrashSlot/MarginContainer/VBoxContainer/HBoxContainer" instance=ExtResource("4_4103c")] +[node name="GridContainer" type="GridContainer" parent="TrashSlot/MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 + +[node name="ItemSlot" parent="TrashSlot/MarginContainer/VBoxContainer/HBoxContainer/GridContainer" instance=ExtResource("4_4103c")] layout_mode = 2 [node name="Button" type="Button" parent="TrashSlot/MarginContainer/VBoxContainer/HBoxContainer"]