# HG changeset patch # User Adam Kaminski # Date 1631476796 14400 # Sun Sep 12 15:59:56 2021 -0400 # Node ID b0082fac091bdcad43e14348bd76567587841cfa # Parent 5919782c742f3e1031573908cd10fad5e458a7ad Added DMFlags: "sv_shootthroughallies" and "sv_dontpushallies", so a player's attacks can pass through and not push their allies. diff -r 5919782c742f -r b0082fac091b docs/zandronum-history.txt --- a/docs/zandronum-history.txt Sun Sep 12 09:47:21 2021 -0400 +++ b/docs/zandronum-history.txt Sun Sep 12 15:59:56 2021 -0400 @@ -58,6 +58,7 @@ + - Added all of the text colors from "New Text Colors", originally made by FuzzballFox. [Kaminsky] + - Added the EVENT script type: GAMEEVENT_PLAYERCONNECT, indicating when a client or bot joins the server. [Kaminsky] + - Added the EVENT script type GAMEEVENT_ACTOR_SPAWNED and GAMEVENT_ACTOR_DAMAGED, which are triggered just before an actor's first tic and when an actor takes damage. Note that for performance reasons, these events are disabled by default so modders have to enable them by themselves. [Kaminsky] ++ - Added DMFlags: "sv_shootthroughallies" and "sv_dontpushallies", so a player's attacks can pass through and not push their allies. [Kaminsky] - - Fixed: Bots tries to jump to reach item when sv_nojump is true. [sleep] - - Fixed: ACS function SetSkyScrollSpeed didn't work online. [Edward-san] - - Fixed: color codes in callvote reasons weren't terminated properly. [Dusk] diff -r 5919782c742f -r b0082fac091b src/d_main.cpp --- a/src/d_main.cpp Sun Sep 12 09:47:21 2021 -0400 +++ b/src/d_main.cpp Sun Sep 12 15:59:56 2021 -0400 @@ -632,6 +632,8 @@ CVAR (Flag, sv_nodoorclose, zadmflags, ZADF_NODOORCLOSE); CVAR (Flag, sv_forcesoftwarepitchlimits, zadmflags, ZADF_FORCE_SOFTWARE_PITCH_LIMITS); CVAR (Flag, sv_noprivatechat, zadmflags, ZADF_NO_PRIVATE_CHAT); +CVAR (Flag, sv_shootthroughallies, zadmflags, ZADF_SHOOT_THROUGH_ALLIES); +CVAR (Flag, sv_dontpushallies, zadmflags, ZADF_DONT_PUSH_ALLIES); // Old name kept for compatibility CVAR (Flag, sv_forcegldefaults, zadmflags, ZADF_FORCE_VIDEO_DEFAULTS); diff -r 5919782c742f -r b0082fac091b src/d_player.h --- a/src/d_player.h Sun Sep 12 09:47:21 2021 -0400 +++ b/src/d_player.h Sun Sep 12 15:59:56 2021 -0400 @@ -800,6 +800,7 @@ bool PLAYER_NameUsed( const FString &Name, const ULONG ulIgnorePlayer = MAXPLAYERS ); FString PLAYER_GenerateUniqueName( void ); bool PLAYER_CanRespawnWhereDied( player_t *pPlayer ); +bool PLAYER_CannotAffectAllyWith( AActor *pActor1, AActor *pActor2, int flag ); void P_CheckPlayerSprite(AActor *mo, int &spritenum, fixed_t &scalex, fixed_t &scaley); diff -r 5919782c742f -r b0082fac091b src/doomdef.h --- a/src/doomdef.h Sun Sep 12 09:47:21 2021 -0400 +++ b/src/doomdef.h Sun Sep 12 15:59:56 2021 -0400 @@ -386,6 +386,12 @@ // [AK] No private messaging allowed on the server. ZADF_NO_PRIVATE_CHAT = 1 << 21, + + // [AK] Allows players to fire hitscans and projectiles through teammates. + ZADF_SHOOT_THROUGH_ALLIES = 1 << 22, + + // [AK] Players aren't pushed by attacks caused by their teammates (e.g. BFG tracers). + ZADF_DONT_PUSH_ALLIES = 1 << 23, }; // [RH] Compatibility flags. diff -r 5919782c742f -r b0082fac091b src/p_interaction.cpp --- a/src/p_interaction.cpp Sun Sep 12 09:47:21 2021 -0400 +++ b/src/p_interaction.cpp Sun Sep 12 15:59:56 2021 -0400 @@ -1392,11 +1392,13 @@ // Push the target unless the source's weapon's kickback is 0. // (i.e. Gauntlets/Chainsaw) // [BB] The server handles this. + // [AK] Don't push teammates if ZADF_DONT_PUSH_ALLIES is enabled. if (inflictor && inflictor != target // [RH] Not if hurting own self && !(target->flags & MF_NOCLIP) && !(inflictor->flags2 & MF2_NODMGTHRUST) && !(flags & DMG_THRUSTLESS) && (source == NULL || source->player == NULL || !(source->flags2 & MF2_NODMGTHRUST)) + && ( PLAYER_CannotAffectAllyWith( source, target, ZADF_DONT_PUSH_ALLIES ) == false ) && ( NETWORK_InClientMode() == false ) ) { int kickback; @@ -3421,6 +3423,26 @@ return true; } +//***************************************************************************** +// +bool PLAYER_CannotAffectAllyWith( AActor *pActor1, AActor *pActor2, int flag ) +{ + // [AK] Check if we have the corresponding zadmflag enabled. + if (( zadmflags & flag ) == false ) + return false; + + // [AK] If the first actor isn't a player, return false. + if (( pActor1 == NULL ) || ( pActor1->player == NULL )) + return false; + + // [AK] Make sure the other actor is another player and a teammate of the first actor. Otherwise, + // their attacks should still hit and push each other. + if (( pActor1 != pActor2 ) && ( pActor1->IsTeammate( pActor2 )) && ( pActor2->player )) + return true; + + return false; +} + CCMD (kill) { // Only allow it in a level. diff -r 5919782c742f -r b0082fac091b src/p_map.cpp --- a/src/p_map.cpp Sun Sep 12 09:47:21 2021 -0400 +++ b/src/p_map.cpp Sun Sep 12 15:59:56 2021 -0400 @@ -1084,6 +1084,11 @@ && (tm.thing->target->GetSpecies() == thing->GetSpecies())) return true; + // [AK] Check if this projectile was shot by a player and can pass through their + // teammates if ZADF_SHOOT_THROUGH_ALLIES is enabled. + if ( PLAYER_CannotAffectAllyWith( tm.thing->target, thing, ZADF_SHOOT_THROUGH_ALLIES )) + return true; + // Check for rippers passing through corpses if ((thing->flags & MF_CORPSE) && (tm.thing->flags2 & MF2_RIP) && !(thing->flags & MF_SHOOTABLE)) { @@ -4133,6 +4138,12 @@ return TRACE_Skip; } + // [AK] Check if this player can shoot through their teammates if ZADF_SHOOT_THROUGH_ALLIES is enabled. + if ( PLAYER_CannotAffectAllyWith( data->Caller, res.Actor, ZADF_SHOOT_THROUGH_ALLIES )) + { + return TRACE_Skip; + } + return TRACE_Stop; } @@ -5613,6 +5624,11 @@ ) ) continue; + // [AK] Don't push this player if ZADF_DONT_PUSH_ALLIES is enabled and the + // other player who caused the explosion is their teammate. + if ( PLAYER_CannotAffectAllyWith( bombsource, thing, ZADF_DONT_PUSH_ALLIES )) + continue; + // Barrels always use the original code, since this makes // them far too "active." BossBrains also use the old code // because some user levels require they have a height of 16, diff -r 5919782c742f -r b0082fac091b wadsrc/static/menudef.txt --- a/wadsrc/static/menudef.txt Sun Sep 12 09:47:21 2021 -0400 +++ b/wadsrc/static/menudef.txt Sun Sep 12 15:59:56 2021 -0400 @@ -1313,6 +1313,8 @@ Option "Full blood brightness", "sv_maxbloodscalar", "YesNo" Option "Force software pitch limits", "sv_forcesoftwarepitchlimits", "YesNo" Option "Allow private chat", "sv_noprivatechat", "NoYes" + Option "Shoot through allies", "sv_shootthroughallies", "YesNo" + Option "Attacks push allies", "sv_dontpushallies", "NoYes" // [TP] -- StaticText " "