@@ -38,6 +38,9 @@ const Interactor = preload("../interaction_system/inventory_interactor.gd")
3838
3939@onready var stack_popup_menu : PopupMenu = $ StackPopupMenu
4040
41+
42+ var alternative_inventory : Inventory
43+
4144func _ready ():
4245 stack_popup_menu .id_pressed .connect (_on_stack_popup_menu_id_pressed )
4346 # TODO connect
@@ -68,6 +71,7 @@ func _ready():
6871
6972 # player_craft_station_ui.input_inventory_ui.request_transfer_to.connect(_request_transfer_to)
7073 other_craft_station_ui .input_inventory_ui .request_transfer_to .connect (_request_transfer_to )
74+ other_craft_station_ui .input_inventory_ui .request_fast_transfer .connect (_request_fast_transfer )
7175 other_craft_station_ui .input_inventory_ui .request_split .connect (_request_split )
7276
7377 player_craft_station_ui .on_craft .connect (_on_craft )
@@ -124,6 +128,7 @@ func _on_open_inventory(inventory : Inventory):
124128 if character .main_inventory != inventory :
125129 loot_inventory_ui .inventory = inventory
126130 loot_inventory_ui .visible = true
131+ alternative_inventory = loot_inventory_ui .inventory
127132 else :
128133 _open_player_inventory ()
129134
@@ -135,6 +140,7 @@ func _on_open_craft_station(craft_station : CraftStation):
135140 player_craft_station_ui .open (craft_station )
136141 else :
137142 other_craft_station_ui .open (craft_station )
143+ alternative_inventory = craft_station .get_input_inventory ()
138144 hotbar_ui .visible = false
139145 _open_player_inventory ()
140146
@@ -144,11 +150,14 @@ func _on_close_craft_station(craft_station : CraftStation):
144150 player_craft_station_ui .close ()
145151 else :
146152 other_craft_station_ui .close ()
153+ alternative_inventory = null
147154 hotbar_ui .visible = true
148155 _close_player_inventory ()
149156
150157
151- func _on_close_inventory (_inventory : Inventory ):
158+ func _on_close_inventory (inventory : Inventory ):
159+ if character .main_inventory != inventory :
160+ alternative_inventory = null
152161 _close_player_inventory ()
153162
154163
@@ -172,10 +181,11 @@ func _request_transfer_to(inventory: GridInventory, origin_pos: Vector2i, destin
172181func _request_fast_transfer (inventory : GridInventory , origin_pos : Vector2i , amount : int ):
173182 var destination : Inventory
174183 if inventory == player_inventory_ui .inventory :
175- destination = loot_inventory_ui .inventory
184+ if alternative_inventory == null :
185+ return
186+ destination = alternative_inventory
176187 else :
177188 destination = player_inventory_ui .inventory
178- print ("Fast transfer from " , inventory .name , " to " , destination .name , " with amount " , amount , " at position " , origin_pos )
179189 character .transfer (inventory , origin_pos , destination , amount )
180190
181191
0 commit comments