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
|
float
|
||||||
player::SendEntity(entity ePEnt, float fChanged)
|
player::SendEntity(entity ePEnt, float fChanged)
|
||||||
{
|
{
|
||||||
/* remove our entity to other clients if we're dead */
|
/* don't broadcast invisible players */
|
||||||
if (health <= 0 && ePEnt != this) {
|
if (IsFakeSpectator() && ePEnt != this)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
if (!GetModelindex() && ePEnt != this)
|
||||||
|
|
||||||
/* target client isn't real, they have no client-side. abandon */
|
|
||||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
|
||||||
|
|
||||||
/* other players don't need to know about these attributes */
|
/* other players don't need to know about these attributes */
|
||||||
if (ePEnt != self) {
|
if (ePEnt != self) {
|
||||||
|
|
|
@ -230,6 +230,13 @@ m_draw(vector screensize)
|
||||||
/* to prevent TCP timeouts */
|
/* to prevent TCP timeouts */
|
||||||
menu_chatrooms_keepalive();
|
menu_chatrooms_keepalive();
|
||||||
|
|
||||||
|
if (g_gamestate != clientstate()) {
|
||||||
|
g_gamestate = clientstate();
|
||||||
|
|
||||||
|
if (g_gamestate == 1)
|
||||||
|
RichPresence_Clear();
|
||||||
|
}
|
||||||
|
|
||||||
/* rich presence sanity check */
|
/* rich presence sanity check */
|
||||||
if (RichPresence_WasSet() == false) {
|
if (RichPresence_WasSet() == false) {
|
||||||
if (clientstate() == 2)
|
if (clientstate() == 2)
|
||||||
|
|
|
@ -98,6 +98,10 @@ ClientDisconnect(void)
|
||||||
{
|
{
|
||||||
if (g_ents_initialized)
|
if (g_ents_initialized)
|
||||||
g_grMode.PlayerDisconnect((base_player)self);
|
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
|
int
|
||||||
base_player::IsFakeSpectator(void)
|
base_player::IsFakeSpectator(void)
|
||||||
{
|
{
|
||||||
if (movetype == MOVETYPE_NOCLIP)
|
if (GetSolid() == SOLID_NOT)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
@ -557,8 +557,8 @@ base_player::Death(void)
|
||||||
viewzoom = 1.0;
|
viewzoom = 1.0;
|
||||||
view_ofs = [0,0,0];
|
view_ofs = [0,0,0];
|
||||||
vehicle = __NULL__;
|
vehicle = __NULL__;
|
||||||
velocity = [0,0,0];
|
SetVelocity([0,0,0]);
|
||||||
gravity = __NULL__;
|
SetGravity(1.0f);
|
||||||
customphysics = Empty;
|
customphysics = Empty;
|
||||||
iBleeds = FALSE;
|
iBleeds = FALSE;
|
||||||
forceinfokey(this, "*deaths", ftos(deaths));
|
forceinfokey(this, "*deaths", ftos(deaths));
|
||||||
|
@ -583,19 +583,18 @@ base_player::MakePlayer(void)
|
||||||
activeweapon = 0;
|
activeweapon = 0;
|
||||||
effects = 0;
|
effects = 0;
|
||||||
alpha = 1.0f;
|
alpha = 1.0f;
|
||||||
takedamage = DAMAGE_YES;
|
SetSolid(SOLID_SLIDEBOX);
|
||||||
solid = SOLID_SLIDEBOX;
|
SetMovetype(MOVETYPE_WALK);
|
||||||
movetype = MOVETYPE_WALK;
|
SetTakedamage(DAMAGE_YES);
|
||||||
takedamage = DAMAGE_YES;
|
SetVelocity([0,0,0]);
|
||||||
viewzoom = 1.0;
|
viewzoom = 1.0;
|
||||||
vehicle = __NULL__;
|
vehicle = __NULL__;
|
||||||
velocity = [0,0,0];
|
SetGravity(1.0f);
|
||||||
gravity = __NULL__;
|
|
||||||
SendFlags = UPDATE_ALL;
|
SendFlags = UPDATE_ALL;
|
||||||
customphysics = Empty;
|
customphysics = Empty;
|
||||||
iBleeds = TRUE;
|
iBleeds = TRUE;
|
||||||
forceinfokey(this, "*deaths", ftos(deaths));
|
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;
|
modelindex = 0;
|
||||||
flags = FL_CLIENT;
|
flags = FL_CLIENT;
|
||||||
solid = SOLID_NOT;
|
SetSolid(SOLID_NOT);
|
||||||
movetype = MOVETYPE_NOCLIP;
|
SetMovetype(MOVETYPE_NOCLIP);
|
||||||
think = __NULL__;
|
think = __NULL__;
|
||||||
nextthink = 0.0f;
|
nextthink = 0.0f;
|
||||||
maxspeed = 250;
|
maxspeed = 250;
|
||||||
|
|
Loading…
Reference in a new issue