From 9c3e1026151c97ff534d76900e80e8b139539b4c Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 12 Jul 2023 17:02:24 +0200 Subject: [PATCH] Simplify the code networking the darkness effect --- qcsrc/common/mutators/mutator/nades/nades.qc | 34 +++----------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index a967124f18..a5cbab32bd 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -39,13 +39,10 @@ entity Nade_TrailEffect(int proj, int nade_team) } #endif -REGISTER_NET_TEMP(TE_CSQC_DARKBLINKING); #ifdef CSQC #include #include -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); }); } -- 2.39.2