]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/sv_vehicles.qc
Add a cvar to control the minimum speed a vehicle needs to be travelling to crush...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / sv_vehicles.qc
index 9a85e11455210ff3e14723792e638b8780bbcb2e..6785a9f21536b0dc1f312cdb65bdae9bdc405f97 100644 (file)
@@ -777,17 +777,12 @@ void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpa
 
        if(this.play_time < time)
        {
-               float wc = vlen(this.velocity - this.oldvelocity);
-               //dprint("oldvel: ", vtos(this.oldvelocity), "\n");
-               //dprint("vel: ", vtos(this.velocity), "\n");
-               if(_minspeed < wc)
+               if(vdist(this.velocity - this.oldvelocity, >, _minspeed))
                {
+                       float wc = vlen(this.velocity - this.oldvelocity);
                        float take = min(_speedfac * wc, _maxpain);
-                       Damage (this, NULL, NULL, take, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
+                       Damage(this, NULL, NULL, take, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
                        this.play_time = time + 0.25;
-
-                       //dprint("wc: ", ftos(wc), "\n");
-                       //dprint("take: ", ftos(take), "\n");
                }
        }
 }
@@ -924,12 +919,12 @@ void vehicles_touch(entity this, entity toucher)
        // Vehicle currently in use
        if(this.owner)
        {
-               if(!forbidWeaponUse(this.owner))
                if(toucher != NULL)
                if((this.origin_z + this.maxs_z) > (toucher.origin_z))
                if(vehicles_crushable(toucher))
+               if(!weaponLocked(this.owner))
                {
-                       if(vdist(this.velocity, >=, 30))
+                       if(vdist(this.velocity, >=, autocvar_g_vehicles_crush_minspeed))
                                Damage(toucher, this, this.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, DMG_NOWEP, '0 0 0', normalize(toucher.origin - this.origin) * autocvar_g_vehicles_crush_force);
 
                        return; // Dont do selfdamage when hitting "soft targets".