New CVars: mp_freezetime_duck and mp_freezetime_jump (#886)

* new cvars: prevent duck/jump during freezetime
* use CSGameRules() instead of g_pGameRules
* changed name of cvars and default value
* improved cvars description
This commit is contained in:
Federico Matías 2023-11-26 01:13:29 -03:00 committed by GitHub
parent 2d0ac93f63
commit e3d70d2b14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 4 deletions

View File

@ -113,6 +113,8 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| mp_dying_time | 3.0 | 0.0 | - | Time for switch to free observing after death.<br/>`0` - disable spectating around death.<br/>`>0.00001` - time delay to start spectate.<br/>`NOTE`: The countdown starts when the players death animation is finished. |
| mp_deathmsg_flags | abc | 0 | - | Sets a flags for extra information in the player's death message.<br/>`0` disabled<br/>`a` position where the victim died<br/>`b` index of the assistant who helped the attacker kill the victim<br/>`c` rarity classification bits, e.g., `blinkill`, `noscope`, `penetrated`, etc. |
| mp_assist_damage_threshold | 40 | 0 | 100 | Sets the percentage of damage needed to score an assist. |
| mp_freezetime_duck | 1 | 0 | 1 | Allow players to duck during freezetime.<br/> `0` disabled<br/>`1` enabled |
| mp_freezetime_jump | 1 | 0 | 1 | Allow players to jump during freezetime.<br/> `0` disabled<br/>`1` enabled |
</details>
## How to install zBot for CS 1.6?

14
dist/game.cfg vendored
View File

@ -553,3 +553,17 @@ mp_deathmsg_flags "abc"
//
// Default value: "40"
mp_assist_damage_threshold "40"
// Allow players to duck during freezetime
// 0 - disabled
// 1 - enabled (default behaviour)
//
// Default value: "1"
mp_freezetime_duck "1"
// Allow players to jump during freezetime
// 0 - disabled
// 1 - enabled (default behaviour)
//
// Default value: "1"
mp_freezetime_jump "1"

View File

@ -168,6 +168,8 @@ cvar_t plant_c4_anywhere = { "mp_plant_c4_anywhere", "0", 0, 0.0
cvar_t give_c4_frags = { "mp_give_c4_frags", "3", 0, 3.0f, nullptr };
cvar_t deathmsg_flags = { "mp_deathmsg_flags", "abc", 0, 0.0f, nullptr };
cvar_t assist_damage_threshold = { "mp_assist_damage_threshold", "40", 0, 40.0f, nullptr };
cvar_t freezetime_duck = { "mp_freezetime_duck", "1", 0, 1.0f, nullptr };
cvar_t freezetime_jump = { "mp_freezetime_jump", "1", 0, 1.0f, nullptr };
cvar_t hostages_rescued_ratio = { "mp_hostages_rescued_ratio", "1.0", 0, 1.0f, nullptr };
@ -428,6 +430,9 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&deathmsg_flags);
CVAR_REGISTER(&assist_damage_threshold);
CVAR_REGISTER(&freezetime_duck);
CVAR_REGISTER(&freezetime_jump);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

View File

@ -197,6 +197,8 @@ extern cvar_t legacy_vehicle_block;
extern cvar_t dying_time;
extern cvar_t deathmsg_flags;
extern cvar_t assist_damage_threshold;
extern cvar_t freezetime_duck;
extern cvar_t freezetime_jump;
#endif

View File

@ -1893,8 +1893,8 @@ void EXT_FUNC __API_HOOK(PM_Duck)()
}
#ifdef REGAMEDLL_ADD
// Prevent ducking if the iuser3 variable is contain PLAYER_PREVENT_DUCK
if ((pmove->iuser3 & PLAYER_PREVENT_DUCK) == PLAYER_PREVENT_DUCK)
if ((pmove->iuser3 & PLAYER_PREVENT_DUCK) == PLAYER_PREVENT_DUCK // Prevent ducking if the iuser3 variable is contain PLAYER_PREVENT_DUCK
|| freezetime_duck.value == 0.0f && CSGameRules()->IsFreezePeriod()) // Prevent ducking during freezetime if the freezetime_duck cvar is 0
{
// Try to unduck
if (pmove->flags & FL_DUCKING)
@ -2449,8 +2449,8 @@ void EXT_FUNC __API_HOOK(PM_Jump)()
}
#ifdef REGAMEDLL_ADD
// Prevent jumping if the iuser3 variable is contain PLAYER_PREVENT_JUMP
if ((pmove->iuser3 & PLAYER_PREVENT_JUMP) == PLAYER_PREVENT_JUMP)
if ((pmove->iuser3 & PLAYER_PREVENT_JUMP) == PLAYER_PREVENT_JUMP // Prevent jumping if the iuser3 variable is contain PLAYER_PREVENT_JUMP
|| freezetime_jump.value == 0.0f && CSGameRules()->IsFreezePeriod()) // Prevent jumping during freezetime if the freezetime_jump cvar is 0
{
return;
}