Advertisement
Guest User

Untitled

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