Fix rival faction detection: include Faction in fallback TeamId resolution
- GetTeamAttitudeTowards fallback (interface path) was calling MakeTeamId without Faction, so enemies of different factions had identical TeamIds → always Friendly instead of Hostile - Now reads Faction from PersonalityProfile when resolving via interface Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
af93194f48
commit
d471714fbd
@ -368,14 +368,22 @@ ETeamAttitude::Type APS_AI_Behavior_AIController::GetTeamAttitudeTowards(const A
|
||||
}
|
||||
}
|
||||
|
||||
// 3) Fallback: check if Pawn implements IPS_AI_Behavior_Interface → derive TeamId from NPCType
|
||||
// 3) Fallback: check if Pawn implements IPS_AI_Behavior_Interface → derive TeamId from NPCType + Faction
|
||||
if (OtherTeam == FGenericTeamId::NoTeam && OtherPawn->Implements<UPS_AI_Behavior_Interface>())
|
||||
{
|
||||
const EPS_AI_Behavior_NPCType OtherNPCType =
|
||||
IPS_AI_Behavior_Interface::Execute_GetBehaviorNPCType(const_cast<APawn*>(OtherPawn));
|
||||
if (OtherNPCType != EPS_AI_Behavior_NPCType::Any)
|
||||
{
|
||||
OtherTeam = PS_AI_Behavior_Team::MakeTeamId(OtherNPCType);
|
||||
uint8 OtherFaction = 0;
|
||||
if (const auto* OtherPersonality = OtherPawn->FindComponentByClass<UPS_AI_Behavior_PersonalityComponent>())
|
||||
{
|
||||
if (OtherPersonality->Profile)
|
||||
{
|
||||
OtherFaction = OtherPersonality->Profile->Faction;
|
||||
}
|
||||
}
|
||||
OtherTeam = PS_AI_Behavior_Team::MakeTeamId(OtherNPCType, OtherFaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user