Skip to content
Permalink
Browse files

mod: add nostamina command

  • Loading branch information...
Aranud committed Aug 13, 2019
1 parent 9ef41c2 commit dba76a59c631607e4a004a32fe71391e56ba998e
Showing with 57 additions and 0 deletions.
  1. +1 −0 src/cgame/cg_consolecmds.c
  2. +10 −0 src/game/g_active.c
  3. +45 −0 src/game/g_cmds.c
  4. +1 −0 src/game/g_local.h
@@ -2045,6 +2045,7 @@ void CG_InitConsoleCommands(void)
trap_AddCommand("vote");

trap_AddCommand("nofatigue");
trap_AddCommand("nostamina");

trap_AddCommand("follownext");
trap_AddCommand("followprev");
@@ -625,6 +625,11 @@ void SpectatorThink(gentity_t *ent, usercmd_t *ucmd)
ent->client->pmext.sprintTime = SPRINTTIME;
}

if (ent->flags & FL_NOSTAMINA)
{
ent->client->ps.classWeaponTime = 0;
}

client->oldbuttons = client->buttons;
client->buttons = ucmd->buttons;

@@ -1513,6 +1518,11 @@ void ClientThink_real(gentity_t *ent, qboolean skipServerTime)
ent->client->pmext.sprintTime = SPRINTTIME;
}

if (ent->flags & FL_NOSTAMINA)
{
ent->client->ps.classWeaponTime = 0;
}

if (g_entities[ent->client->ps.identifyClient].inuse && g_entities[ent->client->ps.identifyClient].client &&
(ent->client->sess.sessionTeam == g_entities[ent->client->ps.identifyClient].client->sess.sessionTeam ||
g_entities[ent->client->ps.identifyClient].client->ps.powerups[PW_OPS_DISGUISED]))
@@ -1075,6 +1075,47 @@ void Cmd_Noclip_f(gentity_t *ent)
trap_SendServerCommand(ent - g_entities, va("print \"%s\"", msg));
}

/**
* @brief Sets client to nostamina
* @param[in,out] ent
*
* @note argv(0) nostamina
*/
void Cmd_Nostamina_f(gentity_t *ent)
{
char *msg;
char *name = ConcatArgs(1);

if (!CheatsOk(ent))
{
return;
}

if (!Q_stricmp(name, "on") || atoi(name))
{
ent->flags |= FL_NOSTAMINA;
}
else if (!Q_stricmp(name, "off") || !Q_stricmp(name, "0"))
{
ent->flags &= ~FL_NOSTAMINA;
}
else
{
ent->flags ^= FL_NOSTAMINA;
}

if (!(ent->flags & FL_NOSTAMINA))
{
msg = "nostamina OFF\n";
}
else
{
msg = "nostamina ON\n";
}

trap_SendServerCommand(ent - g_entities, va("print \"%s\"", msg));
}

/**
* @brief Cmd_Kill_f
* @param[in,out] ent
@@ -4998,6 +5039,10 @@ void ClientCommand(int clientNum)
{
Cmd_Noclip_f(ent);
}
else if (Q_stricmp(cmd, "nostamina") == 0)
{
Cmd_Nostamina_f(ent);
}
else if (Q_stricmp(cmd, "kill") == 0)
{
Cmd_Kill_f(ent);
@@ -70,6 +70,7 @@
#define FL_DROPPED_ITEM 0x00001000
#define FL_NO_BOTS 0x00002000 ///< spawn point not for bot use
#define FL_NO_HUMANS 0x00004000 ///< spawn point just for bots
#define FL_NOSTAMINA 0x00008000 ///< cheat flag no stamina
#define FL_NOFATIGUE 0x00010000 ///< cheat flag no fatigue

#define FL_TOGGLE 0x00020000 ///< ent is toggling (doors use this for ex.)

0 comments on commit dba76a5

Please sign in to comment.
You can’t perform that action at this time.