trash slot blocks travel

This commit is contained in:
Tabby 2026-01-23 14:33:24 +11:00
parent 866d869756
commit 217efd9f9f
4 changed files with 20 additions and 17 deletions

View file

@ -17,7 +17,7 @@ func _ready() -> void:
slot.type = type
if type == "Inventory":
MouseTweaks.player_inventory = self
elif type != "Install":
elif type != "Install" and type != "Trash":
MouseTweaks.other_inventory = self
pass # Replace with function body.

View file

@ -1,17 +1,10 @@
extends PanelContainer
extends Inventory
@export var slot : ItemSlot
#@export var slot : ItemSlot
# 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:
pass
func _on_button_pressed() -> void:
slot.item = null
slot.update_ui()
empty_grid()
#slot.item = null
#slot.update_ui()

View file

@ -3,6 +3,7 @@ extends Control
@export var ewaste_button : Button
@export var computer_button : Button
@export var crafting_inv : Inventory
@export var trash_inv : Inventory
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@ -12,6 +13,7 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
Locations.block_moving = crafting_inv.filled_slots() > 0
Locations.block_moving = trash_inv.filled_slots() > 0
#if crafting_inv.filled_slots() > 0:
#ewaste_button.disabled = true
#computer_button.disabled = true

View file

@ -6,7 +6,7 @@
[ext_resource type="Script" uid="uid://dm7x3etlucffq" path="res://inv_system/trash_slot.gd" id="4_0t7iv"]
[ext_resource type="PackedScene" uid="uid://dgqs20xf7l8c" path="res://inv_system/item_slot.tscn" id="4_4103c"]
[node name="Workshop" type="Control" node_paths=PackedStringArray("ewaste_button", "computer_button", "crafting_inv")]
[node name="Workshop" type="Control" node_paths=PackedStringArray("ewaste_button", "computer_button", "crafting_inv", "trash_inv")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@ -18,6 +18,7 @@ script = ExtResource("1_g1tdj")
ewaste_button = NodePath("GotoEwaste")
computer_button = NodePath("GotoComputer")
crafting_inv = NodePath("CraftingPanel")
trash_inv = NodePath("TrashSlot")
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1
@ -62,7 +63,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("slots", "grid", "inv_label")]
modulate = Color(1, 0.31965953, 0.2533799, 1)
layout_mode = 0
offset_left = 893.0
@ -70,7 +71,11 @@ offset_top = 486.0
offset_right = 1026.0
offset_bottom = 573.0
script = ExtResource("4_0t7iv")
slot = NodePath("MarginContainer/VBoxContainer/HBoxContainer/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")
[node name="MarginContainer" type="MarginContainer" parent="TrashSlot"]
layout_mode = 2
@ -90,7 +95,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"]