Coop imporvements

This commit is contained in:
mittorn 2016-09-27 19:59:29 +00:00
parent c8c1091242
commit e42999bc4e
8 changed files with 78 additions and 10 deletions

View File

@ -492,6 +492,11 @@ void ClientCommand( edict_t *pEntity )
if ( g_flWeaponCheat != 0.0 ) if ( g_flWeaponCheat != 0.0 )
DumpProps(); DumpProps();
} }
else if( FStrEq(pcmd, "unblock") )
{
if ( mp_coop.value )
UTIL_CleanSpawnPoint( pev->origin, 150 );
}
else else
{ {
// tell the user they entered an unknown command // tell the user they entered an unknown command

View File

@ -592,6 +592,7 @@ void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
{ {
unsigned int cCount = 0; unsigned int cCount = 0;
BOOL fDone = FALSE; BOOL fDone = FALSE;
int classs = Classify();
if( HasMemory( bits_MEMORY_KILLED ) ) if( HasMemory( bits_MEMORY_KILLED ) )
{ {
@ -603,8 +604,20 @@ void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
Remember( bits_MEMORY_KILLED ); Remember( bits_MEMORY_KILLED );
CBaseEntity *activator = CBaseEntity::Instance( pevAttacker ); CBaseEntity *activator = CBaseEntity::Instance( pevAttacker );
if( classs == CLASS_HUMAN_PASSIVE || classs == CLASS_PLAYER_ALLY )
{
if( activator && activator->IsPlayer() )
{
activator->pev->frags -= 30;
activator->AddPoints( 0, true );
activator->pev->frags -= 50;
}
}
else if( classs >= 5 )
{
if( activator && activator->IsPlayer() ) if( activator && activator->IsPlayer() )
activator->AddPoints( 1, true ); activator->AddPoints( 1, true );
}
// clear the deceased's sound channels.(may have been firing or reloading when killed) // clear the deceased's sound channels.(may have been firing or reloading when killed)
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "common/null.wav", 1, ATTN_NORM ); EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "common/null.wav", 1, ATTN_NORM );

View File

@ -1944,6 +1944,15 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType
if( pev->spawnflags & SF_FADE_MODULATE ) if( pev->spawnflags & SF_FADE_MODULATE )
fadeFlags |= FFADE_MODULATE; fadeFlags |= FFADE_MODULATE;
if( mp_coop.value )
{
if( pev->dmg_take > 1 )
pev->dmg_take = 1;
if( pev->dmg_save > 1 )
pev->dmg_save = 1;
}
if( mp_coop.value || pev->spawnflags & SF_FADE_ONLYONE ) if( mp_coop.value || pev->spawnflags & SF_FADE_ONLYONE )
{ {
if( !pActivator || pActivator->IsNetClient() ) if( !pActivator || pActivator->IsNetClient() )

View File

@ -645,6 +645,12 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
else else
// if a player dies in a deathmatch game and the killer is a client, award the killer some points // if a player dies in a deathmatch game and the killer is a client, award the killer some points
pKiller->frags += IPointsForKill( peKiller, pVictim ); pKiller->frags += IPointsForKill( peKiller, pVictim );
if( pKiller->frags < -50 )
{
char cmd[10] = {};
snprintf( cmd, 10, "kick %d\n", ENTINDEX(pKiller->pContainingEntity) - 1 );
SERVER_COMMAND( cmd );
}
FireTargets( "game_playerkill", ktmp, ktmp, USE_TOGGLE, 0 ); FireTargets( "game_playerkill", ktmp, ktmp, USE_TOGGLE, 0 );
} }

View File

@ -1586,6 +1586,12 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore )
} }
pev->frags += score; pev->frags += score;
if( pev->frags < -50 )
{
char cmd[10] = {};
snprintf( cmd, 10, "kick %d\n", ENTINDEX(pev->pContainingEntity) - 1 );
SERVER_COMMAND( cmd );
}
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo ); MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
WRITE_BYTE( ENTINDEX( edict() ) ); WRITE_BYTE( ENTINDEX( edict() ) );
@ -2648,6 +2654,12 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
// we haven't found a place to spawn yet, so kill any guy at the first spawn point and spawn there // we haven't found a place to spawn yet, so kill any guy at the first spawn point and spawn there
if( !FNullEnt( pSpot ) ) if( !FNullEnt( pSpot ) )
{
if( mp_coop.value )
{
UTIL_CleanSpawnPoint( pSpot->pev->origin, 128 );
}
else
{ {
CBaseEntity *ent = NULL; CBaseEntity *ent = NULL;
while( ( ent = UTIL_FindEntityInSphere( ent, pSpot->pev->origin, 128 ) ) != NULL ) while( ( ent = UTIL_FindEntityInSphere( ent, pSpot->pev->origin, 128 ) ) != NULL )
@ -2659,6 +2671,7 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
goto ReturnSpot; goto ReturnSpot;
} }
} }
}
// If startspot is set, (re)spawn there. // If startspot is set, (re)spawn there.
if( FStringNull( gpGlobals->startspot ) || !strlen(STRING( gpGlobals->startspot ) ) ) if( FStringNull( gpGlobals->startspot ) || !strlen(STRING( gpGlobals->startspot ) ) )

