Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float Hook_APrimalCharacter_TakeDamage(APrimalCharacter* _this, float Damage, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser)
- {
- if (EventInstigator && EventInstigator != nullptr && EventInstigator->CharacterField())
- {
- ACharacter* character = EventInstigator->CharacterField();
- if (_this ->TargetingTeamField() > 10000 && EventInstigator->TargetingTeamField() > 10000 && character != nullptr && character->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
- {
- APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(character);
- FString descr;
- dino->GetDinoDescriptiveName(&descr);
- Log::GetLog()->warn(descr.ToString());
- if (descr.Contains(L"Direwolf")
- || descr.Contains(L"Therizinosaur")
- || descr.Contains(L"Dragon"))
- {
- UWorld* world = ArkApi::GetApiUtils().GetWorld();
- TArray<AActor*> new_actors;
- TArray<AActor*> actors_ignore;
- TArray<TEnumAsByte<enum EObjectTypeQuery>> types;
- UKismetSystemLibrary::SphereOverlapActors_NEW(world, character->RootComponentField()->RelativeLocationField(),
- static_cast<float>((AntiFireBreath::MinimumEnemyStructureDistanceInFoundations * 300)), &types,
- APrimalStructure::GetPrivateStaticClass(), &actors_ignore,
- &new_actors);
- for (const auto& actor : new_actors)
- {
- APrimalStructure* structure = static_cast<APrimalStructure*>(actor);
- Log::GetLog()->warn(FVector::Distance(character->RootComponentField()->RelativeLocationField(), actor->RootComponentField()->RelativeLocationField()));
- if (structure->TargetingTeamField() != character->TargetingTeamField())
- {
- return 0;
- }
- }
- }
- }
- }return APrimalCharacter_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement