From: Lyberta Date: Wed, 5 Apr 2017 23:23:20 +0000 (+0300) Subject: Survival: More score to attackers. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a9d85d436f8458a9185f8896e3f0dcd9aa2d76b4;p=xonotic%2Fxonotic-data.pk3dir.git Survival: More score to attackers. --- diff --git a/qcsrc/server/mutators/mutator/gamemode_survival.qc b/qcsrc/server/mutators/mutator/gamemode_survival.qc index e5a5250c9..fddb598fa 100644 --- a/qcsrc/server/mutators/mutator/gamemode_survival.qc +++ b/qcsrc/server/mutators/mutator/gamemode_survival.qc @@ -131,6 +131,10 @@ int autocvar_g_surv_defender_pickup_cells_big; /// \brief How many cells do defenders get when they pickup mega health/armor. int autocvar_g_surv_defender_pickup_cells_mega; +/// \brief How much score attackers gain per 1 point of damage. +float autocvar_g_surv_attacker_damage_score; +/// \brief How much score attackers get for killing defenders. +float autocvar_g_surv_attacker_frag_score; /// \brief How much defenders damage others. Higher values mean more damage. float autocvar_g_surv_defender_attack_scale; /// \brief How much defenders get damaged. High values mean less damage. @@ -1987,7 +1991,6 @@ MUTATOR_HOOKFUNCTION(surv, Damage_Calculate) MUTATOR_HOOKFUNCTION(surv, PlayerDamaged) { entity target = M_ARGV(1, entity); - //float health = M_ARGV(2, float); if (target.team != surv_defenderteam) { return; @@ -1996,10 +1999,21 @@ MUTATOR_HOOKFUNCTION(surv, PlayerDamaged) if (target.health < 1) { WaypointSprite_Kill(target.surv_attack_sprite); - return; } - WaypointSprite_UpdateHealth(target.surv_attack_sprite, target.health + - target.armorvalue); + else + { + WaypointSprite_UpdateHealth(target.surv_attack_sprite, target.health + + target.armorvalue); + } + entity attacker = M_ARGV(0, entity); + if ((attacker.team == surv_attackerteam) && (attacker.surv_role == + SURVIVAL_ROLE_PLAYER)) + { + float health = M_ARGV(2, float); + float armor = M_ARGV(3, float); + float score = (health + armor) * autocvar_g_surv_attacker_damage_score; + PlayerScore_Add(attacker, SP_SCORE, score); + } } /// \brief Hook which is called when the player dies. @@ -2043,11 +2057,18 @@ MUTATOR_HOOKFUNCTION(surv, GiveFragsForKill, CBC_ORDER_FIRST) { return true; } - entity player = M_ARGV(0, entity); - if ((player.team == surv_defenderteam) || (player.surv_role == + entity attacker = M_ARGV(0, entity); + if ((attacker.team == surv_defenderteam) || (attacker.surv_role == SURVIVAL_ROLE_CANNON_FODDER)) { M_ARGV(2, float) = 0; + return true; + } + entity target = M_ARGV(1, entity); + if ((attacker.surv_role == SURVIVAL_ROLE_PLAYER) && (target.team == + surv_defenderteam)) + { + M_ARGV(2, float) = autocvar_g_surv_attacker_frag_score; } return true; } diff --git a/survival.cfg b/survival.cfg index 435c9f384..d2d723698 100644 --- a/survival.cfg +++ b/survival.cfg @@ -57,6 +57,8 @@ set g_surv_defender_pickup_cells_medium 20 "How many cells do defenders get when set g_surv_defender_pickup_cells_big 40 "How many cells do defenders get when they pickup big health/armor" set g_surv_defender_pickup_cells_mega 50 "How many cells do defenders get when they pickup mega health/armor" +set g_surv_attacker_damage_score 0.05 "How much score attackers gain per 1 point of damage" +set g_surv_attacker_frag_score 10 "How much score attackers get for killing defenders" set g_surv_defender_attack_scale 1 "How much defenders damage others. Higher values mean more damage" set g_surv_defender_defense_scale 3 "How much defenders get damaged. Higher values mean less damage" set g_surv_cannon_fodder_attack_scale 1 "How much cannon fodder damages others. Higher values mean more damage"