From 5636a964d35ab2af5bb6f2f289f72478b41788fb Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sun, 29 Mar 2020 21:33:44 +0200 Subject: Keep Covid after evolving --- src/game/g_client.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/game/g_client.c b/src/game/g_client.c index 9801ff9..58ad321 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1738,7 +1738,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles int maxAmmo, maxClips; weapon_t weapon; adminRangeBoosts_t savedRanges; - + int savedKind; + float savedProgress, savedSeverity; index = ent - g_entities; client = ent->client; @@ -1815,6 +1816,9 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles saved = client->pers; savedSess = client->sess; savedPing = client->ps.ping; + savedKind = client->covidKind; + savedProgress = client->covidProgress; + savedSeverity = client->covidSeverity; for( i = 0; i < MAX_PERSISTANT; i++ ) persistant[ i ] = client->ps.persistant[ i ]; @@ -1907,14 +1911,13 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles ent->client->ps.stats[ STAT_STATE ] = 0; VectorSet( ent->client->ps.grapplePoint, 0.0f, 0.0f, 1.0f ); - client->covidKind = COVID_NONE; - client->covidProgress = 0.0f; - client->covidSeverity = 0.0f; - client->covidDamage = 0.0f; - - // 1 in 10 chance they spawn sick - //if( rand( ) % 10 == 0 ) - if( client->pers.classSelection != PCL_NONE ) + if( ent == spawn ) + { + client->covidKind = savedKind; + client->covidProgress = savedProgress; + client->covidSeverity = savedSeverity; + } + else if( client->pers.classSelection != PCL_NONE ) { for( i = 0; i < level.maxclients; i++ ) { @@ -1924,7 +1927,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles && ent->client->covidKind < COVID_RECOVERED ) goto spawn_healthy; } - + trap_SendServerCommand( ent - g_entities, "print \"^1COVID^7: You're patient zero.\n\"" ); G_ContractCoronavirus( ent ); } -- cgit