]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/accuracy.qc
Merge branch 'master' into TimePath/issue-1170
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / accuracy.qc
index 3c737f6e6cec277f4e8d225f6ccefcc0004a271d..8a7f4c5b061d76d93d29984777bc9f4881df60f3 100644 (file)
@@ -1,11 +1,6 @@
-.float accuracy_hit[WEP_MAXCOUNT];
-.float accuracy_fired[WEP_MAXCOUNT];
-.float accuracy_cnt_hit[WEP_MAXCOUNT];
-.float accuracy_cnt_fired[WEP_MAXCOUNT];
-
 float accuracy_byte(float n, float d)
 {
-       //print(sprintf("accuracy: %d / %d\n", n, d));
+       //printf("accuracy: %d / %d\n", n, d);
        if(n <= 0)
                return 0;
        if(n > d)
@@ -25,7 +20,7 @@ float accuracy_send(entity to, float sf)
        a = a.accuracy;
 
        if(to != a.owner)
-               if not(self.owner.cvar_cl_accuracy_data_share && autocvar_sv_accuracy_data_share)
+               if (!(self.owner.cvar_cl_accuracy_data_share && autocvar_sv_accuracy_data_share))
                        sf = 0;
        // note: zero sendflags can never be sent... so we can use that to say that we send no accuracy!
        WriteInt24_t(MSG_ENTITY, sf);
@@ -109,17 +104,22 @@ void accuracy_add(entity e, float w, float fired, float hit)
 
 float accuracy_isgooddamage(entity attacker, entity targ)
 {
-       if(!inWarmupStage)
-       if(IS_CLIENT(targ))
+       frag_attacker = attacker;
+       frag_target = targ;
+       float mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid);
+
+       if(!warmup_stage)
        if(targ.deadflag == DEAD_NO)
-       if(IsDifferentTeam(attacker, targ))
+       if(!targ.frozen)
+       if(mutator_check == MUT_ACCADD_INVALID || (mutator_check == MUT_ACCADD_VALID && IS_CLIENT(targ)))
+       if(DIFF_TEAM(attacker, targ))
                return TRUE;
        return FALSE;
 }
 
 float accuracy_canbegooddamage(entity attacker)
 {
-       if(!inWarmupStage)
+       if(!warmup_stage)
                return TRUE;
        return FALSE;
 }