Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New CVar: mp_plant_c4_anywhere #692

Merged
merged 7 commits into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply<br/>`0` disabled <br/>`1` enabled |
| sv_autobunnyhopping | 0 | 0 | 1 | Players automatically re-jump while holding jump button.<br/>`0` disabled <br/>`1` enabled |
| sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.<br/>`0` disabled <br/>`1` enabled |
| mp_plant_c4_anywhere | 0 | 0 | 1 | When set, players can plant anywhere, not only in bombsites.<br/>`0` disabled <br/>`1` enabled |
</details>

## How to install zBot for CS 1.6?
Expand Down
7 changes: 7 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,10 @@ sv_autobunnyhopping 0
//
// Default value: "0"
sv_enablebunnyhopping 0

// When set, players can plant anywhere, not only in bombsites.
// 0 - disabled (default behaviour)
// 1 - enabled
//
// Default value: "0"
mp_plant_c4_anywhere 0
2 changes: 2 additions & 0 deletions regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ cvar_t free_armor = { "mp_free_armor", "0", 0, 0.0f, null
cvar_t allchat = { "sv_allchat", "0", 0, 0.0f, nullptr };
cvar_t sv_autobunnyhopping = { "sv_autobunnyhopping", "0", 0, 0.0f, nullptr };
cvar_t sv_enablebunnyhopping = { "sv_enablebunnyhopping", "0", 0, 0.0f, nullptr };
cvar_t plant_c4_anywhere = { "mp_plant_c4_anywhere", "0", 0, 0.0f, nullptr };

void GameDLL_Version_f()
{
Expand Down Expand Up @@ -391,6 +392,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&allchat);
CVAR_REGISTER(&sv_autobunnyhopping);
CVAR_REGISTER(&sv_enablebunnyhopping);
CVAR_REGISTER(&plant_c4_anywhere);

// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ extern cvar_t free_armor;
extern cvar_t allchat;
extern cvar_t sv_autobunnyhopping;
extern cvar_t sv_enablebunnyhopping;
extern cvar_t plant_c4_anywhere;

#endif

Expand Down
11 changes: 11 additions & 0 deletions regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6653,6 +6653,17 @@ void CBasePlayer::HandleSignals()
}
}

#ifdef REGAMEDLL_ADD
if (m_bHasC4 && (plant_c4_anywhere.value || CSPlayer()->m_bPlantC4Anywhere))
{
if (IsAlive() && (m_iTeam == TERRORIST || m_iTeam == CT)
&& !(m_signals.GetSignal() & SIGNAL_BOMB))
{
m_signals.Signal(SIGNAL_BOMB);
}
}
#endif

if (!CSGameRules()->m_bMapHasBombZone)
OLD_CheckBombTarget(this);

Expand Down
4 changes: 3 additions & 1 deletion regamedll/public/regamedll/API/CSPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class CCSPlayer: public CCSMonster {
m_bCanShootOverride(false),
m_bGameForcingRespawn(false),
m_bAutoBunnyHopping(false),
m_bMegaBunnyJumping(false)
m_bMegaBunnyJumping(false),
m_bPlantC4Anywhere(false)
{
m_szModel[0] = '\0';
}
Expand Down Expand Up @@ -129,6 +130,7 @@ class CCSPlayer: public CCSMonster {
bool m_bGameForcingRespawn;
bool m_bAutoBunnyHopping;
bool m_bMegaBunnyJumping;
bool m_bPlantC4Anywhere;
};

// Inlines
Expand Down