]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Survival: Overkill models are now optional.
authorLyberta <lyberta@lyberta.net>
Fri, 24 Mar 2017 03:06:12 +0000 (06:06 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 24 Mar 2017 03:06:12 +0000 (06:06 +0300)
qcsrc/server/mutators/mutator/gamemode_survival.qc
survival.cfg

index 5a9822d95f28fdc12bc5237a0b5cd587ee1d8953..c323592b6f0621a4be7de0708d7006b586dd56c7 100644 (file)
@@ -66,6 +66,8 @@ int autocvar_g_surv_point_leadlimit; ///< Maximum lead of a single team.
 /// \brief How much players are allowed in teams (excluding cannon fodder).
 int autocvar_g_surv_team_size;
 
+/// \brief Whether to force overkill player models for defenders.
+int autocvar_g_surv_defender_force_overkill_models;
 /// \brief How much health do defenders get during spawn.
 int autocvar_g_surv_defender_start_health;
 /// \brief How much armor do defenders get during spawn.
@@ -891,6 +893,78 @@ void Surv_SwapTeams()
        });
 }
 
+/// \brief Changes the player model to the one configured for the gamemode.
+/// \param[in,out] player Player to change the model of.
+/// \return No return.
+void Surv_ForcePlayerModel(entity player)
+{
+       if (player.team != surv_defenderteam)
+       {
+               return;
+       }
+       if (!autocvar_g_surv_defender_force_overkill_models)
+       {
+               return;
+       }
+       switch (surv_defendercolor)
+       {
+               case SURVIVAL_COLOR_RED:
+               {
+                       switch (floor(random() * 4))
+                       {
+                               case 0:
+                               {
+                                       player.surv_playermodel = "models/ok_player/okrobot1.dpm";
+                                       break;
+                               }
+                               case 1:
+                               {
+                                       player.surv_playermodel = "models/ok_player/okrobot2.dpm";
+                                       break;
+                               }
+                               case 2:
+                               {
+                                       player.surv_playermodel = "models/ok_player/okrobot3.dpm";
+                                       break;
+                               }
+                               case 3:
+                               {
+                                       player.surv_playermodel = "models/ok_player/okrobot4.dpm";
+                                       break;
+                               }
+                       }
+                       break;
+               }
+               case SURVIVAL_COLOR_BLUE:
+               {
+                       switch (floor(random() * 4))
+                       {
+                               case 0:
+                               {
+                                       player.surv_playermodel = "models/ok_player/okmale1.dpm";
+                                       break;
+                               }
+                               case 1:
+                               {
+                                       player.surv_playermodel = "models/ok_player/okmale2.dpm";
+                                       break;
+                               }
+                               case 2:
+                               {
+                                       player.surv_playermodel = "models/ok_player/okmale3.dpm";
+                                       break;
+                               }
+                               case 3:
+                               {
+                                       player.surv_playermodel = "models/ok_player/okmale4.dpm";
+                                       break;
+                               }
+                       }
+                       break;
+               }
+       }
+}
+
 /// \brief Gives player shells.
 /// \param[in,out] player Player to give shells to.
 /// \param[in] amount Amount of shells to give.
@@ -1426,73 +1500,10 @@ MUTATOR_HOOKFUNCTION(surv, PlayerSpawn)
                {
                        if (player.surv_role != SURVIVAL_ROLE_DEFENDER)
                        {
-                               LOG_TRACE("Survival: PlayerSpawn: Invalid defender role.");
-                       }
-                       switch (surv_defendercolor)
-                       {
-                               case SURVIVAL_COLOR_RED:
-                               {
-                                       switch (floor(random() * 4))
-                                       {
-                                               case 0:
-                                               {
-                                                       player.surv_playermodel =
-                                                               "models/ok_player/okrobot1.dpm";
-                                                       break;
-                                               }
-                                               case 1:
-                                               {
-                                                       player.surv_playermodel =
-                                                               "models/ok_player/okrobot2.dpm";
-                                                       break;
-                                               }
-                                               case 2:
-                                               {
-                                                       player.surv_playermodel =
-                                                               "models/ok_player/okrobot3.dpm";
-                                                       break;
-                                               }
-                                               case 3:
-                                               {
-                                                       player.surv_playermodel =
-                                                               "models/ok_player/okrobot4.dpm";
-                                                       break;
-                                               }
-                                       }
-                                       break;
-                               }
-                               case SURVIVAL_COLOR_BLUE:
-                               {
-                                       switch (floor(random() * 4))
-                                       {
-                                               case 0:
-                                               {
-                                                       player.surv_playermodel =
-                                                               "models/ok_player/okmale1.dpm";
-                                                       break;
-                                               }
-                                               case 1:
-                                               {
-                                                       player.surv_playermodel =
-                                                               "models/ok_player/okmale2.dpm";
-                                                       break;
-                                               }
-                                               case 2:
-                                               {
-                                                       player.surv_playermodel =
-                                                               "models/ok_player/okmale3.dpm";
-                                                       break;
-                                               }
-                                               case 3:
-                                               {
-                                                       player.surv_playermodel =
-                                                               "models/ok_player/okmale4.dpm";
-                                                       break;
-                                               }
-                                       }
-                                       break;
-                               }
+                               LOG_TRACE("Survival: PlayerSpawn: ", player.netname,
+                                       " has invalid defender role.");
                        }
+                       Surv_ForcePlayerModel(player);
                        player.health = autocvar_g_surv_defender_start_health;
                        player.armorvalue = autocvar_g_surv_defender_start_armor;
                        player.ammo_shells = autocvar_g_surv_defender_start_ammo_shells;
index 6cdf5c5e6ab2fc1fe99b8978f1a4966e782e94d6..3498b41307ca27a23b6175fe6d3e602df3c342a9 100644 (file)
@@ -20,6 +20,7 @@ seta g_surv_point_limit -1 "Survival point limit overriding the mapinfo specifie
 seta g_surv_point_leadlimit -1 "Survival point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
 set g_surv_team_size 4 "How much players are allowed in teams (excluding cannon fodder)"
 
+set g_surv_defender_force_overkill_models 1 "Whether to force overkill player models for defenders"
 set g_surv_defender_start_health 100 "How much health do defenders get during spawn"
 set g_surv_defender_start_armor 100 "How much armor do defenders get during spawn"
 set g_surv_defender_start_ammo_shells 10 "How many shells do defenders get during spawn"