summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-13 11:30:00 +0000
committer/dev/humancontroller <devhc@example.com>2017-04-15 17:24:20 +0200
commitecdfd00b5bff42afacd4f5267bdef9ae61bfc154 (patch)
tree18458c0ef7cd83137c188be9b4e61124765ab3a0 /src
parentade61ba16bcaa053255d8564f6ed45cfb72df13f (diff)
implement g_gradualFreeFunds: give free funds to each player every 2 minutes, regardless of kills and deaths
Diffstat (limited to 'src')
-rw-r--r--src/game/g_active.c6
-rw-r--r--src/game/g_client.c3
-rw-r--r--src/game/g_cmds.c2
-rw-r--r--src/game/g_combat.c3
-rw-r--r--src/game/g_local.h4
-rw-r--r--src/game/g_main.c2
6 files changed, 13 insertions, 7 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 4aa38cb..e909ca6 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1989,15 +1989,15 @@ void ClientThink_real( gentity_t *ent )
}
// Give clients some credit periodically
- if( ent->client->lastKillTime + FREEKILL_PERIOD < level.time )
+ if( ent->client->pers.lastFreekillTime + FREEKILL_PERIOD < level.time )
{
- if( !g_suddenDeath.integer ) {
+ if( !g_suddenDeath.integer || g_gradualFreeFunds.integer ) {
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
G_AddCreditToClient( ent->client, FREEKILL_ALIEN, qtrue );
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
G_AddCreditToClient( ent->client, FREEKILL_HUMAN, qtrue );
}
- ent->client->lastKillTime = level.time;
+ ent->client->pers.lastFreekillTime += FREEKILL_PERIOD;
}
// perform once-a-second actions
diff --git a/src/game/g_client.c b/src/game/g_client.c
index b6a3e0e..54c05df 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1950,7 +1950,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
client->ps.pm_time = 100;
client->respawnTime = level.time;
- client->lastKillTime = level.time;
+ if( !g_gradualFreeFunds.integer )
+ client->pers.lastFreekillTime = level.time;
client->inactivityTime = level.time + g_inactivity.integer * 1000;
client->latched_buttons = 0;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 9ebb659..f93b2f8 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -654,6 +654,8 @@ void G_ChangeTeam( gentity_t *ent, pTeam_t newTeam )
G_LeaveTeam( ent );
ent->client->pers.teamSelection = newTeam;
+ ent->client->pers.lastFreekillTime = level.time;
+
// G_LeaveTeam() calls G_StopFollowing() which sets spec mode to free.
// Undo that in this case, or else people can freespec while in the spawn queue on their new team
if( newTeam != PTE_NONE )
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 0622ad8..4cf2722 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -288,7 +288,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
{
AddScore( attacker, 1 );
- attacker->client->lastKillTime = level.time;
+ if( !g_gradualFreeFunds.integer )
+ attacker->client->pers.lastFreekillTime = level.time;
attacker->client->pers.statscounters.kills++;
attacker->client->pers.karma += 50;
if( attacker->client->pers.teamSelection == PTE_ALIENS )
diff --git a/src/game/g_local.h b/src/game/g_local.h
index c655950..bd337da 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -409,6 +409,7 @@ typedef struct
int ping;
int lastTeamStatus;
+ int lastFreekillTime;
int lastFloodTime; // level.time of last flood-limited command
int floodDemerits; // number of flood demerits accumulated
@@ -497,8 +498,6 @@ struct gclient_s
int airOutTime;
- int lastKillTime; // for multiple kill rewards
-
qboolean fireHeld; // used for hook
qboolean fire2Held; // used for alt fire
gentity_t *hook; // grapple hook if out
@@ -1423,6 +1422,7 @@ extern vmCvar_t g_disabledBuildables;
extern vmCvar_t g_buildPointsRecoverRate;
extern vmCvar_t g_dynamicBuildPoints;
extern vmCvar_t g_instantBuild;
+extern vmCvar_t g_gradualFreeFunds;
extern vmCvar_t g_markDeconstruct;
extern vmCvar_t g_markDeconstructMode;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 68043d8..5f6bed8 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -157,6 +157,7 @@ vmCvar_t g_disabledBuildables;
vmCvar_t g_buildPointsRecoverRate;
vmCvar_t g_dynamicBuildPoints;
vmCvar_t g_instantBuild;
+vmCvar_t g_gradualFreeFunds;
vmCvar_t g_markDeconstruct;
vmCvar_t g_markDeconstructMode;
@@ -424,6 +425,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_buildPointsRecoverRate, "g_buildPointsRecoverRate", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_dynamicBuildPoints, "g_dynamicBuildPoints", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_instantBuild, "g_instantBuild", "0", CVAR_ARCHIVE, 0, qfalse },
+ { &g_gradualFreeFunds, "g_gradualFreeFunds", "1", CVAR_ARCHIVE, 0, qtrue },
{ &g_chatTeamPrefix, "g_chatTeamPrefix", "1", CVAR_ARCHIVE },
{ &g_sayAreaRange, "g_sayAreaRange", "1000", CVAR_ARCHIVE, 0, qtrue },