]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/shockwave.qc
Use special icon for shockwave
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / shockwave.qc
index 4e0b20fd9ac2f7d5658a09179a21c76eef467d52..9c8c2c37a4e7f1f56cee2cae98abe07c5ba313b2 100644 (file)
@@ -11,7 +11,7 @@ CLASS(Shockwave, Weapon)
 #endif
 /* crosshair */ ATTRIB(Shockwave, w_crosshair, string, "gfx/crosshairshotgun");
 /* crosshair */ ATTRIB(Shockwave, w_crosshair_size, float, 0.7);
-/* wepimg    */ ATTRIB(Shockwave, model2, string, "weaponshotgun");
+/* wepimg    */ ATTRIB(Shockwave, model2, string, "weaponshockwave");
 /* refname   */ ATTRIB(Shockwave, netname, string, "shockwave");
 /* wepname   */ ATTRIB(Shockwave, m_name, string, _("Shockwave"));
 
@@ -162,7 +162,7 @@ void W_Shockwave_Melee_Think(entity this)
 
                // draw lightning beams for debugging
 #ifdef DEBUG_SHOCKWAVE
-               te_lightning2(world, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5);
+               te_lightning2(NULL, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5);
                te_customflash(targpos, 40,  2, '1 1 1');
 #endif
 
@@ -397,6 +397,22 @@ void W_Shockwave_Attack(entity actor)
                false
        );
 
+       float lag = ANTILAG_LATENCY(actor);
+       if(lag < 0.001)
+               lag = 0;
+       if (!IS_REAL_CLIENT(actor))
+               lag = 0;
+       if(autocvar_g_antilag == 0 || actor.cvar_cl_noantilag)
+               lag = 0; // only do hitscan, but no antilag
+       if(lag)
+       {
+               FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_takeback(it, CS(it), time - lag));
+               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+                       if (it != actor)
+                               antilag_takeback(it, it, time - lag);
+               });
+       }
+
        while(head)
        {
                if(head.takedamage)
@@ -521,7 +537,7 @@ void W_Shockwave_Attack(entity actor)
                                // figure out the direction of force
                                final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias));
                                final_force = normalize(CENTER_OR_VIEWOFS(head) - (attack_hitpos - final_force));
-                               //te_lightning2(world, attack_hitpos, (attack_hitpos + (final_force * 200)));
+                               //te_lightning2(NULL, attack_hitpos, (attack_hitpos + (final_force * 200)));
 
                                // now multiply the direction by force units
                                final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
@@ -610,7 +626,7 @@ void W_Shockwave_Attack(entity actor)
                                // figure out the direction of force
                                final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias));
                                final_force = normalize(center - (nearest_on_line - final_force));
-                               //te_lightning2(world, nearest_on_line, (attack_hitpos + (final_force * 200)));
+                               //te_lightning2(NULL, nearest_on_line, (attack_hitpos + (final_force * 200)));
 
                                // now multiply the direction by force units
                                final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
@@ -651,11 +667,8 @@ void W_Shockwave_Attack(entity actor)
                        final_force
                );
 
-               if(accuracy_isgooddamage(actor.realowner, head))
-               {
-                       LOG_INFO("wtf\n");
-                       accuracy_add(actor.realowner, WEP_SHOCKWAVE.m_id, 0, final_damage);
-               }
+               if(accuracy_isgooddamage(actor, head))
+                       accuracy_add(actor, WEP_SHOCKWAVE.m_id, 0, final_damage);
 
                #ifdef DEBUG_SHOCKWAVE
                LOG_INFO(sprintf(
@@ -666,10 +679,19 @@ void W_Shockwave_Attack(entity actor)
                ));
                #endif
 
-               shockwave_hit[i-1] = world;
+               shockwave_hit[i-1] = NULL;
                shockwave_hit_force[i-1] = '0 0 0';
                shockwave_hit_damage[i-1] = 0;
        }
+
+       if(lag)
+       {
+               FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_restore(it, CS(it)));
+               FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+                       if (it != actor)
+                               antilag_restore(it, it);
+               });
+       }
 }
 
 METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor))
@@ -771,14 +793,14 @@ void Draw_Shockwave(entity this)
                deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
                new_min_dist = SW_DISTTOMIN;
                new_min_end = (this.sw_shotorg + (deviation * new_min_dist));
-               //te_lightning2(world, new_min_end, this.sw_shotorg);
+               //te_lightning2(NULL, new_min_end, this.sw_shotorg);
 
                // then calculate spread_to_max effect
                deviation = angle * spread_to_max;
                deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
                new_max_dist = vlen(new_min_end - endpos);
                new_max_end = (new_min_end + (deviation * new_max_dist));
-               //te_lightning2(world, new_end, prev_min_end);
+               //te_lightning2(NULL, new_end, prev_min_end);
 
 
                if(counter == 0)