Merge remote-tracking branch 'upstream/main' into PetFixes

This commit is contained in:
jadebenn
2024-12-17 22:42:56 -06:00
114 changed files with 2240 additions and 216 deletions

View File

@@ -2,6 +2,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL
"BankInteractServer.cpp"
"BaseInteractDropLootServer.cpp"
"Binoculars.cpp"
"EnemyClearThreat.cpp"
"ExplodingAsset.cpp"
"FrictionVolumeServer.cpp"
"ForceVolumeServer.cpp"

View File

@@ -0,0 +1,25 @@
#include "EnemyClearThreat.h"
#include "BaseCombatAIComponent.h"
#include "PhysicsComponent.h"
void EnemyClearThreat::OnCollisionPhantom(Entity* self, Entity* target) {
if (!target) return;
const auto colGroup = target->GetCollisionGroup();
if (colGroup == 12) { // enemy
auto* const baseCombatAiComponent = target->GetComponent<BaseCombatAIComponent>();
if (!baseCombatAiComponent) return;
baseCombatAiComponent->ClearThreat();
baseCombatAiComponent->ForceTether();
} else if (colGroup == 10) { // player
const auto enemies = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::BASE_COMBAT_AI);
for (const auto& enemy : enemies) {
auto* const baseCombatAiComponent = enemy->GetComponent<BaseCombatAIComponent>();
if (!baseCombatAiComponent) continue;
baseCombatAiComponent->IgnoreThreat(target->GetObjectID(), 3.0f);
}
}
}

View File

@@ -0,0 +1,11 @@
#ifndef ENEMYCLEARTHREAT_H
#define ENEMYCLEARTHREAT_H
#include "CppScripts.h"
class EnemyClearThreat : public CppScripts::Script {
public:
void OnCollisionPhantom(Entity* self, Entity* target) override;
};
#endif //!ENEMYCLEARTHREAT_H