From 8f1aa093e2448ad33fe5ca1d967b3ee90a167afe Mon Sep 17 00:00:00 2001 From: drjaska Date: Thu, 29 Jun 2023 09:21:22 +0300 Subject: [PATCH] give gibbed players a soul --- qcsrc/server/client.qc | 2 +- qcsrc/server/player.qc | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 189ba57e5..1336aef59 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1470,7 +1470,7 @@ void respawn(entity this) bool damagedbycontents_prev = this.damagedbycontents; if(this.alpha >= 0) { - if(autocvar_g_respawn_ghosts) + if(autocvar_g_respawn_ghosts && !(this.effects & EF_NODRAW)) { this.solid = SOLID_NOT; this.takedamage = DAMAGE_NO; diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index da2c48ded..9bf43125d 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -218,12 +218,31 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da this.view_ofs = '0 0 4'; Violence_GibSplash(this, 1, 1, attacker); - this.alpha = -1; + //this.alpha = -1; //postpone after potential ghost spawn to avoid temp storing this.solid = SOLID_NOT; // restore later this.takedamage = DAMAGE_NO; // restore later if(this.damagedbycontents) IL_REMOVE(g_damagedbycontents, this); this.damagedbycontents = false; + + if (autocvar_g_respawn_ghosts) + { + //this.solid = SOLID_NOT; // already set above + //this.takedamage = DAMAGE_NO; + //this.damagedbycontents = false; + set_movetype(this, MOVETYPE_FLY); + this.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed; + this.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3; + this.effects |= CSQCMODEL_EF_RESPAWNGHOST; + this.alpha = min(this.alpha, autocvar_g_respawn_ghosts_alpha); + Send_Effect(EFFECT_RESPAWN_GHOST, this.origin, '0 0 0', 1); + if(autocvar_g_respawn_ghosts_time > 0) + SUB_SetFade(this, time + autocvar_g_respawn_ghosts_time, autocvar_g_respawn_ghosts_fadetime); + + CopyBody(this, 1); + this.effects |= EF_NODRAW; // prevent another CopyBody and 2nd ghost spawns + } + this.alpha = -1; } } -- 2.39.2