summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2020-03-29 20:59:17 +0200
committerPaweł Redman <pawel.redman@gmail.com>2020-03-29 20:59:17 +0200
commit6a178d9d4b3c3e56b7778a62fe0f18edfdf88071 (patch)
tree48c5b3ce2e2b7a0205beaf9e22b32a45e4a1caf9
parentb3dc8f4fdb81636f87f3cb587290c33a4b58ab4f (diff)
Getting this ready for testing
-rw-r--r--src/game/g_active.c4
-rw-r--r--src/game/g_client.c13
-rw-r--r--src/game/g_local.h3
-rw-r--r--src/game/g_main.c6
4 files changed, 25 insertions, 1 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 528b927..aa41c52 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -658,6 +658,8 @@ void G_Coronavirus( gentity_t *ent )
else if( distance < COVID_RANGE / 2.0f )
chance *= 2.0f;
+ chance *= g_covidInfectionFactor.value;
+
trap_SendServerCommand( (int)( ent - g_entities ), va( "print \"^1COVID:^7 Chance to infect %s^7 is ^1%f^7\n\"",
target->client->pers.netname, chance ) );
@@ -699,7 +701,7 @@ void G_Coronavirus( gentity_t *ent )
G_AddEvent( ent, EV_COUGH, 0 );
}
- client->covidDamage += client->covidSeverity;
+ client->covidDamage += client->covidSeverity * g_covidSeverityFactor.value;
if( client->covidDamage > 1.0f )
{
int damage;
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 9f6710c..9801ff9 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1915,7 +1915,20 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
// 1 in 10 chance they spawn sick
//if( rand( ) % 10 == 0 )
if( client->pers.classSelection != PCL_NONE )
+ {
+ for( i = 0; i < level.maxclients; i++ )
+ {
+ gentity_t *ent = g_entities + i;
+
+ if( ent->client && ent->health > 0 && ent->client->covidKind > COVID_NONE
+ && ent->client->covidKind < COVID_RECOVERED )
+ goto spawn_healthy;
+ }
+
+ trap_SendServerCommand( ent - g_entities, "print \"^1COVID^7: You're patient zero.\n\"" );
G_ContractCoronavirus( ent );
+ }
+spawn_healthy:
// health will count down towards max_health
ent->health = client->ps.stats[ STAT_HEALTH ] = client->ps.stats[ STAT_MAX_HEALTH ]; //* 1.25;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 68c1ac8..0e7170f 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1521,6 +1521,9 @@ extern vmCvar_t g_specNoclip;
extern vmCvar_t g_practise;
extern vmCvar_t g_tyrantNerf;
+extern vmCvar_t g_covidInfectionFactor;
+extern vmCvar_t g_covidSeverityFactor;
+
void trap_Printf( const char *fmt );
void trap_Error( const char *fmt );
int trap_Milliseconds( void );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index c6b9344..410926a 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -248,6 +248,9 @@ vmCvar_t g_specNoclip;
vmCvar_t g_practise;
vmCvar_t g_tyrantNerf;
+vmCvar_t g_covidInfectionFactor;
+vmCvar_t g_covidSeverityFactor;
+
static cvarTable_t gameCvarTable[ ] =
{
// don't override the cheat state set by the system
@@ -474,6 +477,9 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_specNoclip, "g_specNoclip", "0", CVAR_ARCHIVE, 0, qtrue },
{ &g_practise, "g_practise", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_tyrantNerf, "g_tyrantNerf", "0", CVAR_ARCHIVE, 0, qfalse },
+
+ { &g_covidInfectionFactor, "g_covidInfectionFactor", "1", CVAR_ARCHIVE, 0, qtrue },
+ { &g_covidSeverityFactor, "g_covidSeverityFactor", "1", CVAR_ARCHIVE, 0, qtrue },
};
static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] );