From a022216a47ca24cd1bac2ff836d4056154be7015 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 17 Dec 2011 17:37:30 +0100 Subject: [PATCH] simplify minsta rules again --- qcsrc/server/t_items.qc | 47 ++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 9241813f0..dfe1a5cb0 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -295,6 +295,8 @@ float Item_GiveTo(entity item, entity player) if (g_minstagib) { + float prevcells = player.ammo_cells; + if(item.spawnshieldtime) { if (item.ammo_fuel) @@ -305,30 +307,37 @@ float Item_GiveTo(entity item, entity player) player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + autocvar_g_balance_pause_fuel_rot); } - _switchweapon = TRUE; if (item.ammo_cells) + if (player.ammo_cells < g_pickup_cells_max) { pickedup = TRUE; - // play some cool sounds ;) - if (clienttype(player) == CLIENTTYPE_REAL) - { - if(player.health <= 5) - AnnounceTo(player, "lastsecond"); - else if(player.health < 50) - AnnounceTo(player, "narrowly"); - } - // sound not available - // else if(item.items == IT_CELLS) - // AnnounceTo(player, "ammo"); - - if (item.weapons & WEPBIT_MINSTANEX) - W_GiveWeapon (player, WEP_MINSTANEX, item.netname); - if (item.ammo_cells) - player.ammo_cells = bound(player.ammo_cells, 999, player.ammo_cells + autocvar_g_minstagib_ammo_drop); - player.health = 100; + player.ammo_cells = bound(player.ammo_cells, g_pickup_cells_max, player.ammo_cells + item.ammo_cells); } } + if(player.ammo_cells > prevcells) + { + _switchweapon = TRUE; + + // play some cool sounds ;) + if (clienttype(player) == CLIENTTYPE_REAL) + { + if(player.health <= 5) + AnnounceTo(player, "lastsecond"); + else if(player.health < 50) + AnnounceTo(player, "narrowly"); + } + // sound not available + // else if(item.items == IT_CELLS) + // AnnounceTo(player, "ammo"); + + if (item.weapons & WEPBIT_MINSTANEX) + W_GiveWeapon (player, WEP_MINSTANEX, item.netname); + if (item.ammo_cells) + player.ammo_cells = bound(player.ammo_cells, 999, player.ammo_cells + autocvar_g_minstagib_ammo_drop); + player.health = 100; + } + if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK)) { pickedup = TRUE; @@ -856,7 +865,7 @@ void minstagib_items (float itemid) // replace rocket launchers and nex guns with ammo cells if (itemid == IT_CELLS) { - self.ammo_cells = 1; + self.ammo_cells = autocvar_g_minstagib_ammo_drop; StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", 45, 0, "MinstaNex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100); -- 2.39.2