View File

@ -27,6 +27,7 @@
#include "saverestore.h" #include "saverestore.h"
#include "trains.h" // trigger_camera has train functionality #include "trains.h" // trigger_camera has train functionality
#include "gamerules.h" #include "gamerules.h"
#include "game.h"
#define SF_TRIGGER_PUSH_START_OFF 2//spawnflag that makes trigger_push spawn turned OFF #define SF_TRIGGER_PUSH_START_OFF 2//spawnflag that makes trigger_push spawn turned OFF
#define SF_TRIGGER_HURT_TARGETONCE 1// Only fire hurt target once #define SF_TRIGGER_HURT_TARGETONCE 1// Only fire hurt target once
@ -77,10 +78,13 @@ void CFrictionModifier::Spawn( void )
// Sets toucher's friction to m_frictionFraction (1.0 = normal friction) // Sets toucher's friction to m_frictionFraction (1.0 = normal friction)
void CFrictionModifier::ChangeFriction( CBaseEntity *pOther ) void CFrictionModifier::ChangeFriction( CBaseEntity *pOther )
{
if( !mp_coop.value )
{ {
if( pOther->pev->movetype != MOVETYPE_BOUNCEMISSILE && pOther->pev->movetype != MOVETYPE_BOUNCE ) if( pOther->pev->movetype != MOVETYPE_BOUNCEMISSILE && pOther->pev->movetype != MOVETYPE_BOUNCE )
pOther->pev->friction = m_frictionFraction; pOther->pev->friction = m_frictionFraction;
} }
}
// Sets toucher's friction to m_frictionFraction (1.0 = normal friction) // Sets toucher's friction to m_frictionFraction (1.0 = normal friction)
void CFrictionModifier::KeyValue( KeyValueData *pkvd ) void CFrictionModifier::KeyValue( KeyValueData *pkvd )
@ -1878,6 +1882,7 @@ void CBaseTrigger::TeleportTouch( CBaseEntity *pOther )
Vector tmp = VARS( pentTarget )->origin; Vector tmp = VARS( pentTarget )->origin;
UTIL_CleanSpawnPoint( tmp, 150 );
if( pOther->IsPlayer() ) if( pOther->IsPlayer() )
{ {
tmp.z -= pOther->pev->mins.z;// make origin adjustments in case the teleportee is a player. (origin in center, not at feet) tmp.z -= pOther->pev->mins.z;// make origin adjustments in case the teleportee is a player. (origin in center, not at feet)

View File

@ -1578,6 +1578,22 @@ void UTIL_StripToken( const char *pKey, char *pDest )
pDest[i] = 0; pDest[i] = 0;
} }
void UTIL_CleanSpawnPoint( Vector origin, float dist )
{
CBaseEntity *ent = NULL;
while( ( ent = UTIL_FindEntityInSphere( ent, origin, dist ) ) != NULL )
{
if( ent->IsPlayer() )
{
TraceResult tr = {0};
UTIL_TraceHull( ent->pev->origin + Vector( 0, 0, 36), ent->pev->origin + Vector( RANDOM_FLOAT( -150, 150 ), RANDOM_FLOAT( -150, 150 ), 0 ), dont_ignore_monsters, human_hull, ent->edict(), &tr);
//UTIL_TraceModel( ent->pev->origin + Vector( 0, 0, 36), ent->pev->origin + Vector( RANDOM_FLOAT( -150, 150 ), RANDOM_FLOAT( -150, 150 ), 0 ), 0, ent->edict(), &tr);
UTIL_SetOrigin(ent->pev, tr.vecEndPos);
}
}
}
// -------------------------------------------------------------- // --------------------------------------------------------------
// //
// CSave // CSave

View File

@ -568,3 +568,4 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high );
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high ); float UTIL_SharedRandomFloat( unsigned int seed, float low, float high );
float UTIL_WeaponTimeBase( void ); float UTIL_WeaponTimeBase( void );
void UTIL_CleanSpawnPoint( Vector origin, float radius );