Download LyraStarterGame/Source/LyraGame/Cosmetics/LyraCosmeticCheats.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 2.02 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Cosmetics/LyraCosmeticCheats.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/Cosmetics/LyraCosmeticCheats.cpp
-
curl -L -o LyraCosmeticCheats.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Cosmetics/LyraCosmeticCheats.cpp
2.02 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| ////////////////////////////////////////////////////////////////////// | |
| // ULyraCosmeticCheats | |
| ULyraCosmeticCheats::ULyraCosmeticCheats() | |
| { | |
| if (HasAnyFlags(RF_ClassDefaultObject)) | |
| { | |
| UCheatManager::RegisterForOnCheatManagerCreated(FOnCheatManagerCreated::FDelegate::CreateLambda( | |
| [](UCheatManager* CheatManager) | |
| { | |
| CheatManager->AddCheatManagerExtension(NewObject<ThisClass>(CheatManager)); | |
| })); | |
| } | |
| } | |
| void ULyraCosmeticCheats::AddCharacterPart(const FString& AssetName, bool bSuppressNaturalParts) | |
| { | |
| if (ULyraControllerComponent_CharacterParts* CosmeticComponent = GetCosmeticComponent()) | |
| { | |
| TSubclassOf<AActor> PartClass = ULyraDevelopmentStatics::FindClassByShortName<AActor>(AssetName); | |
| if (PartClass != nullptr) | |
| { | |
| FLyraCharacterPart Part; | |
| Part.PartClass = PartClass; | |
| CosmeticComponent->AddCheatPart(Part, bSuppressNaturalParts); | |
| } | |
| } | |
| } | |
| void ULyraCosmeticCheats::ReplaceCharacterPart(const FString& AssetName, bool bSuppressNaturalParts) | |
| { | |
| ClearCharacterPartOverrides(); | |
| AddCharacterPart(AssetName, bSuppressNaturalParts); | |
| } | |
| void ULyraCosmeticCheats::ClearCharacterPartOverrides() | |
| { | |
| if (ULyraControllerComponent_CharacterParts* CosmeticComponent = GetCosmeticComponent()) | |
| { | |
| CosmeticComponent->ClearCheatParts(); | |
| } | |
| } | |
| ULyraControllerComponent_CharacterParts* ULyraCosmeticCheats::GetCosmeticComponent() const | |
| { | |
| if (APlayerController* PC = GetPlayerController()) | |
| { | |
| return PC->FindComponentByClass<ULyraControllerComponent_CharacterParts>(); | |
| } | |
| return nullptr; | |
| } | |