Make held entity nullable (#5923)
This commit is contained in:
@@ -77,10 +77,10 @@ namespace Content.Client.Hands
|
||||
return new HandsGuiState(states, hands.ActiveHand);
|
||||
}
|
||||
|
||||
public EntityUid GetActiveHandEntity()
|
||||
public EntityUid? GetActiveHandEntity()
|
||||
{
|
||||
if (GetPlayerHandsComponent() is not { ActiveHand: { } active } hands)
|
||||
return default;
|
||||
return null;
|
||||
|
||||
return hands.GetHand(active).HeldEntity;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ namespace Content.Client.Hands
|
||||
var pressedEntity = pressedHand.HeldEntity;
|
||||
var activeEntity = activeHand.HeldEntity;
|
||||
|
||||
if (pressedHand == activeHand && activeEntity != default)
|
||||
if (pressedHand == activeHand && activeEntity != null)
|
||||
{
|
||||
// use item in hand
|
||||
// it will always be attack_self() in my heart.
|
||||
@@ -114,14 +114,14 @@ namespace Content.Client.Hands
|
||||
return;
|
||||
}
|
||||
|
||||
if (pressedHand != activeHand && pressedEntity == default)
|
||||
if (pressedHand != activeHand && pressedEntity == null)
|
||||
{
|
||||
// change active hand
|
||||
RaiseNetworkEvent(new RequestSetHandEvent(handName));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pressedHand != activeHand && pressedEntity != default && activeEntity != default)
|
||||
if (pressedHand != activeHand && pressedEntity != null && activeEntity != null)
|
||||
{
|
||||
// use active item on held item
|
||||
RaiseNetworkEvent(new ClientInteractUsingInHandMsg(pressedHand.Name));
|
||||
|
||||
Reference in New Issue
Block a user