Fix individual decor inventory identity (#128)

This commit is contained in:
Alexander Sellite 2026-09-02 09:51:33 -04:00
parent cab313d69d
commit 5aa723de54
6 changed files with 276 additions and 113 deletions

View file

@ -401,7 +401,8 @@ func _drop_data(_at_position: Vector2, data: Variant) -> void:
else:
_hotbar.assign_item(
slot_index,
StringName(str(payload["item_id"]))
StringName(str(payload["item_id"])),
str(payload.get("entry_key", "")),
)

View file

@ -310,6 +310,7 @@ var _controller_hotbar_assignment_kind: PlayerHotbarType.AssignmentKind = (
PlayerHotbarType.AssignmentKind.EMPTY
)
var _controller_hotbar_identity: StringName
var _controller_hotbar_entry_key: String = ""
var _controller_storage_identity: StringName
var _controller_previous_hotbar_slot: int = 0
var _controller_previous_storage_slot: int = 0
@ -1036,6 +1037,7 @@ func _try_begin_controller_hotbar_placement() -> bool:
PlayerHotbarType.AssignmentKind.EMPTY
)
var identity: StringName
var entry_key: String = ""
if _current_section == Section.COOLER:
var fish_node := focus_owner as CoolerFishSpriteType
if fish_node == null or fish_node.catch_id.is_empty():
@ -1047,6 +1049,7 @@ func _try_begin_controller_hotbar_placement() -> bool:
if slot == null or slot.entry_identity.is_empty():
return false
identity = slot.entry_identity
entry_key = slot.entry_key
if slot.entry_kind == PlayerInventoryLayout.EntryKind.CATCH:
assignment_kind = PlayerHotbarType.AssignmentKind.FISH
else:
@ -1059,7 +1062,9 @@ func _try_begin_controller_hotbar_placement() -> bool:
assignment_kind = PlayerHotbarType.AssignmentKind.ITEM
else:
return false
return _begin_controller_hotbar_placement(assignment_kind, identity)
return _begin_controller_hotbar_placement(
assignment_kind, identity, entry_key
)
func _begin_controller_hotbar_placement_for_item(item_id: StringName) -> bool:
@ -1078,6 +1083,7 @@ func _begin_controller_hotbar_placement_for_item(item_id: StringName) -> bool:
func _begin_controller_hotbar_placement(
assignment_kind: PlayerHotbarType.AssignmentKind,
identity: StringName,
entry_key: String = "",
) -> bool:
if _hotbar == null or identity.is_empty():
return false
@ -1085,6 +1091,7 @@ func _begin_controller_hotbar_placement(
_controller_source_identity = identity
_controller_hotbar_assignment_kind = assignment_kind
_controller_hotbar_identity = identity
_controller_hotbar_entry_key = entry_key
_controller_previous_hotbar_slot = _hotbar.get_selected_slot()
var initial_slot: int = _find_controller_hotbar_assignment(
assignment_kind,
@ -1193,6 +1200,7 @@ func _confirm_controller_hotbar_placement() -> void:
assigned = _hotbar.assign_item(
slot_index,
_controller_hotbar_identity,
_controller_hotbar_entry_key,
)
if assigned:
_release_controller_ownership(true, false)
@ -1212,6 +1220,7 @@ func _return_controller_hotbar_placement_to_storage() -> bool:
_controller_ownership = ControllerOwnership.STORAGE_PLACEMENT
_controller_hotbar_assignment_kind = PlayerHotbarType.AssignmentKind.EMPTY
_controller_hotbar_identity = StringName()
_controller_hotbar_entry_key = ""
_apply_inventory_controller_zone_focus_modes()
_configure_bag_storage_slot_focus()
var target_index: int = clampi(
@ -1237,6 +1246,7 @@ func _release_controller_ownership(
_controller_source_identity = StringName()
_controller_hotbar_assignment_kind = PlayerHotbarType.AssignmentKind.EMPTY
_controller_hotbar_identity = StringName()
_controller_hotbar_entry_key = ""
_controller_storage_identity = StringName()
if prior_ownership == ControllerOwnership.NOTEPAD_ACTIONS:
_set_inventory_notepad_visible(source_section, false)