From: LegendaryGuard Date: Fri, 7 May 2021 23:33:07 +0000 (+0200) Subject: Merge branch 'master' into LegendaryGuard/armorizing_and_dark_nades X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f65172de07f5fb4ed14eca045b5aa6807e3cc27f;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into LegendaryGuard/armorizing_and_dark_nades --- f65172de07f5fb4ed14eca045b5aa6807e3cc27f diff --cc qcsrc/common/mutators/mutator/nades/nades.qc index 4cab4fe29,e71c61855..6f9e89128 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@@ -1835,57 -1339,64 +1841,73 @@@ MUTATOR_HOOKFUNCTION(nades, PlayerPreTh else player.alpha = player.nade_veil_prevalpha; } + //LegendGuard adds nade if STAT DARK_ORB 08-02-2021 + if(STAT(DARK_ORB, player) && STAT(DARK_ORB, player) <= time) + { + STAT(DARK_ORB, player) = 0; + if(player.vehicle) + player.vehicle.alpha = player.vehicle.nade_dark_prevalpha; + else + player.alpha = player.nade_dark_prevalpha; + } } - if (frametime && IS_PLAYER(player)) - { - int n = 0; + if (!(frametime && IS_PLAYER(player))) + return true; - IntrusiveList reviving_players = NULL; + entity revivers_last = NULL; + entity revivers_first = NULL; - if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout) - n = -1; - else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING) + bool player_is_reviving = false; + int n = 0; + vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; + FOREACH_CLIENT(IS_PLAYER(it) && IN_REVIVING_RANGE(player, it, revive_extra_size), { + // check if player is reviving anyone + if (STAT(FROZEN, it) == FROZEN_TEMP_DYING) { - vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; - n = 0; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), { - if (!reviving_players) - reviving_players = IL_NEW(); - IL_PUSH(reviving_players, it); - ++n; - }); + if ((STAT(FROZEN, player) == FROZEN_TEMP_DYING)) + continue; + if (!IN_REVIVING_RANGE(player, it, revive_extra_size)) + continue; + player_is_reviving = true; + break; } - if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us - { - STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1); - SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health)); + if (!(STAT(FROZEN, player) == FROZEN_TEMP_DYING)) + continue; // both player and it are NOT frozen + if (revivers_last) + revivers_last.chain = it; + revivers_last = it; + if (!revivers_first) + revivers_first = it; + ++n; + }); + if (revivers_last) + revivers_last.chain = NULL; - if(STAT(REVIVE_PROGRESS, player) >= 1) - { - Unfreeze(player, false); + if (!n) // no teammate nearby + { + // freezetag already resets revive progress + if (!g_freezetag && !STAT(FROZEN, player) && !player_is_reviving) + STAT(REVIVE_PROGRESS, player) = 0; // thawing nobody + } + else if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us + { + STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1); + // undo what PlayerPreThink did + STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * player.revive_speed, 1); + SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health)); - entity first = IL_FIRST(reviving_players); - Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname); - Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname); - } + if(STAT(REVIVE_PROGRESS, player) >= 1) + { + Unfreeze(player, false); - IL_EACH(reviving_players, true, { - STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player); - }); + Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, revivers_first.netname); + Send_Notification(NOTIF_ONE, revivers_first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname); } - if (reviving_players) - IL_DELETE(reviving_players); + + for(entity it = revivers_first; it; it = it.chain) + STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player); } } diff --cc qcsrc/common/stats.qh index 4b382a2d2,e5621c29e..554bd2576 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@@ -138,15 -138,9 +138,15 @@@ REGISTER_STAT(ITEMSTIME, int, autocvar_ REGISTER_STAT(KILL_TIME, float) REGISTER_STAT(VEIL_ORB, float) REGISTER_STAT(VEIL_ORB_ALPHA, float) +REGISTER_STAT(ARMORIZING_ORB, float) //LegendGuard registers new STAT 11-02-2021 +REGISTER_STAT(ARMORIZING_ORB_ALPHA, float) +REGISTER_STAT(AMMUNITIONING_ORB, float) //LegendGuard registers new STAT 11-02-2021 +REGISTER_STAT(AMMUNITIONING_ORB_ALPHA, float) +REGISTER_STAT(DARK_ORB, float) //LegendGuard registers new STAT 08-02-2021 +REGISTER_STAT(DARK_ORB_ALPHA, float) #ifdef SVQC - float autocvar_sv_showfps = 5; + float autocvar_sv_showfps = 0; #endif REGISTER_STAT(SHOWFPS, float, autocvar_sv_showfps)