diff --git a/Source/LegumeMix/Private/Player/LMMovementComponent.cpp b/Source/LegumeMix/Private/Player/LMMovementComponent.cpp index bebd31b..506e546 100644 --- a/Source/LegumeMix/Private/Player/LMMovementComponent.cpp +++ b/Source/LegumeMix/Private/Player/LMMovementComponent.cpp @@ -265,3 +265,9 @@ void ULMMovementComponent::CrouchToggle(bool Toggle) #pragma endregion +bool ULMMovementComponent::CanAttemptJump() const +{ + return IsJumpAllowed() && + (IsMovingOnGround() || IsFalling()); // Falling included for double-jump and non-zero jump hold time, but validated by character. +} + diff --git a/Source/LegumeMix/Private/Player/LMPlayer.cpp b/Source/LegumeMix/Private/Player/LMPlayer.cpp index 1973219..0f93264 100644 --- a/Source/LegumeMix/Private/Player/LMPlayer.cpp +++ b/Source/LegumeMix/Private/Player/LMPlayer.cpp @@ -105,6 +105,11 @@ int ALMPlayer::RemoveAmmo(const EAmmoType AmmoType, const int Count) const return WeaponManager->RemoveAmmo(AmmoType, Count); } +bool ALMPlayer::CanJumpInternal_Implementation() const +{ + return JumpIsAllowedInternal(); +} + void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager) { UE_LOG(LogTemp, Warning, TEXT("Set weapon manager")) diff --git a/Source/LegumeMix/Public/Player/LMMovementComponent.h b/Source/LegumeMix/Public/Player/LMMovementComponent.h index cd91f05..8d5f1ff 100644 --- a/Source/LegumeMix/Public/Player/LMMovementComponent.h +++ b/Source/LegumeMix/Public/Player/LMMovementComponent.h @@ -92,5 +92,6 @@ private: void EnterSlide(); void ExitSlide(); void PhysSlide(float DeltaTime, int32 Iterations); - bool GetSlideSurface(FHitResult& Hit) const; + bool GetSlideSurface(FHitResult& Hit) const; + virtual bool CanAttemptJump() const override; }; diff --git a/Source/LegumeMix/Public/Player/LMPlayer.h b/Source/LegumeMix/Public/Player/LMPlayer.h index deaf8e3..32d5236 100644 --- a/Source/LegumeMix/Public/Player/LMPlayer.h +++ b/Source/LegumeMix/Public/Player/LMPlayer.h @@ -53,6 +53,8 @@ public: UFUNCTION(BlueprintCallable) int RemoveAmmo(EAmmoType AmmoType, int Count) const; + virtual bool CanJumpInternal_Implementation() const override; + protected: // Called when the game starts or when spawned virtual void BeginPlay() override;