Skip to content

Commit

Permalink
Fix Ragdolling Grounded
Browse files Browse the repository at this point in the history
  • Loading branch information
RemainingToast committed Dec 13, 2023
1 parent 3c495f6 commit 3dfdb81
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
Binary file modified Content/ALSLyra/Abilities/GA_ALS_Grenade.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/ALSLyra/Character/Animations/MM_Rifle_GrenadeToss.uasset
Binary file not shown.
Binary file modified Content/ALSLyra/Character/B_Als_Hat.uasset
Binary file not shown.
18 changes: 8 additions & 10 deletions Source/ALS/Private/AlsCharacter_Actions.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#include "AbilitySystemComponent.h"
#include "AlsCharacter.h"

#include "AlsAnimationInstance.h"
#include "AlsCharacterMovementComponent.h"
#include "DrawDebugHelpers.h"
#include "Abilities/Tasks/AbilityTask.h"
#include "Components/CapsuleComponent.h"
#include "Components/SkeletalMeshComponent.h"
#include "Engine/NetConnection.h"
#include "Equipment/LyraQuickBarComponent.h"
#include "TimerManager.h"
#include "Components/CapsuleComponent.h"
#include "Components/SkeletalMeshComponent.h"
#include "Engine/NetConnection.h"
#include "Engine/SkeletalMesh.h"
#include "Net/Core/PushModel/PushModel.h"
#include "Player/LyraPlayerController.h"
#include "RootMotionSources/AlsRootMotionSource_Mantling.h"
#include "Settings/AlsCharacterSettings.h"
#include "Utility/AlsConstants.h"
Expand Down Expand Up @@ -972,7 +968,8 @@ void AAlsCharacter::LimitRagdollSpeed() const

bool AAlsCharacter::IsRagdollingAllowedToStop() const
{
return LocomotionAction == AlsLocomotionActionTags::Ragdolling && RagdollingState.Grounded;
bool bGrounded; RagdollTraceGround(bGrounded);
return LocomotionAction == AlsLocomotionActionTags::Ragdolling && bGrounded;
}

bool AAlsCharacter::StopRagdolling()
Expand Down Expand Up @@ -1032,8 +1029,9 @@ void AAlsCharacter::StopRagdollingImplementation()

GetCharacterMovement()->NetworkSmoothingMode = ENetworkSmoothingMode::Exponential;
GetCharacterMovement()->bIgnoreClientMovementErrorChecksAndCorrection = false;

const auto NewActorLocation{RagdollTraceGround(RagdollingState.Grounded)};

bool bGrounded;
const auto NewActorLocation{RagdollTraceGround(bGrounded)};

// Determine whether the ragdoll is facing upward or downward and set the actor rotation accordingly.

Expand Down Expand Up @@ -1085,7 +1083,7 @@ void AAlsCharacter::StopRagdollingImplementation()

AlsCharacterMovement->SetMovementModeLocked(false);

if (RagdollingState.Grounded)
if (bGrounded)
{
GetCharacterMovement()->SetMovementMode(MOVE_Walking);
}
Expand All @@ -1099,7 +1097,7 @@ void AAlsCharacter::StopRagdollingImplementation()

OnRagdollEnded.Broadcast();

if (RagdollingState.Grounded &&
if (bGrounded &&
GetMesh()->GetAnimInstance()->Montage_Play(SelectGetUpMontage(bRagdollFacingUpward), 1.0f,
EMontagePlayReturnType::MontageLength, 0.0f, true))
{
Expand All @@ -1110,7 +1108,7 @@ void AAlsCharacter::StopRagdollingImplementation()
// Re-equip active slot - casting hell...
// TODO: Fix with Activate Ability
// @Game-Change - Start
if (const ALyraPlayerController* PlayerController = Cast<ALyraPlayerController>(GetController()))
if (const APlayerController* PlayerController = Cast<APlayerController>(GetController()))
{
UActorComponent* FoundComponent = PlayerController->FindComponentByClass(ULyraQuickBarComponent::StaticClass());
if (ULyraQuickBarComponent* QuickBar = Cast<ULyraQuickBarComponent>(FoundComponent))
Expand Down
3 changes: 0 additions & 3 deletions Source/ALS/Public/State/AlsRagdollingState.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ USTRUCT(BlueprintType)
struct ALS_API FAlsRagdollingState
{
GENERATED_BODY()

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ALS")
bool Grounded;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ALS")
FVector Velocity{ForceInit};
Expand Down

0 comments on commit 3dfdb81

Please sign in to comment.