Base_Player: Make sure disconnected clients get removed from other clients.
Menu-FN: Clear Rich-presence when no longer in a game.
This commit is contained in:
parent
36b9661abd
commit
9030ad82d9
5 changed files with 25 additions and 19 deletions
|
@ -114,15 +114,11 @@ player::SendEntity
|
|||
float
|
||||
player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
/* remove our entity to other clients if we're dead */
|
||||
if (health <= 0 && ePEnt != this) {
|
||||
/* don't broadcast invisible players */
|
||||
if (IsFakeSpectator() && ePEnt != this)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* target client isn't real, they have no client-side. abandon */
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
if (!GetModelindex() && ePEnt != this)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* other players don't need to know about these attributes */
|
||||
if (ePEnt != self) {
|
||||
|
|
|
@ -230,6 +230,13 @@ m_draw(vector screensize)
|
|||
/* to prevent TCP timeouts */
|
||||
menu_chatrooms_keepalive();
|
||||
|
||||
if (g_gamestate != clientstate()) {
|
||||
g_gamestate = clientstate();
|
||||
|
||||
if (g_gamestate == 1)
|
||||
RichPresence_Clear();
|
||||
}
|
||||
|
||||
/* rich presence sanity check */
|
||||
if (RichPresence_WasSet() == false) {
|
||||
if (clientstate() == 2)
|
||||
|
|
|
@ -98,6 +98,10 @@ ClientDisconnect(void)
|
|||
{
|
||||
if (g_ents_initialized)
|
||||
g_grMode.PlayerDisconnect((base_player)self);
|
||||
|
||||
/* this will hide/remove the player from other clients */
|
||||
player pl = (player)self;
|
||||
pl.SetModelindex(0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,7 +38,7 @@ base_player::IsPlayer(void)
|
|||
int
|
||||
base_player::IsFakeSpectator(void)
|
||||
{
|
||||
if (movetype == MOVETYPE_NOCLIP)
|
||||
if (GetSolid() == SOLID_NOT)
|
||||
return (TRUE);
|
||||
|
||||
return (FALSE);
|
||||
|
@ -557,8 +557,8 @@ base_player::Death(void)
|
|||
viewzoom = 1.0;
|
||||
view_ofs = [0,0,0];
|
||||
vehicle = __NULL__;
|
||||
velocity = [0,0,0];
|
||||
gravity = __NULL__;
|
||||
SetVelocity([0,0,0]);
|
||||
SetGravity(1.0f);
|
||||
customphysics = Empty;
|
||||
iBleeds = FALSE;
|
||||
forceinfokey(this, "*deaths", ftos(deaths));
|
||||
|
@ -583,19 +583,18 @@ base_player::MakePlayer(void)
|
|||
activeweapon = 0;
|
||||
effects = 0;
|
||||
alpha = 1.0f;
|
||||
takedamage = DAMAGE_YES;
|
||||
solid = SOLID_SLIDEBOX;
|
||||
movetype = MOVETYPE_WALK;
|
||||
takedamage = DAMAGE_YES;
|
||||
SetSolid(SOLID_SLIDEBOX);
|
||||
SetMovetype(MOVETYPE_WALK);
|
||||
SetTakedamage(DAMAGE_YES);
|
||||
SetVelocity([0,0,0]);
|
||||
viewzoom = 1.0;
|
||||
vehicle = __NULL__;
|
||||
velocity = [0,0,0];
|
||||
gravity = __NULL__;
|
||||
SetGravity(1.0f);
|
||||
SendFlags = UPDATE_ALL;
|
||||
customphysics = Empty;
|
||||
iBleeds = TRUE;
|
||||
forceinfokey(this, "*deaths", ftos(deaths));
|
||||
setsize(this, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -452,8 +452,8 @@ spectator::spectator(void)
|
|||
{
|
||||
modelindex = 0;
|
||||
flags = FL_CLIENT;
|
||||
solid = SOLID_NOT;
|
||||
movetype = MOVETYPE_NOCLIP;
|
||||
SetSolid(SOLID_NOT);
|
||||
SetMovetype(MOVETYPE_NOCLIP);
|
||||
think = __NULL__;
|
||||
nextthink = 0.0f;
|
||||
maxspeed = 250;
|
||||
|
|
Loading…
Reference in a new issue