From: Mario Date: Sat, 23 Jul 2016 23:01:18 +0000 (+1000) Subject: Apply antilag to shockwave, also fix accuracy X-Git-Tag: xonotic-v0.8.2~700^2~49 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=de21aefe5d792a3120bc0f7e224c9bba15969ed0;p=xonotic%2Fxonotic-data.pk3dir.git Apply antilag to shockwave, also fix accuracy --- diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 786671c31..7982983d8 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -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))