From bbc54cd30e4b646c52db8b764b7bd36a3aac92b6 Mon Sep 17 00:00:00 2001 From: Vaqtincha <51029683+Vaqtincha@users.noreply.github.com> Date: Sat, 22 May 2021 16:04:43 +0500 Subject: [PATCH] Immunity enhance (#621) * CVar 'mp_respawn_immunity_force_unset' new value (2) * Send StatusIcon to player (for visual information) works with mp_respawn_immunity_effects 1 --- README.md | 2 +- dist/game.cfg | 3 ++- regamedll/dlls/player.cpp | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2031fdd2..3af41455 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_legacy_bombtarget_touch | 1 | 0 | 1 | Legacy func_bomb_target touch. New one is more strict.
`0` New behavior
`1` Legacy behavior| | mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).
`0` disabled
`>0.00001` time delay to remove protection | | mp_respawn_immunity_effects | 1 | 0 | 1 | Enable effects on player spawn protection.
`0` disabled
`1` enable (Use in conjunction with the cvar mp_respawn_immunitytime) | -| mp_respawn_immunity_force_unset | 1 | 0 | 1 | Force unset spawn protection if the player doing any action.
`0` disabled
`1` enabled | +| mp_respawn_immunity_force_unset | 1 | 0 | 2 | Force unset spawn protection if the player doing any action.
`0` disabled
`1` when moving and attacking
`2` only when attacking | | mp_kill_filled_spawn | 1 | 0 | 1 | Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).
Only disable this if you have semiclip or other plugins that prevents stucking.
`0` disabled
`1` enabled | | mp_allow_point_servercommand | 0 | 0 | 1 | Allow use of point_servercommand entities in map.
`0` disallow
`1` allow
`NOTE`: Potentially dangerous for untrusted maps. | | mp_hullbounds_sets | 1 | 0 | 1 | Sets mins/maxs hull bounds for the player.
`0` disabled
`1` enabled | diff --git a/dist/game.cfg b/dist/game.cfg index dd160b92..91a8aca6 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -253,7 +253,8 @@ mp_respawn_immunity_effects 1 // Force unset spawn protection if the player doing any action. // 0 - disabled -// 1 - enabled +// 1 - when moving and attacking +// 2 - only when attacking // // Default value: "1" mp_respawn_immunity_force_unset 1 diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 29cc90c1..44ab9a56 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -4667,8 +4667,9 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)() #ifdef REGAMEDLL_ADD auto protectStateCurrent = CSPlayer()->GetProtectionState(); - if (protectStateCurrent == CCSPlayer::ProtectionSt_Expired || (respawn_immunity_force_unset.value && - (protectStateCurrent == CCSPlayer::ProtectionSt_Active && (m_afButtonPressed & IN_ACTIVE)))) + if (protectStateCurrent == CCSPlayer::ProtectionSt_Expired || + (protectStateCurrent == CCSPlayer::ProtectionSt_Active && + ((respawn_immunity_force_unset.value == 1 && (m_afButtonPressed & IN_ACTIVE)) || (respawn_immunity_force_unset.value == 2 && (m_afButtonPressed & (IN_ATTACK | IN_ATTACK2)))))) { RemoveSpawnProtection(); } @@ -10085,6 +10086,14 @@ void EXT_FUNC CBasePlayer::__API_HOOK(SetSpawnProtection)(float flProtectionTime { pev->rendermode = kRenderTransAdd; pev->renderamt = 100.0f; + + MESSAGE_BEGIN(MSG_ONE_UNRELIABLE, gmsgStatusIcon, nullptr, pev); + WRITE_BYTE(STATUSICON_FLASH); + WRITE_STRING("suithelmet_full"); + WRITE_BYTE(0); + WRITE_BYTE(160); + WRITE_BYTE(0); + MESSAGE_END(); } CSPlayer()->m_flSpawnProtectionEndTime = gpGlobals->time + flProtectionTime; @@ -10104,6 +10113,11 @@ void CBasePlayer::__API_HOOK(RemoveSpawnProtection)() pev->renderamt = 255.0f; pev->rendermode = kRenderNormal; } + + MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pev); + WRITE_BYTE(STATUSICON_HIDE); + WRITE_STRING("suithelmet_full"); + MESSAGE_END(); } CSPlayer()->m_flSpawnProtectionEndTime = 0.0f;