X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fserver%2Fw_common.qc;h=45b5545dd16273a50e5fa495defb737026d1a126;hb=75db5cf91cf6fb42ae6472d2ba3f6f714b59863c;hp=dfd5c77b6975566a6e9a29fe0013af30d1466d7c;hpb=3fd63d6feb784a8045d5bcae80db8755f9b7005f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index dfd5c77b6..45b5545dd 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -26,9 +26,9 @@ void W_GiveWeapon (entity e, float wep, string name) .vector railgunforce; void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, float deathtype) { - local vector hitloc, force, endpoint, dir; - local entity ent, endent; - local float endq3surfaceflags; + vector hitloc, force, endpoint, dir; + entity ent, endent; + float endq3surfaceflags; float totaldmg; entity o; @@ -353,6 +353,8 @@ void fireBallisticBullet_trace_callback(vector start, vector hit, vector end) { if(vlen(trace_endpos - fireBallisticBullet_trace_callback_ent.origin) > 16) zcurveparticles_from_tracetoss(fireBallisticBullet_trace_callback_eff, fireBallisticBullet_trace_callback_ent.origin, trace_endpos, fireBallisticBullet_trace_callback_ent.velocity); + WarpZone_trace_forent = world; + self.owner = world; } void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float headshotbonus, float force, float dtype, float tracereffects, float gravityfactor, float bulletconstant) @@ -416,7 +418,8 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f if(lag) FOR_EACH_PLAYER(pl) - antilag_takeback(pl, time - lag); + if(pl != self) + antilag_takeback(pl, time - lag); oldself = self; self = proj; @@ -438,15 +441,6 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f trace_fraction = 0; fireBallisticBullet_trace_callback_ent = self; fireBallisticBullet_trace_callback_eff = eff; - // FIXME can we somehow do this with just ONE trace? - WarpZone_TraceToss(self, self.owner); - if(self.owner && WarpZone_trace_firstzone) - { - self.owner = world; - self.velocity = v0; - self.gravity = g0; - continue; - } WarpZone_TraceToss_ThroughZone(self, self.owner, world, fireBallisticBullet_trace_callback); self.velocity = v0; self.gravity = g0; @@ -503,7 +497,8 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f if(lag) FOR_EACH_PLAYER(pl) - antilag_restore(pl); + if(pl != self) + antilag_restore(pl); remove(proj); @@ -545,26 +540,42 @@ float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtyp { float is_from_contents = (deathtype == DEATH_SLIME || deathtype == DEATH_LAVA); float is_from_owner = (inflictor == projowner); + float is_from_exception = (exception != -1); + print(strcat("from_contents ", ftos(is_from_contents), " : from_owner ", ftos(is_from_owner), " : exception ", strcat(ftos(is_from_exception), " (", ftos(exception), "). \n"))); + if(autocvar_g_projectiles_damage <= -2) - return FALSE; // no damage to projectiles at all, not even with the exceptions - + { + return FALSE; // no damage to projectiles at all, not even with the exceptions + } else if(autocvar_g_projectiles_damage == -1) - if not(exception) - return FALSE; // no damage other than exceptions (electro combo, hagar join explode, minelayer mines) - + { + if(is_from_exception) + return (exception); // if exception is detected, allow it to override + else + return FALSE; // otherwise, no other damage is allowed + } else if(autocvar_g_projectiles_damage == 0) - if not(is_from_contents || exception) - return FALSE; // only damage from contents or exceptions is allowed - + { + if(is_from_exception) + return (exception); // if exception is detected, allow it to override + else if not(is_from_contents) + return FALSE; // otherwise, only allow damage from contents + } else if(autocvar_g_projectiles_damage == 1) - if not(is_from_contents || is_from_owner || exception) - return FALSE; // only self damage or damage from contents or exceptions is allowed - - // -2 or lower disables all damage including exceptions - // 2 or higher automatically allows all damage normally + { + if(is_from_exception) + return (exception); // if exception is detected, allow it to override + else if not(is_from_contents || is_from_owner) + return FALSE; // otherwise, only allow self damage and damage from contents + } + else if(autocvar_g_projectiles_damage == 2) // allow any damage, but override for exceptions + { + if(is_from_exception) + return (exception); // if exception is detected, allow it to override + } - return TRUE; // continue with the damage as planned + return TRUE; // if none of these return, then allow damage anyway. } void W_PrepareExplosionByDamage(entity attacker, void() explode)