# HG changeset patch # User Adam Kaminski # Date 1637595379 18000 # Mon Nov 22 10:36:19 2021 -0500 # Node ID 9c4b341eb3ab9069ea0a920546baee9afe365911 # Parent 7b604b9377079c4cfb8b149155b2069f285737c7 Fixed players on different teams still being treated as allies in cooperative game modes. diff -r 7b604b937707 -r 9c4b341eb3ab src/p_interaction.cpp --- a/src/p_interaction.cpp Mon Nov 22 10:26:36 2021 -0500 +++ b/src/p_interaction.cpp Mon Nov 22 10:36:19 2021 -0500 @@ -3483,11 +3483,14 @@ return false; // [AK] One of the actors must be a player, at least. - if (( pActor1 && pActor2 ) && ( pActor1->player || pActor2->player )) + if (( pActor1 && pActor2 ) && ( pActor1 != pActor2 ) && ( pActor1->player || pActor2->player )) { - // [AK] Make sure the other actor is a teammate or friend of the first actor. - // Otherwise, their attacks should still hit and push each other. - if (( pActor1 != pActor2 ) && ( pActor1->IsTeammate( pActor2 ) || pActor1->IsFriend( pActor2 ))) + // [AK] Check if the other actor is a teammate of the first actor. + if ( pActor1->IsTeammate( pActor2 )) + return true; + + // [AK] Check if the other actor is a friend of the first actor. One of these actors must not be a player. + if (( pActor1->player == NULL || pActor2->player == NULL ) && ( pActor1->IsFriend( pActor2 ))) return true; } diff -r 7b604b937707 -r 9c4b341eb3ab src/p_mobj.cpp --- a/src/p_mobj.cpp Mon Nov 22 10:26:36 2021 -0500 +++ b/src/p_mobj.cpp Mon Nov 22 10:36:19 2021 -0500 @@ -7555,7 +7555,19 @@ return false; // Allow co-op players to be teammates. else if ((( deathmatch == false ) && ( teamgame == false )) && player && other->player) + { + // [AK] Not if they're supposed to be on different teams. + if ( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) + { + if ( !player->bOnTeam || !other->player->bOnTeam ) + return ( false ); + + if ( player->Team != other->player->Team ) + return ( false ); + } + return ( true ); + } // Can't be an enemy of ourselves! if ( this == other )