X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fserver%2Fg_damage.qc;h=9eaf82dc42d5684be97ad93507aa5b22b376e6eb;hb=68eb8d499b3e9b32c46ea77cd2f284af61a690c1;hp=68be349714138d5f6f865ac5d53494fd820fc1b1;hpb=1e80ce57f5d8f6f38ae19625d707db3b3c9db62a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 68be34971..9eaf82dc4 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -61,7 +61,7 @@ float damage_headshotbonus; // bonus multiplier for head shots, set to 0 after u float IsDifferentTeam(entity a, entity b) { - if(teams_matter) + if(teamplay) { if(a.team == b.team) return 0; @@ -299,13 +299,9 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) string s, a, msg; float w, type; - if (targ.classname == "player" || targ.classname == "corpse") + if (targ.classname == "player") { - if (targ.classname == "corpse") - s = "A corpse"; - else - s = targ.netname; - + s = targ.netname; a = attacker.netname; if (targ == attacker) // suicides @@ -323,7 +319,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) if (targ.killcount > 2) msg = ftos(targ.killcount); - if(teams_matter && deathtype == DEATH_MIRRORDAMAGE) + if(teamplay && deathtype == DEATH_MIRRORDAMAGE) { if(attacker.team == COLOR_TEAM1) deathtype = KILL_TEAM_RED; @@ -333,9 +329,9 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) Send_KillNotification(s, msg, ftos(w), deathtype, MSG_SUICIDE); } - else if (attacker.classname == "player" || attacker.classname == "gib") + else if (attacker.classname == "player") { - if(teams_matter && attacker.team == targ.team) + if(teamplay && attacker.team == targ.team) { if(attacker.team == COLOR_TEAM1) type = KILL_TEAM_RED; @@ -494,7 +490,6 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) entity damage_targ; entity damage_inflictor; entity damage_attacker; -.float prevhitsound; void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) { @@ -565,7 +560,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float damage = 0; force = '0 0 0'; } - else if(teams_matter && attacker.team == targ.team) + else if(teamplay && attacker.team == targ.team) { if(autocvar_teamplay_mode == 1) damage = 0; @@ -783,20 +778,24 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(deathtype & HITTYPE_HEADSHOT) damage *= 1 + damage_headshotbonus; - if(targ.classname == "player") + entity victim; + if((targ.vehicle_flags & VHF_ISVEHICLE) && targ.owner) + victim = targ.owner; + else + victim = targ; + + if(victim.classname == "player" || victim.turrcaps_flags & TFL_TURRCAPS_ISTURRET) { - if(IsDifferentTeam(targ, attacker)) + if(IsDifferentTeam(victim, attacker)) { if(damage > 0) { if(deathtype != DEATH_FIRE) - if(attacker.prevhitsound + autocvar_sv_hitsound_antispam_time < time) { - if(targ.BUTTON_CHAT) + if(victim.BUTTON_CHAT) attacker.typehitsound += 1; else attacker.hitsound += 1; - attacker.prevhitsound = time; } damage_goodhits += 1; @@ -804,12 +803,13 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if not(DEATH_ISSPECIAL(deathtype)) { + if(targ.classname == "player") // don't do this for vehicles if(!g_minstagib) - if(IsFlying(targ)) + if(IsFlying(victim)) yoda = 1; if(g_minstagib) - if(targ.items & IT_STRENGTH) + if(victim.items & IT_STRENGTH) yoda = 1; if(deathtype & HITTYPE_HEADSHOT) @@ -822,10 +822,8 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float else { if(deathtype != DEATH_FIRE) - if(attacker.prevhitsound + autocvar_sv_hitsound_antispam_time < time) { attacker.typehitsound += 1; - attacker.prevhitsound = time; } if(mirrordamage > 0) if(time > attacker.teamkill_complain) @@ -844,7 +842,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if (vlen(force)) if (self.classname != "player" || time >= self.spawnshieldtime || g_midair) { - self.velocity = self.velocity + self.damageforcescale * force; + self.velocity = self.velocity + damage_explosion_calcpush(self.damageforcescale * force, self.velocity, autocvar_g_balance_damagepush_speedfactor); self.flags &~= FL_ONGROUND; UpdateCSQCProjectile(self); }