]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Survival: Added frag rewards for defenders.
authorLyberta <lyberta@lyberta.net>
Wed, 12 Apr 2017 07:51:24 +0000 (10:51 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 12 Apr 2017 07:51:24 +0000 (10:51 +0300)
qcsrc/server/mutators/mutator/gamemode_survival.qc
survival.cfg

index b128f5afc0db97710bb027af250dc3303114b31f..84402bbb17df8563b0e8a02300c1c9120e8a6c5c 100644 (file)
@@ -157,8 +157,6 @@ 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.
@@ -169,6 +167,33 @@ float autocvar_g_surv_cannon_fodder_attack_scale;
 /// \brief How much cannon fodder gets damaged. Higher values mean less damage.
 float autocvar_g_surv_cannon_fodder_defense_scale;
 
+/// \brief How much score attackers get for fragging defenders.
+float autocvar_g_surv_attacker_frag_score;
+/// \brief How much health do defenders get when they frag an attacker.
+int autocvar_g_surv_defender_attacker_frag_health;
+/// \brief How much armor do defenders get when they frag an attacker.
+int autocvar_g_surv_defender_attacker_frag_armor;
+/// \brief How many shells do defenders get when they frag an attacker.
+int autocvar_g_surv_defender_attacker_frag_shells;
+/// \brief How many bullets do defenders get when they frag an attacker.
+int autocvar_g_surv_defender_attacker_frag_bullets;
+/// \brief How many rockets do defenders get when they frag an attacker.
+int autocvar_g_surv_defender_attacker_frag_rockets;
+/// \brief How many cells do defenders get when they frag an attacker.
+int autocvar_g_surv_defender_attacker_frag_cells;
+/// \brief How much health do defenders get when they frag cannon fodder.
+int autocvar_g_surv_defender_cannon_fodder_frag_health;
+/// \brief How much armor do defenders get when they frag cannon fodder.
+int autocvar_g_surv_defender_cannon_fodder_frag_armor;
+/// \brief How many shells do defenders get when they frag cannon fodder.
+int autocvar_g_surv_defender_cannon_fodder_frag_shells;
+/// \brief How many bullets do defenders get when they frag cannon fodder.
+int autocvar_g_surv_defender_cannon_fodder_frag_bullets;
+/// \brief How many rockets do defenders get when they frag cannon fodder.
+int autocvar_g_surv_defender_cannon_fodder_frag_rockets;
+/// \brief How many cells do defenders get when they frag cannon fodder.
+int autocvar_g_surv_defender_cannon_fodder_frag_cells;
+
 /// \brief Whether defenders drop weapons after death.
 int autocvar_g_surv_defender_drop_weapons;
 
@@ -2095,7 +2120,47 @@ MUTATOR_HOOKFUNCTION(surv, PlayerDamaged)
 MUTATOR_HOOKFUNCTION(surv, PlayerDies)
 {
        //DebugPrintToChatAll("PlayerDies");
+       entity attacker = M_ARGV(1, entity);
        entity victim = M_ARGV(2, entity);
+       if ((attacker.team == surv_defenderteam) &&
+               (victim.team == surv_attackerteam))
+       {
+               switch (victim.surv_role)
+               {
+                       case SURVIVAL_ROLE_PLAYER:
+                       {
+                               GivePlayerHealth(attacker,
+                                       autocvar_g_surv_defender_attacker_frag_health);
+                               GivePlayerArmor(attacker,
+                                       autocvar_g_surv_defender_attacker_frag_armor);
+                               GivePlayerShells(attacker,
+                                       autocvar_g_surv_defender_attacker_frag_shells);
+                               GivePlayerBullets(attacker,
+                                       autocvar_g_surv_defender_attacker_frag_bullets);
+                               GivePlayerRockets(attacker,
+                                       autocvar_g_surv_defender_attacker_frag_rockets);
+                               GivePlayerCells(attacker,
+                                       autocvar_g_surv_defender_attacker_frag_cells);
+                               break;
+                       }
+                       case SURVIVAL_ROLE_CANNON_FODDER:
+                       {
+                               GivePlayerHealth(attacker,
+                                       autocvar_g_surv_defender_cannon_fodder_frag_health);
+                               GivePlayerArmor(attacker,
+                                       autocvar_g_surv_defender_cannon_fodder_frag_armor);
+                               GivePlayerShells(attacker,
+                                       autocvar_g_surv_defender_cannon_fodder_frag_shells);
+                               GivePlayerBullets(attacker,
+                                       autocvar_g_surv_defender_cannon_fodder_frag_bullets);
+                               GivePlayerRockets(attacker,
+                                       autocvar_g_surv_defender_cannon_fodder_frag_rockets);
+                               GivePlayerCells(attacker,
+                                       autocvar_g_surv_defender_cannon_fodder_frag_cells);
+                               break;
+                       }
+               }
+       }
        if ((victim.team == surv_defenderteam) &&
                (autocvar_g_surv_defender_drop_weapons == false))
        {
index 3faededb7c08e15e4f07a8e16a611e56d7486ae0..6fd2fa41d39407905660bf18e1bec9a01fe73d4d 100644 (file)
@@ -70,10 +70,24 @@ set g_surv_defender_pickup_cells_big 40 "How many cells do defenders get when th
 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.025 "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 2 "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"
 set g_surv_cannon_fodder_defense_scale 1 "How much cannon fodder gets damaged. Higher values mean less damage"
 
+set g_surv_attacker_frag_score 10 "How much score attackers get for fragging defenders"
+set g_surv_defender_attacker_frag_health 0 "How much health do defenders get when they frag an attacker"
+set g_surv_defender_attacker_frag_armor 0 "How much armor do defenders get when they frag an attacker"
+set g_surv_defender_attacker_frag_shells 0 "How many shells do defenders get when they frag an attacker"
+set g_surv_defender_attacker_frag_bullets 0 "How many bullets do defenders get when they frag an attacker"
+set g_surv_defender_attacker_frag_rockets 0 "How many rockets do defenders get when they frag an attacker"
+set g_surv_defender_attacker_frag_cells 0 "How many cells do defenders get when they frag an attacker"
+set g_surv_defender_cannon_fodder_frag_health 0 "How much health do defenders get when they frag cannon fodder"
+set g_surv_defender_cannon_fodder_frag_armor 0 "How much armor do defenders get when they frag cannon fodder"
+set g_surv_defender_cannon_fodder_frag_shells 0 "How many shells do defenders get when they frag cannon fodder"
+set g_surv_defender_cannon_fodder_frag_bullets 0 "How many bullets do defenders get when they frag cannon fodder"
+set g_surv_defender_cannon_fodder_frag_rockets 0 "How many rockets do defenders get when they frag cannon fodder"
+set g_surv_defender_cannon_fodder_frag_cells 0 "How many cells do defenders get when they frag cannon fodder"
+
+
 set g_surv_defender_drop_weapons 0 "Whether defenders drop weapons after death"