]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Survival: More score to attackers.
authorLyberta <lyberta@lyberta.net>
Wed, 5 Apr 2017 23:23:20 +0000 (02:23 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 5 Apr 2017 23:23:20 +0000 (02:23 +0300)
qcsrc/server/mutators/mutator/gamemode_survival.qc
survival.cfg

index e5a5250c9121ebd6af38a5b48d075408090d34c5..fddb598fa0fd906947fb9d8b0e36818196bbe07e 100644 (file)
@@ -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;
 }
index 435c9f384a0c2c754f063a1ebb427211f1e0c54a..d2d7236986b876ded9ba39a249a39f9e9f7f9c3f 100644 (file)
@@ -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"