From 5780452498a44ca4b235b1705a891f799fd278e5 Mon Sep 17 00:00:00 2001 From: Alejo Date: Sun, 24 Oct 2021 18:16:07 -0300 Subject: [PATCH 1/3] Added new CVar `mp_team_flash` --- README.md | 1 + dist/game.cfg | 8 ++++++++ regamedll/dlls/combat.cpp | 13 +++++++++++++ regamedll/dlls/game.cpp | 2 ++ regamedll/dlls/game.h | 1 + 5 files changed, 25 insertions(+) diff --git a/README.md b/README.md index 410672d32..2aee295ae 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_give_player_c4 | 1 | 0 | 1 | Whether this map should spawn a C4 bomb for a player or not.
`0` disabled
`1` enabled | | mp_weapons_allow_map_placed | 1 | 0 | 1 | When set, map weapons (located on the floor by map) will be shown.
`0` hide all map weapons.
`1` enabled
`NOTE`: Effect will work after round restart. | | mp_free_armor | 0 | 0 | 2 | Give free armor on player spawn.
`0` disabled
`1` Give Kevlar
`2` Give Kevlar + Helmet | +| mp_team_flash | 1 | -1 | 1 | Flashbang affects teammates.
`-1` Don't affect teammates neither flash owner
`0` Don't affect teammates
`1` Affects teammates | | mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.
`0` No fade.
`1` Fade to black and won't be able to watch anybody.
`2` fade to black only on kill moment. | | mp_falldamage | 1 | 0 | 1 | Damage from falling.
`0` disabled
`1` enabled | | sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply
`0` disabled
`1` enabled | diff --git a/dist/game.cfg b/dist/game.cfg index 326201471..cdee51ecd 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -456,6 +456,14 @@ mp_ct_default_weapons_secondary "usp" // Default value: "0" mp_free_armor 0 +// Flashbang affects teammates +// -1 - Don't affect teammates neither flash owner +// 0 - Don't affect teammates +// 1 - Affects teammates (default behaviour) +// +// Default value: "1" +mp_team_flash 1 + // Players can receive all other players text chat, team restrictions apply. // 0 - disabled (default behaviour) // 1 - enabled diff --git a/regamedll/dlls/combat.cpp b/regamedll/dlls/combat.cpp index f5ec1ce15..899626551 100644 --- a/regamedll/dlls/combat.cpp +++ b/regamedll/dlls/combat.cpp @@ -87,6 +87,19 @@ void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, if (tr2.flFraction >= 1.0) { +#ifdef REGAMEDLL_ADD + switch ((int)teamflash.value) + { + case 0: + if (pPlayer->pev != pevAttacker && g_pGameRules->PlayerRelationship(pPlayer, (CBaseEntity*)pevAttacker) == GR_TEAMMATE) + continue; + break; + case -1: + if (pPlayer->pev == pevAttacker || g_pGameRules->PlayerRelationship(pPlayer, (CBaseEntity*)pevAttacker) == GR_TEAMMATE) + continue; + break; + } +#endif if (tr.fStartSolid) { tr.vecEndPos = vecSrc; diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index de055fd75..06bc3fea4 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -158,6 +158,7 @@ cvar_t t_give_player_knife = { "mp_t_give_player_knife", "1", 0, 1 cvar_t t_default_weapons_secondary = { "mp_t_default_weapons_secondary", "glock18", 0, 0.0f, nullptr }; cvar_t t_default_weapons_primary = { "mp_t_default_weapons_primary", "", 0, 0.0f, nullptr }; cvar_t free_armor = { "mp_free_armor", "0", 0, 0.0f, nullptr }; +cvar_t teamflash = { "mp_team_flash", "1", 0, 1.0f, nullptr }; cvar_t allchat = { "sv_allchat", "0", 0, 0.0f, nullptr }; cvar_t sv_autobunnyhopping = { "sv_autobunnyhopping", "0", 0, 0.0f, nullptr }; cvar_t sv_enablebunnyhopping = { "sv_enablebunnyhopping", "0", 0, 0.0f, nullptr }; @@ -388,6 +389,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&t_default_weapons_secondary); CVAR_REGISTER(&t_default_weapons_primary); CVAR_REGISTER(&free_armor); + CVAR_REGISTER(&teamflash); CVAR_REGISTER(&allchat); CVAR_REGISTER(&sv_autobunnyhopping); CVAR_REGISTER(&sv_enablebunnyhopping); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 2f362c050..f13e5fd00 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -184,6 +184,7 @@ extern cvar_t t_give_player_knife; extern cvar_t t_default_weapons_secondary; extern cvar_t t_default_weapons_primary; extern cvar_t free_armor; +extern cvar_t teamflash; extern cvar_t allchat; extern cvar_t sv_autobunnyhopping; extern cvar_t sv_enablebunnyhopping; From 2aaf28ccce7aa6c90a75c026ae80bed0e184df6c Mon Sep 17 00:00:00 2001 From: Alejo Date: Sun, 24 Oct 2021 18:22:07 -0300 Subject: [PATCH 2/3] Modified CVar description --- README.md | 2 +- dist/game.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2aee295ae..ba0ceb199 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_give_player_c4 | 1 | 0 | 1 | Whether this map should spawn a C4 bomb for a player or not.
`0` disabled
`1` enabled | | mp_weapons_allow_map_placed | 1 | 0 | 1 | When set, map weapons (located on the floor by map) will be shown.
`0` hide all map weapons.
`1` enabled
`NOTE`: Effect will work after round restart. | | mp_free_armor | 0 | 0 | 2 | Give free armor on player spawn.
`0` disabled
`1` Give Kevlar
`2` Give Kevlar + Helmet | -| mp_team_flash | 1 | -1 | 1 | Flashbang affects teammates.
`-1` Don't affect teammates neither flash owner
`0` Don't affect teammates
`1` Affects teammates | +| mp_team_flash | 1 | -1 | 1 | Sets the behaviour for Flashbangs on teammates.
`-1` Don't affect teammates neither flash owner
`0` Don't affect teammates
`1` Affects teammates | | mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.
`0` No fade.
`1` Fade to black and won't be able to watch anybody.
`2` fade to black only on kill moment. | | mp_falldamage | 1 | 0 | 1 | Damage from falling.
`0` disabled
`1` enabled | | sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply
`0` disabled
`1` enabled | diff --git a/dist/game.cfg b/dist/game.cfg index cdee51ecd..36c946017 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -456,7 +456,7 @@ mp_ct_default_weapons_secondary "usp" // Default value: "0" mp_free_armor 0 -// Flashbang affects teammates +// Sets the behaviour for Flashbangs on teammates. // -1 - Don't affect teammates neither flash owner // 0 - Don't affect teammates // 1 - Affects teammates (default behaviour) From 8346bef78f365029d60009f935657b5ba5624ca1 Mon Sep 17 00:00:00 2001 From: Alejo Date: Sun, 24 Oct 2021 18:58:00 -0300 Subject: [PATCH 3/3] Fix parameter --- regamedll/dlls/combat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regamedll/dlls/combat.cpp b/regamedll/dlls/combat.cpp index 899626551..4c938e69d 100644 --- a/regamedll/dlls/combat.cpp +++ b/regamedll/dlls/combat.cpp @@ -91,11 +91,11 @@ void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, switch ((int)teamflash.value) { case 0: - if (pPlayer->pev != pevAttacker && g_pGameRules->PlayerRelationship(pPlayer, (CBaseEntity*)pevAttacker) == GR_TEAMMATE) + if (pPlayer->pev != pevAttacker && g_pGameRules->PlayerRelationship(pPlayer, CBaseEntity::Instance(pevAttacker)) == GR_TEAMMATE) continue; break; case -1: - if (pPlayer->pev == pevAttacker || g_pGameRules->PlayerRelationship(pPlayer, (CBaseEntity*)pevAttacker) == GR_TEAMMATE) + if (pPlayer->pev == pevAttacker || g_pGameRules->PlayerRelationship(pPlayer, CBaseEntity::Instance(pevAttacker)) == GR_TEAMMATE) continue; break; }