]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/accuracy.qc
Merge branch 'master' into z411/srestart
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / accuracy.qc
index 2ec4fc710433bfbd3785dc698b9785af8ba8013f..2fe010f645c0c9a2c953df6c875cf50d0351c5c2 100644 (file)
@@ -1,14 +1,15 @@
 #include "accuracy.qh"
 
-#include <server/client.qh>
-#include <server/mutators/_mod.qh>
-#include <server/damage.qh>
 #include <common/constants.qh>
 #include <common/net_linked.qh>
-#include <server/player.qh>
 #include <common/teams.qh>
 #include <common/util.qh>
 #include <common/weapons/_all.qh>
+#include <server/client.qh>
+#include <server/damage.qh>
+#include <server/mutators/_mod.qh>
+#include <server/player.qh>
+#include <server/world.qh>
 
 int accuracy_byte(float n, float d)
 {
@@ -26,7 +27,7 @@ bool accuracy_send(entity this, entity to, int sf)
        a = CS(a).accuracy;
 
        if (to != a.owner)
-               if (!autocvar_sv_accuracy_data_share && !CS(a.owner).cvar_cl_accuracy_data_share)
+               if (!autocvar_sv_accuracy_data_share && !CS_CVAR(a.owner).cvar_cl_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);
@@ -64,7 +65,7 @@ void accuracy_resend(entity e)
 //.float hit_time;
 .float fired_time;
 
-void accuracy_add(entity this, Weapon w, int fired, int hit)
+void accuracy_add(entity this, Weapon w, float fired, float hit)
 {
        if (IS_INDEPENDENT_PLAYER(this)) return;
        entity a = CS(this).accuracy;
@@ -97,8 +98,7 @@ bool accuracy_isgooddamage(entity attacker, entity targ)
 {
        int mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid, attacker, targ);
 
-       if (warmup_stage) return false;
-       if (game_stopped) return false;
+       if (warmup_stage || game_stopped) return false;
 
        // damage to dead/frozen players is good only if it happens in the frame they get killed / frozen
        // so that stats for weapons that shoot multiple projectiles per shot are properly counted