From 1444ea757f10e16a27ed955812e86b0b9cb11a9a Mon Sep 17 00:00:00 2001 From: Lyberta Date: Sat, 23 Sep 2017 09:34:21 +0300 Subject: [PATCH] Player templates: Use ammo entity for random weapons. --- qcsrc/server/playertemplates.qc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/playertemplates.qc b/qcsrc/server/playertemplates.qc index cbeda1481a..a9fed4e086 100644 --- a/qcsrc/server/playertemplates.qc +++ b/qcsrc/server/playertemplates.qc @@ -365,14 +365,22 @@ void PlayerTemplateHook_PlayerSpawn(entity player, string template) } if (!warmup_stage) { + entity ammo_entity = spawn(); + SetResourceAmount(ammo_entity, RESOURCE_SHELLS, + PlayerTemplate_GetFloatValue(template, "random_start_shells")); + SetResourceAmount(ammo_entity, RESOURCE_BULLETS, + PlayerTemplate_GetFloatValue(template, "random_start_bullets")); + SetResourceAmount(ammo_entity, RESOURCE_ROCKETS, + PlayerTemplate_GetFloatValue(template, "random_start_rockets")); + SetResourceAmount(ammo_entity, RESOURCE_CELLS, + PlayerTemplate_GetFloatValue(template, "random_start_cells")); + SetResourceAmount(ammo_entity, RESOURCE_PLASMA, + PlayerTemplate_GetFloatValue(template, "random_start_plasma")); GiveRandomWeapons(player, 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"), - PlayerTemplate_GetFloatValue(template, "random_start_rockets"), - PlayerTemplate_GetFloatValue(template, "random_start_cells"), - PlayerTemplate_GetFloatValue(template, "random_start_plasma")); + ammo_entity); + remove(ammo_entity); return; } // Give random weapons. -- 2.39.5