From fdcde7a8ed885f9e3de3074a4cd089e4a21cb395 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Mon, 28 Aug 2017 23:43:26 +0300 Subject: [PATCH] Player templates: Use SetResourceAmount. --- qcsrc/server/playertemplates.qc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/qcsrc/server/playertemplates.qc b/qcsrc/server/playertemplates.qc index 65dbf39ced..84fe38a9e0 100644 --- a/qcsrc/server/playertemplates.qc +++ b/qcsrc/server/playertemplates.qc @@ -306,22 +306,28 @@ void PlayerTemplateHook_PlayerSpawn(entity player, string template) return; } // Give health, armor and ammo. - player.health = PlayerTemplate_GetFloatValue(template, "start_health"); - player.armorvalue = PlayerTemplate_GetFloatValue(template, "start_armor"); + SetResourceAmount(player, RESOURCE_HEALTH, + PlayerTemplate_GetFloatValue(template, "start_health")); + SetResourceAmount(player, RESOURCE_ARMOR, + PlayerTemplate_GetFloatValue(template, "start_armor")); if (PlayerTemplate_GetFloatValue(template, "unlimited_ammo")) { player.items |= IT_UNLIMITED_AMMO; } else { - player.ammo_shells = PlayerTemplate_GetFloatValue(template, - "start_ammo_shells"); - player.ammo_nails = PlayerTemplate_GetFloatValue(template, - "start_ammo_bullets"); - player.ammo_rockets = PlayerTemplate_GetFloatValue(template, - "start_ammo_rockets"); - player.ammo_cells = PlayerTemplate_GetFloatValue(template, - "start_ammo_cells"); + SetResourceAmount(player, RESOURCE_SHELLS, + PlayerTemplate_GetFloatValue(template, "start_ammo_shells")); + SetResourceAmount(player, RESOURCE_BULLETS, + PlayerTemplate_GetFloatValue(template, "start_ammo_bullets")); + SetResourceAmount(player, RESOURCE_ROCKETS, + PlayerTemplate_GetFloatValue(template, "start_ammo_rockets")); + SetResourceAmount(player, RESOURCE_CELLS, + PlayerTemplate_GetFloatValue(template, "start_ammo_cells")); + SetResourceAmount(player, RESOURCE_PLASMA, + PlayerTemplate_GetFloatValue(template, "start_ammo_plasma")); + SetResourceAmount(player, RESOURCE_FUEL, + PlayerTemplate_GetFloatValue(template, "start_ammo_fuel")); } if (autocvar_g_instagib == 1) { -- 2.39.5