Limit health/armor in minstagib:
authorterencehill <piuntn@gmail.com>
Sat, 10 Jul 2010 13:07:10 +0000 (15:07 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 10 Jul 2010 13:07:10 +0000 (15:07 +0200)
- limit health and armor that can be given by the command give.
- do not allow to get more then 999 extralives (it could happen after u cheated with give command).

OT: add a clarifier comment.

qcsrc/server/t_items.qc

index 63e6a2b5284168a86ac26f236830262d6584fa6a..35e30f1849fe25239aa5831dbcf6de316aa5ac59 100644 (file)
@@ -303,7 +303,7 @@ float Item_GiveTo(entity item, entity player)
                                pickedup = TRUE;
                                // sound not available
                                // AnnounceTo(player, "_lives");
                                pickedup = TRUE;
                                // sound not available
                                // AnnounceTo(player, "_lives");
-                               player.armorvalue = player.armorvalue + cvar("g_minstagib_extralives");
+                               player.armorvalue = min(player.armorvalue + cvar("g_minstagib_extralives"), 999);
                                sprint(player, "^3You picked up some extra lives\n");
                        }
 
                                sprint(player, "^3You picked up some extra lives\n");
                        }
 
@@ -1134,7 +1134,7 @@ void spawnfunc_weapon_rocketlauncher (void)
 {
        if (g_minstagib)
        {
 {
        if (g_minstagib)
        {
-               minstagib_items(IT_CELLS);
+               minstagib_items(IT_CELLS); // replace rocketlauncher with cells
                self.think = minst_remove_item;
                self.nextthink = time;
                return;
                self.think = minst_remove_item;
                self.nextthink = time;
                return;
@@ -1767,6 +1767,12 @@ float GiveItems(entity e, float beginarg, float endarg)
        POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, cvar("g_balance_pause_armor_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), "misc/armor25.wav", string_null);
        POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, cvar("g_balance_pause_health_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), "misc/megahealth.wav", string_null);
 
        POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, cvar("g_balance_pause_armor_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), "misc/armor25.wav", string_null);
        POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, cvar("g_balance_pause_health_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), "misc/megahealth.wav", string_null);
 
+       if (g_minstagib)
+       {
+               e.health = bound(0, e.health, 100);
+               e.armorvalue = bound(0, e.armorvalue, 999);
+       }
+
        if(e.strength_finished <= 0)
                e.strength_finished = 0;
        else
        if(e.strength_finished <= 0)
                e.strength_finished = 0;
        else