Fixed an issue where the player did not select the first item slot, but the item in their hand would become the item they just picked up.

解决玩家选中的不是第一个物品槽,但是手中持有的物品会变成刚刚捡起的物品的问题。
This commit is contained in:
Cold-Mint 2024-07-05 22:56:24 +08:00
parent 4aff26d7bc
commit 04858534ba
Signed by: Cold-Mint
GPG Key ID: C5A9BF8A98E0CE99
2 changed files with 3 additions and 2 deletions

View File

@ -340,7 +340,8 @@ public partial class CharacterTemplate : CharacterBody2D
pickAbleTemplate.Sleeping = true; pickAbleTemplate.Sleeping = true;
} }
if (_currentItem == null)
if (_currentItem == null && selectItemSlotNode.GetItem() == item)
{ {
//If the selected item slot in the item container is a newly picked item, and there is no item in the hand, then we put the selected item into the hand. //If the selected item slot in the item container is a newly picked item, and there is no item in the hand, then we put the selected item into the hand.
//如果物品容器内选中的物品槽是刚刚捡到的物品,且手里没有物品持有,那么我们将选中的物品放到手上。 //如果物品容器内选中的物品槽是刚刚捡到的物品,且手里没有物品持有,那么我们将选中的物品放到手上。

View File

@ -294,7 +294,7 @@ public partial class Player : CharacterTemplate
if (_parabola != null) if (_parabola != null)
{ {
_parabola.Points = new[] { Vector2.Zero }; _parabola.Points = [Vector2.Zero];
} }
ThrowItem(ItemContainer.GetSelectIndex(), 1, GetThrowVelocity()); ThrowItem(ItemContainer.GetSelectIndex(), 1, GetThrowVelocity());