From: Lyberta Date: Thu, 5 Oct 2017 18:53:18 +0000 (+0300) Subject: Player templates: Better instagib support. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=278bb75f89d5bed1b93065ca12d111e996a0140d;p=xonotic%2Fxonotic-data.pk3dir.git Player templates: Better instagib support. --- diff --git a/player-template-example.cfg b/player-template-example.cfg index e9fe45cfd6..679725581c 100644 --- a/player-template-example.cfg +++ b/player-template-example.cfg @@ -27,6 +27,8 @@ set g_player_template_example_random_start_bullets "default" "How much bullets d set g_player_template_example_random_start_rockets "default" "How much rockets does the player get with random start rocket-based weapon." set g_player_template_example_random_start_cells "default" "How much cells does the player get with random start cell-based weapon." set g_player_template_example_random_start_plasma "default" "How much plasma does the player get with random start cell-based weapon." +set g_player_template_example_start_extra_lives "default" "How many extra lives does the player get during spawn in instagib." +set g_player_template_example_start_ammo_vaporizer_cells "default" "How many vaporizer cells does the player get during spawn in instagib." set g_player_template_example_drop_weapons "default" "Whether the player can drop weapons by throwing them or by dying." diff --git a/qcsrc/server/playertemplates.qc b/qcsrc/server/playertemplates.qc index 0b67eb611f..7528df13b8 100644 --- a/qcsrc/server/playertemplates.qc +++ b/qcsrc/server/playertemplates.qc @@ -80,6 +80,10 @@ string PlayerTemplate_GetDefaultCvarName(string variable) { return "g_random_start_plasma"; } + case "start_ammo_vaporizer_cells": + { + return "g_instagib_ammo_start"; + } case "drop_weapons": { return "g_weapon_throwable"; @@ -134,6 +138,7 @@ float PlayerTemplate_GetDefaultFloatValue(string variable) case "random_start_rockets": case "random_start_cells": case "random_start_plasma": + case "start_ammo_vaporizer_cells": case "drop_weapons": case "health_regen_factor": case "health_regen_linear": @@ -152,6 +157,10 @@ float PlayerTemplate_GetDefaultFloatValue(string variable) { return 1; } + case "start_extra_lives": + { + return 0; + } case "attack_scale": case "defense_scale": { @@ -310,6 +319,19 @@ void PlayerTemplateHook_PlayerSpawn(entity player, string template) { return; } + if (autocvar_g_instagib) + { + SetResourceAmount(player, RESOURCE_ARMOR, + PlayerTemplate_GetFloatValue(template, "start_extra_lives")); + SetResourceAmount(player, RESOURCE_CELLS, + PlayerTemplate_GetFloatValue(template, + "start_ammo_vaporizer_cells")); + if (PlayerTemplate_GetFloatValue(template, "unlimited_ammo")) + { + player.items |= IT_UNLIMITED_AMMO; + } + return; + } // Give health, armor and ammo. SetResourceAmount(player, RESOURCE_HEALTH, PlayerTemplate_GetFloatValue(template, "start_health")); @@ -334,10 +356,6 @@ void PlayerTemplateHook_PlayerSpawn(entity player, string template) SetResourceAmount(player, RESOURCE_FUEL, PlayerTemplate_GetFloatValue(template, "start_ammo_fuel")); } - if (autocvar_g_instagib == 1) - { - return; - } // Give weapons. if (PlayerTemplate_GetFloatValue(template, "default_start_weapons")) {