- MBF21: infighting groups.
This commit is contained in:
parent
9b4a4157b9
commit
bca8d01ab3
5 changed files with 54 additions and 15 deletions
|
|
@ -1600,13 +1600,13 @@ bool AActor::OkayToSwitchTarget(AActor *other)
|
|||
if (!(other->flags & MF_SHOOTABLE))
|
||||
return false; // Don't attack things that can't be hurt
|
||||
|
||||
if ((flags4 & MF4_NOTARGETSWITCH) && target != NULL)
|
||||
if ((flags4 & MF4_NOTARGETSWITCH) && target != nullptr)
|
||||
return false; // Don't switch target if not allowed
|
||||
|
||||
if ((master != NULL && other->IsA(master->GetClass())) || // don't attack your master (or others of its type)
|
||||
(other->master != NULL && IsA(other->master->GetClass()))) // don't attack your minion (or those of others of your type)
|
||||
if ((master != nullptr && other->IsA(master->GetClass())) || // don't attack your master (or others of its type)
|
||||
(other->master != nullptr && IsA(other->master->GetClass()))) // don't attack your minion (or those of others of your type)
|
||||
{
|
||||
if (!IsHostile (other) && // allow target switch if other is considered hostile
|
||||
if (!IsHostile(other) && // allow target switch if other is considered hostile
|
||||
(other->tid != TIDtoHate || TIDtoHate == 0) && // or has the tid we hate
|
||||
other->TIDtoHate == TIDtoHate) // or has different hate information
|
||||
{
|
||||
|
|
@ -1614,6 +1614,12 @@ bool AActor::OkayToSwitchTarget(AActor *other)
|
|||
}
|
||||
}
|
||||
|
||||
// MBF21 support.
|
||||
auto mygroup = GetClass()->ActorInfo()->infighting_group;
|
||||
auto othergroup = other->GetClass()->ActorInfo()->infighting_group;
|
||||
if (mygroup != 0 && mygroup == othergroup)
|
||||
return false;
|
||||
|
||||
if ((flags7 & MF7_NOINFIGHTSPECIES) && GetSpecies() == other->GetSpecies())
|
||||
return false; // Don't fight own species.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue