]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Further improve onspawn nade refiring
authorterencehill <piuntn@gmail.com>
Tue, 8 Aug 2023 12:11:46 +0000 (14:11 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 8 Aug 2023 12:11:46 +0000 (14:11 +0200)
qcsrc/common/mutators/mutator/nades/nades.qc

index eb7d1fa9b0ed14862e7ce8b7baa5724cb56ca974..01f78c05b3f938d000ee1fd568391283388d815b 100644 (file)
@@ -1671,13 +1671,13 @@ MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
 {
        entity player = M_ARGV(0, entity);
 
-       if (autocvar_g_nades_onspawn)
-       {
-               if (StatusEffects_active(STATUSEFFECT_SpawnShield, player))
-                       player.nade_refire = time + autocvar_g_spawnshieldtime;
-       }
+       if (StatusEffects_active(STATUSEFFECT_SpawnShield, player))
+               player.nade_refire = StatusEffects_gettime(STATUSEFFECT_SpawnShield, player);
        else
-               player.nade_refire = time + autocvar_g_nades_nade_refire;
+               player.nade_refire = time;
+
+       if (!autocvar_g_nades_onspawn)
+               player.nade_refire += autocvar_g_nades_nade_refire;
 
        if(autocvar_g_nades_bonus_client_select)
                STAT(NADE_BONUS_TYPE, player) = CS_CVAR(player).cvar_cl_nade_type;