From 6a178d9d4b3c3e56b7778a62fe0f18edfdf88071 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sun, 29 Mar 2020 20:59:17 +0200 Subject: Getting this ready for testing --- src/game/g_active.c | 4 +++- src/game/g_client.c | 13 +++++++++++++ src/game/g_local.h | 3 +++ src/game/g_main.c | 6 ++++++ 4 files changed, 25 insertions(+), 1 deletion(-) 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 ] ); -- cgit