]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into martin-t/rpc-acc
authorMartin Taibr <taibr.martin@gmail.com>
Sun, 18 Feb 2018 10:51:43 +0000 (11:51 +0100)
committerMartin Taibr <taibr.martin@gmail.com>
Sun, 18 Feb 2018 10:51:43 +0000 (11:51 +0100)
1  2 
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/server/g_damage.qc
qcsrc/server/weapons/tracing.qc

index f331e68226f616b57edb23bb712f8332a62992d0,09e6ce29e4f75aea8ea609f476430cb79a37c6db..643cfd4e31554018f7474963027bf761afcba778
@@@ -9,12 -7,7 +9,12 @@@ void W_RocketPropelledChainsaw_Explode(
        this.event_damage = func_null;
        this.takedamage = DAMAGE_NO;
  
-       float explosion_damage = RadiusDamage(this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, directhitentity);
 -      RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
++      float explosion_damage = RadiusDamage(this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
 +      if (explosion_damage > 0 && this.m_chainsaw_damage > 0) {
 +              // if chainsaw hit something, it removed fired damage (so that direct hit is 100%)
 +              // now that we also damaged something by explosion we'd go over 100% so let's add the fired damage back
 +              accuracy_add(this.realowner, DEATH_WEAPONOF(this.projectiledeathtype).m_id, WEP_CVAR(rpc, damage), 0);
 +      }
  
        delete(this);
  }
@@@ -60,17 -53,8 +60,17 @@@ void W_RocketPropelledChainsaw_Think(en
        vector mydir = normalize(this.velocity);
  
        tracebox(this.origin, this.mins, this.maxs, this.origin + mydir * (2 * myspeed_accel), MOVE_NORMAL, this);
 -      if(IS_PLAYER(trace_ent))
 -              Damage (trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force));
 +      if (IS_PLAYER(trace_ent)) {
 +              if (accuracy_isgooddamage(this.realowner, trace_ent)) {
 +                      if (this.m_chainsaw_damage == 0) { // first hit
 +                              // The fired damage of the explosion (WEP_CVAR(rpc, damage)) is already counted in the statistics (when launching the chainsaw).
 +                              // We remove it here so that a direct hit that passes through and doesn't damage anything by the explosion later is still 100%.
 +                              accuracy_add(this.realowner, DEATH_WEAPONOF(this.projectiledeathtype).m_id, WEP_CVAR(rpc, damage2) - WEP_CVAR(rpc, damage), WEP_CVAR(rpc, damage2));
 +                      }
 +                      this.m_chainsaw_damage += WEP_CVAR(rpc, damage2);
 +              }
-               Damage(trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force));
++              Damage(trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force));
 +      }
  
        this.velocity = mydir * (myspeed + (WEP_CVAR(rpc, speedaccel) * sys_frametime));
  
@@@ -84,7 -68,7 +84,7 @@@ void W_RocketPropelledChainsaw_Attack(W
        entity flash = spawn ();
  
        W_DecreaseAmmo(thiswep, actor, WEP_CVAR(rpc, ammo), weaponentity);
-       W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage));
 -      W_SetupShot_ProjectileSize (actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage), WEP_RPC.m_id);
++      W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage), WEP_RPC.m_id);
        Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
        PROJECTILE_MAKETRIGGER(missile);
  
index 5f04185ed3a02f87e1358ba6dd75cfe2dd886b6c,804d9fd713d8bae506df76f137b2fe546af58892..33dd8b2e25d1e21ed7108a416c10bbeb5d395d2c
@@@ -32,7 -32,7 +32,7 @@@ void UpdateFrags(entity player, int f
        GameRules_scoring_add_team(player, SCORE, f);
  }
  
- void GiveFrags(entity attacker, entity targ, float f, int deathtype)
 -void GiveFrags (entity attacker, entity targ, float f, int deathtype, .entity weaponentity)
++void GiveFrags(entity attacker, entity targ, float f, int deathtype, .entity weaponentity)
  {
        // TODO route through PlayerScores instead
        if(game_stopped) return;
@@@ -607,7 -604,7 +604,7 @@@ void Unfreeze(entity targ
        targ.iceblock = NULL;
  }
  
- void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 -void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
++void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
  {
        float complainteamdamage = 0;
        float mirrordamage = 0;
        }
  }
  
- float RadiusDamageForSource(entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, int deathtype, entity directhitentity)
 -float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, 
++float RadiusDamageForSource(entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe,
+                                                               float inflictorselfdamage, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity)
        // Returns total damage applies to creatures
  {
        entity  targ;
                                                }
  
                                                if(targ == directhitentity || DEATH_ISSPECIAL(deathtype))
-                                                       Damage(targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
 -                                                      Damage (targ, inflictor, attacker, finaldmg, deathtype, weaponentity, nearest, force);
++                                                      Damage(targ, inflictor, attacker, finaldmg, deathtype, weaponentity, nearest, force);
                                                else
-                                                       Damage(targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, nearest, force);
 -                                                      Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, weaponentity, nearest, force);
++                                                      Damage(targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, weaponentity, nearest, force);
                                        }
                                }
                        }
        return total_damage_to_creatures;
  }
  
- float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, entity directhitentity)
 -float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity)
++float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity)
  {
-       return RadiusDamageForSource(inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, directhitentity);
 -      return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, weaponentity, directhitentity);
++      return RadiusDamageForSource(inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, weaponentity, directhitentity);
  }
  
  float Fire_IsBurning(entity e)
Simple merge