mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-08 21:14:14 +00:00
Network gravgun hacks. fake prop position to reduce visible lag
This commit is contained in:
parent
64de53674f
commit
e444f097c2
@ -1287,6 +1287,27 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
|
||||
if( ent->v.movetype == MOVETYPE_WALK || ent->v.movetype == MOVETYPE_STEP )
|
||||
//state->effects |= EF_NOINTERP;
|
||||
state->movetype = MOVETYPE_TOSS;
|
||||
// gravgun hacks
|
||||
if( ent->pvPrivateData && CBaseEntity::Instance( ent)->m_fireState == ENTINDEX(host) )
|
||||
{
|
||||
static float times[32];
|
||||
float tdiff = gpGlobals->time - times[ENTINDEX(host) - 1];
|
||||
if( tdiff > 1 )
|
||||
tdiff = 0;
|
||||
int ping, loss;
|
||||
|
||||
|
||||
state->solid = SOLID_NOT;
|
||||
//state->effects |= EF_NOINTERP;
|
||||
// update rate correction (will be interpolated on client)
|
||||
PLAYER_CNX_STATS( host, &ping, &loss );
|
||||
if( ping > 300 )
|
||||
ping = 300;
|
||||
state->origin = state->origin + host->v.velocity * tdiff + host->v.velocity * 0.001 *ping;
|
||||
|
||||
//state->movetype = MOVETYPE_WALK;
|
||||
times[ENTINDEX(host) - 1] = gpGlobals->time;
|
||||
}
|
||||
}
|
||||
|
||||
// Special stuff for players only
|
||||
|
@ -264,6 +264,8 @@ void CGravGun::Attack(void)
|
||||
|
||||
//CBaseEntity* crosent = TraceForward(m_pPlayer, 1000);
|
||||
CBaseEntity* crossent = m_hAimentEntity;
|
||||
if( m_hAimentEntity )
|
||||
m_hAimentEntity->m_fireState = 0;
|
||||
m_hAimentEntity = NULL;
|
||||
if( !crossent )
|
||||
crossent = GetCrossEnt(vecSrc, gpGlobals->v_forward, dist + 30);
|
||||
@ -494,6 +496,7 @@ void CGravGun::GrabThink()
|
||||
|
||||
if(m_hAimentEntity)
|
||||
{
|
||||
m_hAimentEntity->m_fireState = 0;
|
||||
m_hAimentEntity->pev->velocity = Vector(0,0,0);
|
||||
m_hAimentEntity = NULL;
|
||||
}
|
||||
@ -575,6 +578,7 @@ void CGravGun::Pull(CBaseEntity* ent)
|
||||
else if( ent->TouchGravGun(m_pPlayer, 2) )
|
||||
{
|
||||
ent->pev->velocity = (target - origin)* 80;
|
||||
ent->m_fireState = ENTINDEX( m_pPlayer->edict() );
|
||||
if(ent->pev->velocity.Length()>900)
|
||||
ent->pev->velocity = (target - origin).Normalize() * 900;
|
||||
ent->pev->velocity = ent->pev->velocity + m_pPlayer->pev->velocity;
|
||||
@ -585,7 +589,11 @@ void CGravGun::Pull(CBaseEntity* ent)
|
||||
else
|
||||
{
|
||||
SetThink(NULL);
|
||||
m_hAimentEntity = NULL;
|
||||
if( m_hAimentEntity )
|
||||
{
|
||||
m_hAimentEntity->m_fireState = 0;
|
||||
m_hAimentEntity = NULL;
|
||||
}
|
||||
EndAttack();
|
||||
m_iStage = 0;
|
||||
}
|
||||
@ -631,6 +639,7 @@ void CGravGun::SecondaryAttack(void)
|
||||
if( m_hAimentEntity )
|
||||
{
|
||||
m_hAimentEntity->pev->velocity = Vector(0,0,0);
|
||||
m_hAimentEntity->m_fireState = 0;
|
||||
EMIT_SOUND( ENT( m_hAimentEntity->pev ), CHAN_VOICE, "weapons/357_cock1.wav", 0.8, ATTN_NORM );
|
||||
m_hAimentEntity = NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user