Implemented cvars ff_damage_reduction_bullets, ff_damage_reduction_grenade, ff_damage_reduction_grenade_self, ff_damage_reduction_other

Resolves #297
This commit is contained in:
s1lent 2019-06-06 04:20:19 +07:00
parent 2903630e38
commit d00a937508
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
5 changed files with 100 additions and 39 deletions

View File

@ -20,7 +20,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
## Configuration (cvars)
| CVar | Default | Min | Max | Description |
| :---------------------------- | :-----: | :-: | :----------: | :--------------------------------------------- |
| :--------------------------------- | :-----: | :-: | :----------: | :--------------------------------------------- |
| mp_freeforall | 0 | 0 | 1 | The style of gameplay where there aren't any teams (FFA mode)<br/>`0` disabled <br/>`1` enabled |
| mp_autoteambalance | 1 | 0 | 2 | Auto balancing of teams.<br/>`0` disabled <br/>`1` on after next round<br/>`2` on next round |
| mp_buytime | 1.5 | 0.0 | - | Designate the desired amount of buy time for each round. (in minutes)<br />`-1` means no time limit<br />`0` disable buy |
@ -55,6 +55,10 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_hullbounds_sets | 1 | 0 | 1 | Sets mins/maxs hull bounds for the player.<br/>`0` disabled<br/>`1` enabled |
| mp_scoreboard_showhealth | 3 | 0 | 5 | Show `HP` field into a scoreboard.<br/>`0` don't send any update for `HP` field to any clients<br/>`1` show only Terrorist `HP` field to all clients<br/>`2` show only CT `HP` field to all clients<br/>`3` show `HP` field to teammates<br/>`4` show `HP` field to all clients<br/>`5` show `HP` field to teammates and spectators |
| mp_scoreboard_showmoney | 3 | 0 | 5 | Show `Money` field into a scoreboard.<br/>`0` don't send any update for `Money` field to any clients<br/>`1` show only Terrorist `Money` field to all clients<br/>`2` show only CT `Money` field to all clients<br/>`3` show `Money` field to teammates<br/>`4` show `Money` field to all clients<br/>`5` show `Money` field to teammates and spectators |
| ff_damage_reduction_bullets | 0.35 | 0.0 | 1.0 | How much to reduce damage done to teammates when shot.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) |
| ff_damage_reduction_grenade | 0.25 | 0.0 | 1.0 | How much to reduce damage done to teammates by a thrown grenade.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) |
| ff_damage_reduction_grenade_self | 1.0 | 0.0 | 1.0 | How much to damage a player does to himself with his own grenade.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) |
| ff_damage_reduction_other | 0.25 | 0.0 | 1.0 | How much to reduce damage done to teammates by things other than bullets and grenades.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) |
## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)

24
dist/game.cfg vendored
View File

@ -229,3 +229,27 @@ mp_scoreboard_showhealth "3"
// 5 - show 'Money' field to teammates and spectators
// Default value: "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)
//
// Default value: "0.35"
ff_damage_reduction_bullets "0.35"
// How much to reduce damage done to teammates by a thrown grenade.
// Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
//
// Default value: "0.25"
ff_damage_reduction_grenade "0.25"
// How much to damage a player does to himself with his own grenade
// Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
//
// Default value: "1.0"
ff_damage_reduction_grenade_self "1.0"
// How much to reduce damage done to teammates by things other than bullets and grenades.
// Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
//
// Default value: "0.25"
ff_damage_reduction_other "0.25"

View File

@ -125,6 +125,11 @@ cvar_t hullbounds_sets = { "mp_hullbounds_sets", "1", 0, 0.0f, nullptr
cvar_t scoreboard_showmoney = { "mp_scoreboard_showmoney", "3", FCVAR_SERVER, 0.0f, nullptr };
cvar_t scoreboard_showhealth = { "mp_scoreboard_showhealth", "3", FCVAR_SERVER, 0.0f, nullptr };
cvar_t ff_damage_reduction_bullets = { "ff_damage_reduction_bullets", "0.35", FCVAR_SERVER, 0.0f, nullptr };
cvar_t ff_damage_reduction_grenade = { "ff_damage_reduction_grenade", "0.25", FCVAR_SERVER, 0.0f, nullptr };
cvar_t ff_damage_reduction_grenade_self = { "ff_damage_reduction_grenade_self", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t ff_damage_reduction_other = { "ff_damage_reduction_other", "0.25", FCVAR_SERVER, 0.0f, nullptr };
void GameDLL_Version_f()
{
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
@ -302,6 +307,11 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&allow_point_servercommand);
CVAR_REGISTER(&hullbounds_sets);
CVAR_REGISTER(&ff_damage_reduction_bullets);
CVAR_REGISTER(&ff_damage_reduction_grenade);
CVAR_REGISTER(&ff_damage_reduction_grenade_self);
CVAR_REGISTER(&ff_damage_reduction_other);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

View File

@ -157,6 +157,10 @@ extern cvar_t respawn_immunitytime;
extern cvar_t kill_filled_spawn;
extern cvar_t allow_point_servercommand;
extern cvar_t hullbounds_sets;
extern cvar_t ff_damage_reduction_bullets;
extern cvar_t ff_damage_reduction_grenade;
extern cvar_t ff_damage_reduction_grenade_self;
extern cvar_t ff_damage_reduction_other;
#endif

View File

@ -861,6 +861,10 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
bTeamAttack = TRUE;
pAttack = CBasePlayer::Instance(pevAttacker);
flDamage *= clamp((pAttack == this) ?
ff_damage_reduction_grenade_self.value :
ff_damage_reduction_grenade.value, 0.0f, 1.0f);
}
#ifdef REGAMEDLL_ADD
else if (CSGameRules()->IsFreeForAll())
@ -868,10 +872,19 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
pAttack = CBasePlayer::Instance(pevAttacker);
}
#endif
else if (pGrenade->m_iTeam == m_iTeam && (&edict()->v != pevAttacker))
else if (pGrenade->m_iTeam == m_iTeam)
{
// if cvar friendlyfire is disabled
// and if the victim is teammate then ignore this damage
if (&edict()->v != pevAttacker)
{
return FALSE;
}
#ifdef REGAMEDLL_ADD
flDamage *= clamp(ff_damage_reduction_grenade_self.value, 0.0f, 1.0f);
#endif
}
}
}
@ -1054,8 +1067,14 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
if (!bAttackFFA && pAttack->m_iTeam == m_iTeam)
{
#ifdef REGAMEDLL_ADD
// bullets hurt teammates less
flDamage *= clamp((bitsDamageType & DMG_BULLET) ?
ff_damage_reduction_bullets.value :
ff_damage_reduction_other.value, 0.0f, 1.0f);
#else
flDamage *= 0.35;
#endif // #ifdef REGAMEDLL_ADD
}
if (pAttack->m_pActiveItem)
@ -7199,7 +7218,7 @@ bool EXT_FUNC CBasePlayer::__API_HOOK(HintMessageEx)(const char *pMessage, float
bool EXT_FUNC CBasePlayer::HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead, BOOL bOverride)
{
return HintMessageEx(pMessage, 6.0f, bDisplayIfPlayerDead, bOverride);
return HintMessageEx(pMessage, 6.0f, bDisplayIfPlayerDead == TRUE, bOverride == TRUE);
}
Vector CBasePlayer::GetAutoaimVector(float flDelta)