mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-12 16:07:57 +00:00
Coop imporvements
This commit is contained in:
parent
c8c1091242
commit
e42999bc4e
@ -492,6 +492,11 @@ void ClientCommand( edict_t *pEntity )
|
||||
if ( g_flWeaponCheat != 0.0 )
|
||||
DumpProps();
|
||||
}
|
||||
else if( FStrEq(pcmd, "unblock") )
|
||||
{
|
||||
if ( mp_coop.value )
|
||||
UTIL_CleanSpawnPoint( pev->origin, 150 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// tell the user they entered an unknown command
|
||||
|
@ -592,6 +592,7 @@ void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
|
||||
{
|
||||
unsigned int cCount = 0;
|
||||
BOOL fDone = FALSE;
|
||||
int classs = Classify();
|
||||
|
||||
if( HasMemory( bits_MEMORY_KILLED ) )
|
||||
{
|
||||
@ -603,8 +604,20 @@ void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
|
||||
Remember( bits_MEMORY_KILLED );
|
||||
|
||||
CBaseEntity *activator = CBaseEntity::Instance( pevAttacker );
|
||||
if( activator && activator->IsPlayer() )
|
||||
activator->AddPoints( 1, true );
|
||||
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() )
|
||||
activator->AddPoints( 1, true );
|
||||
}
|
||||
|
||||
// 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 );
|
||||
|
@ -1944,6 +1944,15 @@ void CFade::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType
|
||||
if( pev->spawnflags & SF_FADE_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( !pActivator || pActivator->IsNetClient() )
|
||||
|
@ -645,6 +645,12 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller,
|
||||
else
|
||||
// if a player dies in a deathmatch game and the killer is a client, award the killer some points
|
||||
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 );
|
||||
}
|
||||
|
@ -1586,6 +1586,12 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore )
|
||||
}
|
||||
|
||||
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 );
|
||||
WRITE_BYTE( ENTINDEX( edict() ) );
|
||||
@ -2649,14 +2655,21 @@ 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
|
||||
if( !FNullEnt( pSpot ) )
|
||||
{
|
||||
CBaseEntity *ent = NULL;
|
||||
while( ( ent = UTIL_FindEntityInSphere( ent, pSpot->pev->origin, 128 ) ) != NULL )
|
||||
if( mp_coop.value )
|
||||
{
|
||||
// if ent is a client, kill em (unless they are ourselves)
|
||||
if( ent->IsPlayer() && !(ent->edict() == player) )
|
||||
ent->TakeDamage( VARS( INDEXENT( 0 ) ), VARS( INDEXENT( 0 ) ), 300, DMG_GENERIC );
|
||||
UTIL_CleanSpawnPoint( pSpot->pev->origin, 128 );
|
||||
}
|
||||
else
|
||||
{
|
||||
CBaseEntity *ent = NULL;
|
||||
while( ( ent = UTIL_FindEntityInSphere( ent, pSpot->pev->origin, 128 ) ) != NULL )
|
||||
{
|
||||
// if ent is a client, kill em (unless they are ourselves)
|
||||
if( ent->IsPlayer() && !(ent->edict() == player) )
|
||||
ent->TakeDamage( VARS( INDEXENT( 0 ) ), VARS( INDEXENT( 0 ) ), 300, DMG_GENERIC );
|
||||
}
|
||||
goto ReturnSpot;
|
||||
}
|
||||
goto ReturnSpot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "saverestore.h"
|
||||
#include "trains.h" // trigger_camera has train functionality
|
||||
#include "gamerules.h"
|
||||
#include "game.h"
|
||||
|
||||
#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
|
||||
@ -78,8 +79,11 @@ void CFrictionModifier::Spawn( void )
|
||||
// Sets toucher's friction to m_frictionFraction (1.0 = normal friction)
|
||||
void CFrictionModifier::ChangeFriction( CBaseEntity *pOther )
|
||||
{
|
||||
if( pOther->pev->movetype != MOVETYPE_BOUNCEMISSILE && pOther->pev->movetype != MOVETYPE_BOUNCE )
|
||||
pOther->pev->friction = m_frictionFraction;
|
||||
if( !mp_coop.value )
|
||||
{
|
||||
if( pOther->pev->movetype != MOVETYPE_BOUNCEMISSILE && pOther->pev->movetype != MOVETYPE_BOUNCE )
|
||||
pOther->pev->friction = m_frictionFraction;
|
||||
}
|
||||
}
|
||||
|
||||
// Sets toucher's friction to m_frictionFraction (1.0 = normal friction)
|
||||
@ -1878,6 +1882,7 @@ void CBaseTrigger::TeleportTouch( CBaseEntity *pOther )
|
||||
|
||||
Vector tmp = VARS( pentTarget )->origin;
|
||||
|
||||
UTIL_CleanSpawnPoint( tmp, 150 );
|
||||
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)
|
||||
|
@ -1578,6 +1578,22 @@ void UTIL_StripToken( const char *pKey, char *pDest )
|
||||
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
|
||||
|
@ -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_WeaponTimeBase( void );
|
||||
void UTIL_CleanSpawnPoint( Vector origin, float radius );
|
||||
|
Loading…
Reference in New Issue
Block a user