Advertisement
Guest User

Untitled

a guest
Feb 8th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. float Hook_APrimalCharacter_TakeDamage(APrimalCharacter* _this, float Damage, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser)
  2.  
  3. {
  4.  
  5. if (EventInstigator && EventInstigator != nullptr && EventInstigator->CharacterField())
  6. {
  7. ACharacter* character = EventInstigator->CharacterField();
  8. if (_this ->TargetingTeamField() > 10000 && EventInstigator->TargetingTeamField() > 10000 && character != nullptr && character->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
  9. {
  10. APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(character);
  11. FString descr;
  12. dino->GetDinoDescriptiveName(&descr);
  13. Log::GetLog()->warn(descr.ToString());
  14. if (descr.Contains(L"Direwolf")
  15. || descr.Contains(L"Therizinosaur")
  16. || descr.Contains(L"Dragon"))
  17. {
  18.  
  19. UWorld* world = ArkApi::GetApiUtils().GetWorld();
  20. TArray<AActor*> new_actors;
  21. TArray<AActor*> actors_ignore;
  22. TArray<TEnumAsByte<enum EObjectTypeQuery>> types;
  23.  
  24. UKismetSystemLibrary::SphereOverlapActors_NEW(world, character->RootComponentField()->RelativeLocationField(),
  25.  
  26. static_cast<float>((AntiFireBreath::MinimumEnemyStructureDistanceInFoundations * 300)), &types,
  27. APrimalStructure::GetPrivateStaticClass(), &actors_ignore,
  28. &new_actors);
  29.  
  30. for (const auto& actor : new_actors)
  31. {
  32. APrimalStructure* structure = static_cast<APrimalStructure*>(actor);
  33. Log::GetLog()->warn(FVector::Distance(character->RootComponentField()->RelativeLocationField(), actor->RootComponentField()->RelativeLocationField()));
  34. if (structure->TargetingTeamField() != character->TargetingTeamField())
  35. {
  36. return 0;
  37. }
  38.  
  39. }
  40. }
  41. }
  42. }return APrimalCharacter_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement