Fix MoveInteractable input handling race condition
This commit is contained in:
parent
5a562a42ea
commit
c869f82fc0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 342 KiB After Width: | Height: | Size: 131 B |
Binary file not shown.
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 128 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -97,6 +97,7 @@ void UMoveInteractableModificator::Unbind_Implementation()
|
||||
|
||||
void UMoveInteractableModificator::TurnOnHolding()
|
||||
{
|
||||
FScopeLock lock1(&critical);
|
||||
holding = true;
|
||||
ProcessState();
|
||||
distance = (player->GetCameraLocation() - actor->GetActorLocation()).Length();
|
||||
@ -105,6 +106,7 @@ void UMoveInteractableModificator::TurnOnHolding()
|
||||
}
|
||||
void UMoveInteractableModificator::TurnOffHolding()
|
||||
{
|
||||
FScopeLock lock1(&critical);
|
||||
holding = false;
|
||||
ProcessState();
|
||||
AMainGameModeBase::GetWidgetsManager()->AnimateInteractionHint(this, 0, EInputAnimatedWidgetAnimation::Unhold);
|
||||
@ -112,6 +114,7 @@ void UMoveInteractableModificator::TurnOffHolding()
|
||||
|
||||
void UMoveInteractableModificator::TurnOnRotating()
|
||||
{
|
||||
FScopeLock lock1(&critical);
|
||||
rotating = true;
|
||||
player->LockPlayer({ .camera = true });
|
||||
ProcessState();
|
||||
@ -120,6 +123,7 @@ void UMoveInteractableModificator::TurnOnRotating()
|
||||
}
|
||||
void UMoveInteractableModificator::TurnOffRotating()
|
||||
{
|
||||
FScopeLock lock1(&critical);
|
||||
rotating = false;
|
||||
player->UnlockPlayer({ .camera = true });
|
||||
ProcessState();
|
||||
@ -130,7 +134,8 @@ void UMoveInteractableModificator::ProcessState()
|
||||
{
|
||||
if(holding || rotating)
|
||||
{
|
||||
actor->activationLockers.Add(this);
|
||||
if(!actor->activationLockers.Contains(this))
|
||||
actor->activationLockers.Add(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -58,4 +58,5 @@ private:
|
||||
bool rotating = false;
|
||||
class AInteractable* actor = nullptr;
|
||||
class APlayerBase* player = nullptr;
|
||||
FCriticalSection critical;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user