Server: Add cvar 'mp_foosteps', which only works in multiplayer. Hence the name.

This commit is contained in:
Marco Cawthorne 2022-07-09 19:47:44 -07:00
parent 18d03b7367
commit 2735bd26f6
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 22 additions and 0 deletions

View File

@ -264,6 +264,11 @@ Footsteps_Update(void)
{
NSClientPlayer pl;
/* mp_footsteps is only available in MP matches */
if (Util_IsSingleplayer() == false)
if (autocvar(mp_footsteps, 1) == 0)
return;
if (self.classname != "player")
return;

View File

@ -298,3 +298,20 @@ string Util_FixModel(string mdl)
return mdl;
}
bool
Util_IsSingleplayer(void)
{
#ifdef SERVER
/* playerslots 1 is always singleplayer */
if (cvar("sv_playerslots") == 1)
return true;
/* only when coop is 1, only in multiplayer */
if (cvar("coop") == 1 && cvar("sv_playerslots") > 1)
return true;
#endif
/* else we're multiplayer */
return false;
}