// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.


#include "Cheats/OLSCheatManager.h"

#include "GameplayTagContainer.h"
#include "OLSGameplayTags.h"
#include "OLSMessages.h"
#include "Characters/OLSCharacter.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "GameFramework/GameplayMessageSubsystem.h"
#include "Kismet/KismetSystemLibrary.h"

void UOLSCheatManager::CheatModifyMaxSpeed(const float speed)
{
	const TObjectPtr<APlayerController> pController = Cast<APlayerController>(GetOuter());
	if (pController)
	{
		const TObjectPtr<AOLSCharacter> pCharacter = Cast<AOLSCharacter>(pController->GetCharacter());
		if (pCharacter)
		{
			pCharacter->GetCharacterMovement()->MaxWalkSpeed = speed;
		}
	}
}

void UOLSCheatManager::ToggleDebugAnim(const bool shouldEnable) const
{
	FOLSBasicMessage message;
	message.bShouldEnable = shouldEnable;

	UGameplayMessageSubsystem& messageSubsystem = UGameplayMessageSubsystem::Get(this);
	messageSubsystem.BroadcastMessage(FGameplayTag::RequestGameplayTag(GTag_Cheat_Debug_ToggleDebugAnim),
		MoveTemp(message));
}
