]> 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 786671c31fd5f4d1c871fde31046e81ba0d85645..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"));
 
@@ -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)
@@ -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(
@@ -670,6 +683,15 @@ void W_Shockwave_Attack(entity actor)
                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))