Added cvar respawn_immunity_effects for turn off spawn protection effects also removes spawn protection at player move. Closes #318

This commit is contained in:
s1lent 2019-08-13 20:11:27 +07:00
parent 2568d9a2fa
commit 95550dcd86
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
6 changed files with 54 additions and 26 deletions

View File

@ -52,6 +52,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_item_staytime | 300 | - | - | Time to remove item that have been dropped from the players. |
| 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_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_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_hullbounds_sets | 1 | 0 | 1 | Sets mins/maxs hull bounds for the player.<br/>`0` disabled<br/>`1` enabled |

25
dist/game.cfg vendored
View File

@ -83,7 +83,7 @@ mp_roundrespawn_time 20
// 1 - enabled
//
// Default value: "0"
mp_auto_reload_weapons "0"
mp_auto_reload_weapons 0
// Refill amount of backpack ammo up to the max
// 0 - disabled (default behaviour)
@ -206,7 +206,7 @@ mp_item_staytime 300
// 1 - Legacy behavior
//
// Default value: "1"
mp_legacy_bombtarget_touch "1"
mp_legacy_bombtarget_touch 1
// Specifies the players defense time after respawn. (in seconds).
// 0 - disabled
@ -215,13 +215,20 @@ mp_legacy_bombtarget_touch "1"
// Default value: "0"
mp_respawn_immunitytime "0"
// Enable effects on player spawn protection
// 0 - disabled
// 1 - enabled (Use in conjunction with the cvar mp_respawn_immunitytime)
//
// Default value: "1"
mp_respawn_immunity_effects 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
//
// Default value: "1"
mp_kill_filled_spawn "1"
mp_kill_filled_spawn 1
// Allow use of point_servercommand entities in map.
// NOTE: Potentially dangerous for untrusted maps.
@ -229,7 +236,7 @@ mp_kill_filled_spawn "1"
// 1 - allow
//
// Default value: "0"
mp_allow_point_servercommand "0"
mp_allow_point_servercommand 0
// Show 'HP' field into a scoreboard
// 0 - don't send any update for 'HP' field to any clients
@ -240,7 +247,7 @@ mp_allow_point_servercommand "0"
// 5 - show 'HP' field to teammates and spectators
//
// Default value: "3"
mp_scoreboard_showhealth "3"
mp_scoreboard_showhealth 3
// Show 'Money' field into a scoreboard
// 0 - don't send any update for 'Money' field to any clients
@ -251,7 +258,7 @@ mp_scoreboard_showhealth "3"
// 5 - show 'Money' field to teammates and spectators
//
// Default value: "3"
mp_scoreboard_showmoney "3"
mp_scoreboard_showmoney 3
// How much to reduce damage done to teammates when shot.
// Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
@ -295,7 +302,7 @@ mp_radio_timeout "1.5"
// 0 - disable radio messages
//
// Default value: "60"
mp_radio_maxinround "60"
mp_radio_maxinround 60
// When set, players can buy anywhere, not only in buyzones.
// 0 - disabled
@ -304,6 +311,4 @@ mp_radio_maxinround "60"
// 3 - only CT team
//
// Default value: "0"
mp_buy_anywhere "0"
mp_buy_anywhere 0

View File

@ -49,4 +49,6 @@
#define IN_ALT1 (1<<14)
#define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down
#define IN_ACTIVE (IN_ATTACK | IN_ATTACK2 | IN_JUMP | IN_DUCK | IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT)
#endif // IN_BUTTONS_H

View File

@ -118,6 +118,7 @@ cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", 0, 1.0f, nu
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", 0, 1.0f, nullptr };
cvar_t respawn_immunitytime = { "mp_respawn_immunitytime", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t respawn_immunity_effects = { "mp_respawn_immunity_effects", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", 0, 0.0f, nullptr };
cvar_t afk_bomb_drop_time = { "mp_afk_bomb_drop_time", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t buy_anywhere = { "mp_buy_anywhere", "0", FCVAR_SERVER, 0.0f, nullptr };
@ -314,6 +315,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&item_staytime);
CVAR_REGISTER(&legacy_bombtarget_touch);
CVAR_REGISTER(&respawn_immunitytime);
CVAR_REGISTER(&respawn_immunity_effects);
CVAR_REGISTER(&kill_filled_spawn);
CVAR_REGISTER(&afk_bomb_drop_time);
CVAR_REGISTER(&buy_anywhere);

View File

@ -155,6 +155,7 @@ extern cvar_t old_bomb_defused_sound;
extern cvar_t item_staytime;
extern cvar_t legacy_bombtarget_touch;
extern cvar_t respawn_immunitytime;
extern cvar_t respawn_immunity_effects;
extern cvar_t kill_filled_spawn;
extern cvar_t afk_bomb_drop_time;
extern cvar_t buy_anywhere;

View File

@ -4448,7 +4448,9 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)()
UpdateLocation();
#ifdef REGAMEDLL_ADD
if (CSPlayer()->GetProtectionState() == CCSPlayer::ProtectionSt_Expired)
auto protectStateCurrent = CSPlayer()->GetProtectionState();
if (protectStateCurrent == CCSPlayer::ProtectionSt_Expired ||
(protectStateCurrent == CCSPlayer::ProtectionSt_Active && (m_afButtonPressed & IN_ACTIVE)))
{
RemoveSpawnProtection();
}
@ -9733,8 +9735,13 @@ LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, SetSpawnProtection, (float flProtectionT
void EXT_FUNC CBasePlayer::__API_HOOK(SetSpawnProtection)(float flProtectionTime)
{
#ifdef REGAMEDLL_ADD
if (respawn_immunity_effects.value > 0)
#endif
{
pev->rendermode = kRenderTransAdd;
pev->renderamt = 100.0;
pev->renderamt = 100.0f;
}
CSPlayer()->m_flSpawnProtectionEndTime = gpGlobals->time + flProtectionTime;
}
@ -9743,7 +9750,17 @@ LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, RemoveSpawnProtection)
void CBasePlayer::__API_HOOK(RemoveSpawnProtection)()
{
#ifdef REGAMEDLL_ADD
if (respawn_immunity_effects.value > 0)
#endif
{
if (pev->rendermode == kRenderTransAdd &&
pev->renderamt == 100.0f)
{
pev->renderamt = 255.0f;
pev->rendermode = kRenderNormal;
}
}
CSPlayer()->m_flSpawnProtectionEndTime = 0.0f;
}