Add new CVar mp_falldamage (#539)

* Add CVar mp_falldamage
This commit is contained in:
Vaqtincha 2020-05-27 06:26:45 +05:00 committed by GitHub
parent a20362389e
commit 6c80744146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 1 deletions

View File

@ -89,6 +89,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_give_player_c4 | 1 | 0 | 1 | Whether this map should spawn a C4 bomb for a player or not.<br/> `0` disabled<br/>`1` enabled |
| mp_weapons_allow_map_placed | 1 | 0 | 1 | When set, map weapons (located on the floor by map) will be shown.<br/> `0` hide all map weapons.<br/>`1` enabled<br/>`NOTE`: Effect will work after round restart. |
| mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.<br/> `0` No fade.<br/>`1` Fade to black and won't be able to watch anybody.<br/>`2` fade to black only on kill moment. |
| mp_falldamage | 1 | 0 | 1 | Damage from falling.<br/>`0` disabled <br/>`1` enabled |
</details>
## How to install zBot for CS 1.6?

8
dist/game.cfg vendored
View File

@ -382,3 +382,11 @@ mp_weapons_allow_map_placed 1
//
// Default value: "0"
mp_fadetoblack 0
// Damage from falling.
// 0 - disabled
// 1 - enabled (default behaviour)
//
// Default value: "1"
mp_falldamage 1

View File

@ -147,6 +147,8 @@ cvar_t ff_damage_reduction_other = { "ff_damage_reduction_other",
cvar_t radio_timeout = { "mp_radio_timeout", "1.5", FCVAR_SERVER, 1.5f, nullptr };
cvar_t radio_maxinround = { "mp_radio_maxinround", "60", FCVAR_SERVER, 60.0f, nullptr };
cvar_t falldamage = { "mp_falldamage", "1", FCVAR_SERVER, 1.0f, nullptr };
void GameDLL_Version_f()
{
@ -359,7 +361,8 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&radio_timeout);
CVAR_REGISTER(&radio_maxinround);
CVAR_REGISTER(&falldamage);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

View File

@ -173,6 +173,7 @@ extern cvar_t ff_damage_reduction_grenade_self;
extern cvar_t ff_damage_reduction_other;
extern cvar_t radio_timeout;
extern cvar_t radio_maxinround;
extern cvar_t falldamage;
#endif

View File

@ -3586,6 +3586,14 @@ LINK_HOOK_CLASS_CUSTOM_CHAIN(float, CHalfLifeMultiplay, CSGameRules, FlPlayerFal
float EXT_FUNC CHalfLifeMultiplay::__API_HOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer)
{
#ifdef REGAMEDLL_ADD
if (!falldamage.value)
{
return 0.0f;
}
#endif
pPlayer->m_flFallVelocity -= MAX_PLAYER_SAFE_FALL_SPEED;
return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED * 1.25;
}