case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
case ENT_CLIENT_TURRET: ent_turret(); break;
- case ENT_CLIENT_DAMAGEEFFECT: Ent_DamageEffect(); break;
case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
default:
//error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
+void DamageEffect(float dmg, float type, float specnum1, float entnumber);
void Ent_DamageInfo(float isNew)
{
- float dmg, rad, edge, thisdmg, forcemul;
+ float dmg, rad, edge, thisdmg, forcemul, species;
vector force, thisforce;
entity oldself;
rad = ReadByte();
edge = ReadByte();
force = decompressShortVector(ReadShort());
+ species = ReadByte();
if not(isNew)
return;
if(self.event_damage)
self.event_damage(thisdmg, w_deathtype, w_org, thisforce);
+
+ DamageEffect(dmg, w_deathtype, species, self.entnum);
}
self = oldself;
.float dmgpartnum, dmgtime;
.float lifetime;
-void Ent_DamageEffect_Think()
+void DamageEffect_Think()
{
self.nextthink = time;
self.dmgtime = time + autocvar_cl_damageeffect_player;
}
-void Ent_DamageEffect()
+void DamageEffect(float dmg, float type, float specnum1, float entnumber)
{
- float dmg, type, specnum1, specnum2, entnumber, life;
- vector org;
+ float specnum2, life;
string specstr, effectnum;
entity e;
- dmg = ReadByte(); // damage amount
- type = ReadByte(); // damage weapon
- specnum1 = ReadByte(); // player species
- entnumber = ReadByte(); // player entnum
-
if(!autocvar_cl_damageeffect_player && !autocvar_cl_damageeffect_gibs)
return;
if(autocvar_cl_gentle || autocvar_cl_gentle_damage)
e.team = entnumber - 1;
e.dmgpartnum = particleeffectnum(effectnum);
e.lifetime = time + life;
- e.think = Ent_DamageEffect_Think;
+ e.think = DamageEffect_Think;
e.nextthink = time;
}
const float ENT_CLIENT_ACCURACY = 30;
const float ENT_CLIENT_SHOWNAMES = 31;
const float ENT_CLIENT_WARPZONE_TELEPORTED = 32;
-const float ENT_CLIENT_DAMAGEEFFECT = 33;
-const float ENT_CLIENT_MODEL = 34;
+const float ENT_CLIENT_MODEL = 33;
const float ENT_CLIENT_TURRET = 40;
const float ENT_CLIENT_AUXILIARYXHAIR = 50;
WriteByte(MSG_ENTITY, bound(0, self.dmg_radius, 255));
WriteByte(MSG_ENTITY, bound(1, self.dmg_edge, 255));
WriteShort(MSG_ENTITY, self.oldorigin_x);
+ WriteByte(MSG_ENTITY, self.species);
return TRUE;
}
void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
- // if the target is a player or dead body, activate damage effects
- if(targ.classname == "player" || targ.classname == "body")
- Violence_DamageEffect(targ, damage, DEATH_WEAPONOF(deathtype));
-
float mirrordamage;
float mirrorforce;
float teamdamage0;
{
Violence_GibSplash_At(source.origin + source.view_ofs, source.velocity, type, amount, source, attacker);
}
-
-// damage effect
-
-float Violence_DamageEffect_SendEntity(entity to, float sf)
-{
- WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEEFFECT);
- WriteByte(MSG_ENTITY, self.cnt); // damage amount
- WriteByte(MSG_ENTITY, self.weapon); // damage weapon
- WriteByte(MSG_ENTITY, self.state); // player species
- WriteByte(MSG_ENTITY, self.team); // player entnum
- return TRUE;
-}
-
-void Violence_DamageEffect(entity pl, float damage, float type)
-{
- if(sv_gentle || !type)
- return; // return if gentle mode is enabled or the damage was not caused by a weapon
-
- entity e;
- e = spawn();
- e.cnt = damage;
- e.weapon = type;
- e.state |= 8 * pl.species; // gib type, ranges from 0 to 15
-
- // if this is a copied dead body, send the num of its player instead
- if(pl.classname == "body")
- e.team = num_for_edict(pl.owner);
- else
- e.team = num_for_edict(pl);
-
- Net_LinkEntity(e, FALSE, 0.2, Violence_DamageEffect_SendEntity);
-}