mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-28 15:45:41 +03:00
New ConVar: mp_defuser_allocation
(#908)
This commit is contained in:
parent
89dda43b21
commit
051dc0751a
@ -115,6 +115,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
|
|||||||
| mp_assist_damage_threshold | 40 | 0 | 100 | Sets the percentage of damage needed to score an assist. |
|
| 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_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 |
|
| mp_freezetime_jump | 1 | 0 | 1 | Allow players to jump during freezetime.<br/> `0` disabled<br/>`1` enabled |
|
||||||
|
| mp_defuser_allocation | 0 | 0 | 2 | Give defuser on player spawn.<br/> `0` disabled<br/>`1` Random players. <br/>`2` All players. |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## How to install zBot for CS 1.6?
|
## How to install zBot for CS 1.6?
|
||||||
|
8
dist/game.cfg
vendored
8
dist/game.cfg
vendored
@ -567,3 +567,11 @@ mp_freezetime_duck "1"
|
|||||||
//
|
//
|
||||||
// Default value: "1"
|
// Default value: "1"
|
||||||
mp_freezetime_jump "1"
|
mp_freezetime_jump "1"
|
||||||
|
|
||||||
|
// Give defuser on player spawn
|
||||||
|
// 0 - No free defusers (default behavior)
|
||||||
|
// 1 - Random players
|
||||||
|
// 2 - All players
|
||||||
|
//
|
||||||
|
// Default value: "0"
|
||||||
|
mp_defuser_allocation "0"
|
||||||
|
@ -177,6 +177,7 @@ cvar_t hostages_rescued_ratio = { "mp_hostages_rescued_ratio", "1.0", 0, 1.0f, n
|
|||||||
cvar_t legacy_vehicle_block = { "mp_legacy_vehicle_block", "1", 0, 0.0f, nullptr };
|
cvar_t legacy_vehicle_block = { "mp_legacy_vehicle_block", "1", 0, 0.0f, nullptr };
|
||||||
|
|
||||||
cvar_t dying_time = { "mp_dying_time", "3.0", 0, 3.0f, nullptr };
|
cvar_t dying_time = { "mp_dying_time", "3.0", 0, 3.0f, nullptr };
|
||||||
|
cvar_t defuser_allocation = { "mp_defuser_allocation", "0", 0, 0.0f, nullptr };
|
||||||
|
|
||||||
void GameDLL_Version_f()
|
void GameDLL_Version_f()
|
||||||
{
|
{
|
||||||
@ -439,6 +440,7 @@ void EXT_FUNC GameDLLInit()
|
|||||||
|
|
||||||
CVAR_REGISTER(&freezetime_duck);
|
CVAR_REGISTER(&freezetime_duck);
|
||||||
CVAR_REGISTER(&freezetime_jump);
|
CVAR_REGISTER(&freezetime_jump);
|
||||||
|
CVAR_REGISTER(&defuser_allocation);
|
||||||
|
|
||||||
// print version
|
// print version
|
||||||
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
|
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
|
||||||
|
@ -200,6 +200,7 @@ extern cvar_t deathmsg_flags;
|
|||||||
extern cvar_t assist_damage_threshold;
|
extern cvar_t assist_damage_threshold;
|
||||||
extern cvar_t freezetime_duck;
|
extern cvar_t freezetime_duck;
|
||||||
extern cvar_t freezetime_jump;
|
extern cvar_t freezetime_jump;
|
||||||
|
extern cvar_t defuser_allocation;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -255,6 +255,13 @@ enum KillRarity
|
|||||||
KILLRARITY_REVENGE = 0x100 // Revenge by the killer
|
KILLRARITY_REVENGE = 0x100 // Revenge by the killer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DEFUSERALLOCATION_NONE = 0,
|
||||||
|
DEFUSERALLOCATION_RANDOM = 1,
|
||||||
|
DEFUSERALLOCATION_ALL = 2,
|
||||||
|
};
|
||||||
|
|
||||||
class CItem;
|
class CItem;
|
||||||
|
|
||||||
class CGameRules
|
class CGameRules
|
||||||
@ -738,6 +745,8 @@ public:
|
|||||||
int GetRarityOfKill(CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, const char *killerWeaponName, bool bFlashAssist);
|
int GetRarityOfKill(CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, const char *killerWeaponName, bool bFlashAssist);
|
||||||
CBasePlayer *CheckAssistsToKill(CBaseEntity *pKiller, CBasePlayer *pVictim, bool &bFlashAssist);
|
CBasePlayer *CheckAssistsToKill(CBaseEntity *pKiller, CBasePlayer *pVictim, bool &bFlashAssist);
|
||||||
|
|
||||||
|
void GiveDefuserToRandomPlayer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int iTeam);
|
void MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int iTeam);
|
||||||
|
|
||||||
|
@ -2063,6 +2063,11 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(RestartRound)()
|
|||||||
GiveC4();
|
GiveC4();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_ADD
|
||||||
|
if (m_bMapHasBombTarget && (int)defuser_allocation.value == DEFUSERALLOCATION_RANDOM)
|
||||||
|
GiveDefuserToRandomPlayer();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (TheBots)
|
if (TheBots)
|
||||||
{
|
{
|
||||||
TheBots->OnEvent(EVENT_BUY_TIME_START);
|
TheBots->OnEvent(EVENT_BUY_TIME_START);
|
||||||
@ -3837,6 +3842,10 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(PlayerSpawn)(CBasePlayer *pPlayer)
|
|||||||
#ifdef REGAMEDLL_ADD
|
#ifdef REGAMEDLL_ADD
|
||||||
if (respawn_immunitytime.value > 0)
|
if (respawn_immunitytime.value > 0)
|
||||||
pPlayer->SetSpawnProtection(respawn_immunitytime.value);
|
pPlayer->SetSpawnProtection(respawn_immunitytime.value);
|
||||||
|
|
||||||
|
// remove any defusers left over from previous random if there is just one random one
|
||||||
|
if (m_bMapHasBombTarget && (int)defuser_allocation.value == DEFUSERALLOCATION_RANDOM)
|
||||||
|
pPlayer->RemoveDefuser();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5376,3 +5385,54 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(SendDeathMessage)(CBaseEntity *pKil
|
|||||||
|
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHalfLifeMultiplay::GiveDefuserToRandomPlayer()
|
||||||
|
{
|
||||||
|
int iDefusersToGive = 2;
|
||||||
|
CUtlVector<CBasePlayer *> candidates;
|
||||||
|
candidates.EnsureCapacity(MAX_CLIENTS);
|
||||||
|
|
||||||
|
// add all CT candidates to a list
|
||||||
|
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||||
|
{
|
||||||
|
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||||
|
if (!pPlayer || FNullEnt(pPlayer->edict()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!pPlayer->IsAlive() || pPlayer->m_iTeam != CT)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
candidates.AddToTail(pPlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// randomly shuffle the list; this will keep the selection random in case of ties
|
||||||
|
for (int i = 0; i < candidates.Count(); i++) {
|
||||||
|
SWAP(candidates[i], candidates[RANDOM_LONG(0, candidates.Count() - 1)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// now sort the shuffled list into subgroups
|
||||||
|
candidates.Sort([](CBasePlayer *const *left, CBasePlayer *const *right) -> int {
|
||||||
|
// should we prioritize humans over bots?
|
||||||
|
if (cv_bot_defer_to_human.value != 0.0f)
|
||||||
|
{
|
||||||
|
if ((*left)->IsBot() && !(*right)->IsBot())
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (!(*left)->IsBot() && (*right)->IsBot())
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// give defusers to the first N candidates
|
||||||
|
for (int i = 0; i < iDefusersToGive && i < candidates.Count(); ++i)
|
||||||
|
{
|
||||||
|
CBasePlayer *pPlayer = candidates[i];
|
||||||
|
assert(pPlayer && pPlayer->m_iTeam == CT && pPlayer->IsAlive());
|
||||||
|
|
||||||
|
pPlayer->GiveDefuser();
|
||||||
|
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Got_defuser");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -10314,6 +10314,9 @@ void EXT_FUNC CBasePlayer::__API_HOOK(OnSpawnEquip)(bool addDefault, bool equipG
|
|||||||
case ARMOR_VESTHELM: GiveNamedItemEx("item_assaultsuit"); break;
|
case ARMOR_VESTHELM: GiveNamedItemEx("item_assaultsuit"); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NeedsDefuseKit() && (int)defuser_allocation.value == DEFUSERALLOCATION_ALL)
|
||||||
|
GiveNamedItemEx("item_thighpack");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user