X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_damage.qc;h=5c0f2c233ab0eecf50c2cfd718cd7cc1d65ba64e;hp=40887ad933c5d61329e18301a41083b253eeae07;hb=a8f44b0e98aedacaae872b937ee023e24fc30878;hpb=e97b64485a434330d40ccb3adcbc3e4de9f9608a diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 40887ad93..5c0f2c233 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -491,6 +491,10 @@ entity damage_attacker; 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; @@ -501,7 +505,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if (gameover || targ.killcount == -666) return; - local entity oldself; + entity oldself; oldself = self; self = targ; damage_targ = targ; @@ -543,12 +547,15 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } else { + /* + skill based bot damage? gtfo. (tZork) if (targ.classname == "player") if (attacker.classname == "player") if (!targ.isbot) if (attacker.isbot) damage = damage * bound(0.1, (skill + 5) * 0.1, 1); - + */ + // nullify damage if teamplay is on if(deathtype != DEATH_TELEFRAG) if(attacker.classname == "player") @@ -755,26 +762,29 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(targ.takedamage == DAMAGE_AIM) if(targ != attacker) { - if(targ.classname == "player") + if(damage_headshotbonus > 0) { - // HEAD SHOT: - // find height of hit on player axis - // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot - vector headmins, headmaxs, org; - org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker)); - headmins = org + GetHeadshotMins(targ); - headmaxs = org + GetHeadshotMaxs(targ); - if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs)) + if(targ.classname == "player") + { + // HEAD SHOT: + // find height of hit on player axis + // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot + vector headmins, headmaxs, org; + org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker)); + headmins = org + GetHeadshotMins(targ); + headmaxs = org + GetHeadshotMaxs(targ); + if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs)) + { + deathtype |= HITTYPE_HEADSHOT; + } + } + else if(targ.classname == "turret_head") { deathtype |= HITTYPE_HEADSHOT; } + if(deathtype & HITTYPE_HEADSHOT) + damage *= 1 + damage_headshotbonus; } - else if(targ.classname == "turret_head") - { - deathtype |= HITTYPE_HEADSHOT; - } - if(deathtype & HITTYPE_HEADSHOT) - damage *= 1 + damage_headshotbonus; entity victim; if((targ.vehicle_flags & VHF_ISVEHICLE) && targ.owner) @@ -982,13 +992,13 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e finaldmg = coredamage * power + edgedamage * (1 - power); if (finaldmg > 0) { - local float a; - local float c; - local float hits; - local float total; - local float hitratio; - local vector hitloc; - local vector myblastorigin; + float a; + float c; + float hits; + float total; + float hitratio; + vector hitloc; + vector myblastorigin; myblastorigin = WarpZone_TransformOrigin(targ, blastorigin); center = targ.origin + (targ.mins + targ.maxs) * 0.5; // if it's a player, use the view origin as reference