Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Tabby
9a371d6498 was interesting, but i think i prefered it before 2026-01-18 20:47:16 +11:00
12 changed files with 215 additions and 10 deletions

View file

@ -6,6 +6,7 @@ extends Control
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
bin_inventory._ready()
pass # Replace with function body. pass # Replace with function body.

View file

@ -11,6 +11,7 @@ class_name Inventory
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
Locations.update_bubbles(type, filled_slots())
slots.assign(grid.get_children()) slots.assign(grid.get_children())
inv_label.text = inventory_name inv_label.text = inventory_name
for slot in slots: for slot in slots:
@ -36,6 +37,7 @@ func _notification(what: int) -> void:
if data_bk: if data_bk:
data_bk.icon.show() data_bk.icon.show()
data_bk = null data_bk = null
Locations.update_bubbles(type, filled_slots())
#attempts to add the provided item to the inventory, returns true on success #attempts to add the provided item to the inventory, returns true on success
func add_item(item : ItemData) -> bool: func add_item(item : ItemData) -> bool:
@ -43,6 +45,7 @@ func add_item(item : ItemData) -> bool:
if slot.item == null: if slot.item == null:
slot.item = item slot.item = item
slot.update_ui() slot.update_ui()
Locations.update_bubbles(type, filled_slots())
return true # item placed successfully return true # item placed successfully
return false # theres no space to add the item return false # theres no space to add the item

View file

@ -1,4 +1,4 @@
extends PanelContainer extends Inventory
@export var slot : ItemSlot @export var slot : ItemSlot

28
scenes/everywhere.tscn Normal file
View file

@ -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

View file

@ -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()

View file

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

View file

@ -10,6 +10,11 @@ var current_location : Location
@export var move_blocker_panel : PanelContainer @export var move_blocker_panel : PanelContainer
@export var selection_indicator : Panel @export var selection_indicator : Panel
signal moved
@export var ewaste_bubble : Label
@export var workshop_bubble : Label
@export var room_bubble : Label
enum Location{ enum Location{
ewaste, ewaste,
workshop, workshop,
@ -18,6 +23,7 @@ enum Location{
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
hide() hide()
current_location = Location.workshop current_location = Location.workshop
pass # Replace with function body. pass # Replace with function body.
@ -25,7 +31,7 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(delta: float) -> void:
move_blocker_panel.visible = block_moving #move_blocker_panel.visible = block_moving
if current_location == Location.ewaste: if current_location == Location.ewaste:
ewaste_button.self_modulate = selected_color ewaste_button.self_modulate = selected_color
@ -48,7 +54,8 @@ func goto_ewaste():
if current_location == Location.ewaste: if current_location == Location.ewaste:
return return
current_location = Location.ewaste 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(): func goto_workshop():
selection_indicator.reparent(workshop_button) selection_indicator.reparent(workshop_button)
@ -56,7 +63,8 @@ func goto_workshop():
#if current_location == Location.workshop: #if current_location == Location.workshop:
#return #return
current_location = Location.workshop 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(): func goto_room():
selection_indicator.reparent(room_button) selection_indicator.reparent(room_button)
@ -64,4 +72,40 @@ func goto_room():
if current_location == Location.room: if current_location == Location.room:
return return
current_location = Location.room 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

View file

@ -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="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"] [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_radius_bottom_left = 3
corner_detail = 5 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"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qjxm7"]
content_margin_left = 0.0 content_margin_left = 0.0
content_margin_top = 0.0 content_margin_top = 0.0
@ -35,7 +42,7 @@ corner_radius_bottom_right = 3
corner_radius_bottom_left = 3 corner_radius_bottom_left = 3
corner_detail = 5 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 z_index = 3
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -52,6 +59,9 @@ workshop_button = NodePath("PanelContainer/VBoxContainer/MoveWorkshop")
room_button = NodePath("PanelContainer/VBoxContainer/MoveHome") room_button = NodePath("PanelContainer/VBoxContainer/MoveHome")
move_blocker_panel = NodePath("Move blocker") move_blocker_panel = NodePath("Move blocker")
selection_indicator = NodePath("PanelContainer/VBoxContainer/MoveWorkshop/Selected") 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="."] [node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 0 layout_mode = 0
@ -68,6 +78,33 @@ layout_mode = 2
layout_mode = 2 layout_mode = 2
icon = ExtResource("2_qjxm7") 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"] [node name="MoveWorkshop" type="Button" parent="PanelContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
icon = ExtResource("3_1ogtx") icon = ExtResource("3_1ogtx")
@ -82,10 +119,64 @@ grow_vertical = 2
mouse_filter = 2 mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_qjxm7") 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"] [node name="MoveHome" type="Button" parent="PanelContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
icon = ExtResource("4_5p1uq") 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="."] [node name="Move blocker" type="PanelContainer" parent="."]
visible = false visible = false
layout_mode = 0 layout_mode = 0

View file

@ -24,6 +24,7 @@ func _on_play_button_pressed() -> void:
Clock.show() Clock.show()
Locations.show() Locations.show()
Locations.goto_workshop() Locations.goto_workshop()
get_tree().change_scene_to_file("res://scenes/everywhere.tscn")
#Locations.current_location = Locations.Location.workshop #Locations.current_location = Locations.Location.workshop
#get_tree().change_scene_to_file("res://scenes/workshop.tscn") #get_tree().change_scene_to_file("res://scenes/workshop.tscn")

View file

@ -6,6 +6,7 @@ extends Control
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
sell_panel._ready()
pass # Replace with function body. pass # Replace with function body.

View file

@ -6,6 +6,7 @@ extends Control
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
crafting_inv._ready()
pass # Replace with function body. pass # Replace with function body.

View file

@ -62,7 +62,7 @@ offset_top = 189.0
offset_right = 1039.0 offset_right = 1039.0
offset_bottom = 444.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) modulate = Color(1, 0.31965953, 0.2533799, 1)
layout_mode = 0 layout_mode = 0
offset_left = 893.0 offset_left = 893.0
@ -70,7 +70,13 @@ offset_top = 486.0
offset_right = 1026.0 offset_right = 1026.0
offset_bottom = 573.0 offset_bottom = 573.0
script = ExtResource("4_0t7iv") 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"] [node name="MarginContainer" type="MarginContainer" parent="TrashSlot"]
layout_mode = 2 layout_mode = 2
@ -90,7 +96,10 @@ horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="TrashSlot/MarginContainer/VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="TrashSlot/MarginContainer/VBoxContainer"]
layout_mode = 2 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 layout_mode = 2
[node name="Button" type="Button" parent="TrashSlot/MarginContainer/VBoxContainer/HBoxContainer"] [node name="Button" type="Button" parent="TrashSlot/MarginContainer/VBoxContainer/HBoxContainer"]