From 39d0df32ced1be4459a34925d960bd594f8b18c0 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Fri, 18 Aug 2017 12:02:56 +0300 Subject: [PATCH] Player templates: Renamed num_random_start_weapons to random_start_weapons_count. --- player-template-example.cfg | 4 ++-- .../playertemplates/sv_playertemplates.qc | 21 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/player-template-example.cfg b/player-template-example.cfg index f418b32f32..7376364442 100644 --- a/player-template-example.cfg +++ b/player-template-example.cfg @@ -18,8 +18,8 @@ set g_player_template_example_default_start_weapons "default" "Whether to give p set g_player_template_example_start_weapons "default" "Which weapons does player get during spawn" // These weapons will be given randomly. The player will get the exact amount of // random weapons. The code will make sure that they are not duplicate. -set g_player_template_example_num_random_start_weapons 0 "Number of weapons that can be randomly given to player during spawn" -set g_player_template_example_random_start_weapons "" "Weapons that can be randomly given to player during spawn" +set g_player_template_example_random_start_weapons_count "default" "Number of weapons that can be randomly given to player during spawn" +set g_player_template_example_random_start_weapons "default" "Weapons that can be randomly given to player during spawn" set g_player_template_example_random_start_shells "default" "How much shells does the player get with random start shell-based weapon" set g_player_template_example_random_start_bullets "default" "How much bullets does the player get with random start bullet-based weapon" set g_player_template_example_random_start_rockets "default" "How much rockets does the player get with random start rocket-based weapon" diff --git a/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc b/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc index 1ad8dea6cb..027c1f26bb 100644 --- a/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc +++ b/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc @@ -47,6 +47,14 @@ string PlayerTemplate_GetDefaultCvarName(string variable) { return "g_start_ammo_fuel"; } + case "random_start_weapons_count": + { + return "g_random_start_weapons_count"; + } + case "random_start_weapons": + { + return "g_random_start_weapons"; + } case "random_start_shells": { return "g_random_start_shells"; @@ -111,6 +119,7 @@ float PlayerTemplate_GetDefaultFloatValue(string variable) case "start_ammo_cells": case "start_ammo_plasma": case "start_ammo_fuel": + case "random_start_weapons_count": case "random_start_shells": case "random_start_bullets": case "random_start_rockets": @@ -133,10 +142,6 @@ float PlayerTemplate_GetDefaultFloatValue(string variable) { return 1; } - case "num_random_start_weapons": - { - return 0; - } case "attack_scale": case "defense_scale": { @@ -158,8 +163,11 @@ string PlayerTemplate_GetDefaultStringValue(string variable) { switch (variable) { - case "start_weapons": case "random_start_weapons": + { + cvar_string(PlayerTemplate_GetDefaultCvarName(variable)); + } + case "start_weapons": { return ""; } @@ -330,7 +338,8 @@ void PlayerTemplate_PlayerSpawn(entity player, string template) if (!warmup_stage) { GivePlayerRandomWeapons(player, - PlayerTemplate_GetFloatValue(template, "num_random_start_weapons"), + PlayerTemplate_GetFloatValue(template, + "random_start_weapons_count"), PlayerTemplate_GetStringValue(template, "random_start_weapons"), PlayerTemplate_GetFloatValue(template, "random_start_shells"), PlayerTemplate_GetFloatValue(template, "random_start_bullets"), -- 2.39.5