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
This commit is contained in:
Vaqtincha 2021-05-22 16:04:43 +05:00 committed by GitHub
parent a27ce74e10
commit bbc54cd30e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

View File

@ -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. <br/>`0` New behavior<br/>`1` Legacy behavior| | mp_legacy_bombtarget_touch | 1 | 0 | 1 | Legacy func_bomb_target touch. New one is more strict. <br/>`0` New behavior<br/>`1` Legacy behavior|
| mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).<br/>`0` disabled<br/>`>0.00001` time delay to remove protection | | mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).<br/>`0` disabled<br/>`>0.00001` time delay to remove protection |
| mp_respawn_immunity_effects | 1 | 0 | 1 | Enable effects on player spawn protection.<br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar mp_respawn_immunitytime) | | mp_respawn_immunity_effects | 1 | 0 | 1 | Enable effects on player spawn protection.<br/>`0` disabled<br/>`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.<br/>`0` disabled<br/>`1` enabled | | mp_respawn_immunity_force_unset | 1 | 0 | 2 | Force unset spawn protection if the player doing any action.<br/>`0` disabled<br/>`1` when moving and attacking<br/>`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).<br />Only disable this if you have semiclip or other plugins that prevents stucking.<br/>`0` disabled<br/>`1` enabled | | mp_kill_filled_spawn | 1 | 0 | 1 | Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).<br />Only disable this if you have semiclip or other plugins that prevents stucking.<br/>`0` disabled<br/>`1` enabled |
| mp_allow_point_servercommand | 0 | 0 | 1 | Allow use of point_servercommand entities in map.<br/>`0` disallow<br/>`1` allow<br/>`NOTE`: Potentially dangerous for untrusted maps. | | mp_allow_point_servercommand | 0 | 0 | 1 | Allow use of point_servercommand entities in map.<br/>`0` disallow<br/>`1` allow<br/>`NOTE`: Potentially dangerous for untrusted maps. |
| mp_hullbounds_sets | 1 | 0 | 1 | Sets mins/maxs hull bounds for the player.<br/>`0` disabled<br/>`1` enabled | | mp_hullbounds_sets | 1 | 0 | 1 | Sets mins/maxs hull bounds for the player.<br/>`0` disabled<br/>`1` enabled |

3
dist/game.cfg vendored
View File

@ -253,7 +253,8 @@ mp_respawn_immunity_effects 1
// Force unset spawn protection if the player doing any action. // Force unset spawn protection if the player doing any action.
// 0 - disabled // 0 - disabled
// 1 - enabled // 1 - when moving and attacking
// 2 - only when attacking
// //
// Default value: "1" // Default value: "1"
mp_respawn_immunity_force_unset 1 mp_respawn_immunity_force_unset 1

View File

@ -4667,8 +4667,9 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)()
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_ADD
auto protectStateCurrent = CSPlayer()->GetProtectionState(); auto protectStateCurrent = CSPlayer()->GetProtectionState();
if (protectStateCurrent == CCSPlayer::ProtectionSt_Expired || (respawn_immunity_force_unset.value && if (protectStateCurrent == CCSPlayer::ProtectionSt_Expired ||
(protectStateCurrent == CCSPlayer::ProtectionSt_Active && (m_afButtonPressed & IN_ACTIVE)))) (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(); RemoveSpawnProtection();
} }
@ -10085,6 +10086,14 @@ void EXT_FUNC CBasePlayer::__API_HOOK(SetSpawnProtection)(float flProtectionTime
{ {
pev->rendermode = kRenderTransAdd; pev->rendermode = kRenderTransAdd;
pev->renderamt = 100.0f; 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; CSPlayer()->m_flSpawnProtectionEndTime = gpGlobals->time + flProtectionTime;
@ -10104,6 +10113,11 @@ void CBasePlayer::__API_HOOK(RemoveSpawnProtection)()
pev->renderamt = 255.0f; pev->renderamt = 255.0f;
pev->rendermode = kRenderNormal; 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; CSPlayer()->m_flSpawnProtectionEndTime = 0.0f;