]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nades/nades.qc
Simplify the code networking the darkness effect
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qc
index a967124f1817fdfbd5ed47a80f844fb4bea37a28..a5cbab32bdf06af141309a244ab35763ea46dda4 100644 (file)
@@ -39,13 +39,10 @@ entity Nade_TrailEffect(int proj, int nade_team)
 }
 #endif
 
-REGISTER_NET_TEMP(TE_CSQC_DARKBLINKING);
 #ifdef CSQC
 #include <client/draw.qh>
 #include <client/hud/hud.qh>
 
-float dark_appeartime;
-float dark_fadetime;
 bool darkblink;
 
 void HUD_DarkBlinking()
@@ -59,25 +56,18 @@ MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
 {
        if (STAT(NADE_DARKNESS_TIME) > time)
        {
+               if (!darkblink)
+                       localcmd("play2 sound/misc/blind\n");
+               darkblink = true;
                M_ARGV(0, vector) = NADE_TYPE_DARKNESS.m_color;
                HUD_DarkBlinking();
                return true;
        }
+       else
+               darkblink = false;
        return false;
 }
 
-NET_HANDLE(TE_CSQC_DARKBLINKING, bool isNew)
-{
-       return = true;
-
-       if(darkblink) return;
-
-       localcmd("play2 sound/misc/blind\n");
-       darkblink = true;
-       dark_appeartime = time;
-       dark_fadetime = STAT(NADE_DARKNESS_TIME);
-}
-
 MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
 {
        entity proj = M_ARGV(0, entity);
@@ -798,19 +788,6 @@ void nade_ammo_boom(entity this)
        orb.colormod = '0.66 0.33 0';
 }
 
-void DarkBlinking(entity e)
-{
-       if(e == NULL) return;
-
-       int accepted = VerifyClientEntity(e, true, false);
-
-       if(accepted > 0)
-       {
-               msg_entity = e;
-               WriteHeader(MSG_ONE, TE_CSQC_DARKBLINKING);
-       }
-}
-
 void nade_darkness_think(entity this)
 {
        if(round_handler_IsActive())
@@ -872,7 +849,6 @@ void nade_darkness_think(entity this)
                        case 1:  if(it == this.realowner) continue; // don't affect the player who threw the nade
                }
                STAT(NADE_DARKNESS_TIME, it) = time + 0.1;
-               DarkBlinking(it);
        });
 }