Add mp_legacy_bombtarget_touch cvar (#243)

* Add mp_legacy_bombtarget_touch cvar
* Enable mp_legacy_bombtarget_touch by default, typo fix
* Update README.md
This commit is contained in:
In-line 2018-01-21 14:22:58 +04:00 committed by GitHub
parent 69c274f92a
commit 7a429eadfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 14 deletions

View File

@ -42,16 +42,17 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_forcerespawn | 0 | 0 | - | Players will automatically respawn when killed.<br/>`0` disabled<br/>`>0.00001` time delay to respawn |
| mp_hostage_hurtable | 1 | 0 | 1 | The hostages can take damage.<br/>`0` disabled<br/>`1` from any team<br/>`2` only from `CT`<br/>`3` only from `T` |
| mp_show_radioicon | 1 | 0 | 1 | Show radio icon.<br/>`0` disabled<br/>`1` enabled |
| mp_old_bomb_defused_sound | 0 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused<br/>`0` disabled<br/>`1` enabled |
| mp_old_bomb_defused_sound | 1 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused<br/>`0` disabled<br/>`1` enabled |
| showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. |
| sv_alltalk | 0 | 0 | 4 | When players can hear each other ([further explanation](../../wiki/sv_alltalk)).<br/>`0` dead don't hear alive<br/>`1` no restrictions<br/>`2` teammates hear each other<br/>`3` Same as 2, but spectators hear everybody<br/>`4` alive hear alive, dead hear dead and alive.
| bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot.<br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario |
| bot_quota_mode | normal | - | - | Determines the type of quota.<br/>`normal` default behaviour<br/>`fill` the server will adjust bots to keep `N` players in the game, where `N` is bot_quota |
| 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|
## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)
* Enter '-bots' option at the command line HLDS
* Enter `-bots` option at the command line HLDS
## Build instructions
There are several software requirements for building Regamedll_CS:

13
dist/game.cfg vendored
View File

@ -137,8 +137,10 @@ mp_hostage_hurtable 1
mp_show_radioicon 1
// Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused
// 0 - disabled
// 1 - enabled (default hehavior)
// 0 - disabled (default behavior)
// 1 - enabled
//
// Default value: "1"
mp_old_bomb_defused_sound 1
// Set's the mode for the zBot
@ -177,3 +179,10 @@ sv_alltalk 0
//
// Default value: "300"
mp_item_staytime 300
// Legacy func_bomb_target touch. New one is more strict.
// 0 - New behavior
// 1 - Legacy behavior
//
// Default value: "1"
mp_legacy_bombtarget_touch "1"

View File

@ -109,13 +109,13 @@ cvar_t fraglimit = { "mp_fraglimit", "0", FCVAR_SERVER, 0.0f, nullpt
cvar_t round_restart_delay = { "mp_round_restart_delay", "5", FCVAR_SERVER, 0.0f, nullptr };
cvar_t showtriggers = { "showtriggers", "0", 0, 0.0f, nullptr }; // debug cvar shows triggers
// TODO: Maybe it's better to register in the engine?
cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t show_radioicon = { "mp_show_radioicon", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t show_radioicon = { "mp_show_radioicon", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", FCVAR_SERVER, 1.0f, nullptr };
void GameDLL_Version_f()
{
@ -269,6 +269,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&show_radioicon);
CVAR_REGISTER(&old_bomb_defused_sound);
CVAR_REGISTER(&item_staytime);
CVAR_REGISTER(&legacy_bombtarget_touch);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

View File

@ -152,6 +152,7 @@ extern cvar_t forcerespawn;
extern cvar_t show_radioicon;
extern cvar_t old_bomb_defused_sound;
extern cvar_t item_staytime;
extern cvar_t legacy_bombtarget_touch;
#endif

View File

@ -1833,6 +1833,28 @@ void CBombTarget::Spawn()
SetUse(&CBombTarget::BombTargetUse);
}
bool CBombTarget::IsPlayerInBombSite(CBasePlayer *pPlayer)
{
// Player should at least intersect with func_bomb_target.
if (!Intersects(pPlayer->pev->origin, pPlayer->pev->origin))
return false;
const Vector &absmin = pPlayer->pev->absmin;
const Vector &absmax = pPlayer->pev->absmax;
// Ensure that player's body is inside func_bomb_target's X,Y axes.
if (pev->absmin.x > absmin.x || pev->absmin.y > absmin.y)
{
return false;
}
if (pev->absmax.x < absmax.x || pev->absmax.y < absmax.y)
{
return false;
}
return true;
}
void CBombTarget::BombTargetTouch(CBaseEntity *pOther)
{
if (!pOther->IsPlayer())
@ -1840,7 +1862,11 @@ void CBombTarget::BombTargetTouch(CBaseEntity *pOther)
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pOther);
if (pPlayer->m_bHasC4)
if (pPlayer->m_bHasC4
#ifdef REGAMEDLL_FIXES
&& (legacy_bombtarget_touch.value || IsPlayerInBombSite(pPlayer))
#endif
)
{
pPlayer->m_signals.Signal(SIGNAL_BOMB);
pPlayer->m_pentCurBombTarget = ENT(pev);

View File

@ -406,10 +406,10 @@ public:
class CBombTarget: public CBaseTrigger
{
private:
bool IsPlayerInBombSite(CBasePlayer *pPlayer);
public:
virtual void Spawn();
public:
void EXPORT BombTargetTouch(CBaseEntity *pOther);
void EXPORT BombTargetUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
};