Fix TeamId auto-assignment and interface default implementations
- Always recalculate TeamId at OnPossess (BP CDOs may reset to 0) - Remove duplicate _Implementation definitions (UHT auto-generates them) - Fixes crash when interface functions not overridden in BP Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1799ba28c0
commit
eb5113ea30
@ -40,7 +40,7 @@ void APS_AI_Behavior_AIController::OnPossess(APawn* InPawn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto-assign Team ID from IPS_AI_Behavior interface (preferred) or PersonalityComponent
|
// Auto-assign Team ID from IPS_AI_Behavior interface (preferred) or PersonalityComponent
|
||||||
if (TeamId == FGenericTeamId::NoTeam)
|
// Always recalculate — BP child CDOs may reset TeamId to 0
|
||||||
{
|
{
|
||||||
EPS_AI_Behavior_NPCType NPCType = EPS_AI_Behavior_NPCType::Any;
|
EPS_AI_Behavior_NPCType NPCType = EPS_AI_Behavior_NPCType::Any;
|
||||||
|
|
||||||
@ -55,8 +55,7 @@ void APS_AI_Behavior_AIController::OnPossess(APawn* InPawn)
|
|||||||
NPCType = PersonalityComp->GetNPCType();
|
NPCType = PersonalityComp->GetNPCType();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If interface didn't set a specific TeamId, derive from NPCType
|
// Derive TeamId from NPCType
|
||||||
if (TeamId == FGenericTeamId::NoTeam)
|
|
||||||
{
|
{
|
||||||
switch (NPCType)
|
switch (NPCType)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
#include "PS_AI_Behavior_Interface.h"
|
#include "PS_AI_Behavior_Interface.h"
|
||||||
|
|
||||||
// UInterface boilerplate — no default implementation needed.
|
// Default implementations for BlueprintNativeEvent functions are auto-generated
|
||||||
// All functions are BlueprintNativeEvent and must be implemented
|
// by UHT via GENERATED_BODY(). No manual _Implementation needed.
|
||||||
// by the class that declares "implements IPS_AI_Behavior".
|
// If a BP class doesn't override a function, the UHT-generated default is used.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user