]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_items.qc
Added g_pickup_<item>_anyway to health/armor items (todo: add ammo), added defaultSam...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_items.qc
index 9d32f3234bf7ae2f429f4c4038f84e1666cc67df..ee56acc9ca696b95ede26343e20d08a80a98a955 100644 (file)
@@ -40,6 +40,7 @@ string Item_CounterFieldName(float it)
 }
 
 .float max_armorvalue;
+.float pickup_anyway;
 
 float Item_Customize()
 {
@@ -429,14 +430,14 @@ float Item_GiveTo(entity item, entity player)
                        }
 
                        if (item.health)
-                       if (player.health < item.max_health)
+                       if ((player.health < item.max_health) || item.pickup_anyway)
                        {
                                pickedup = TRUE;
                                player.health = min(player.health + item.health, item.max_health);
                                player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));
                        }
                        if (item.armorvalue)
-                       if (player.armorvalue < item.max_armorvalue)
+                       if ((player.armorvalue < item.max_armorvalue) || item.pickup_anyway)
                        {
                                pickedup = TRUE;
                                player.armorvalue = min(player.armorvalue + item.armorvalue, item.max_armorvalue);
@@ -682,6 +683,9 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
 {
        startitem_failed = FALSE;
 
+       self.items = itemid;
+       self.weapons = weaponid;
+
        // is it a dropped weapon?
        if (self.classname == "droppedweapon")
        {
@@ -702,9 +706,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        }
        else
        {
-               self.items = itemid;
-               self.weapons = weaponid;
-
                if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item
                {
                        startitem_failed = TRUE;
@@ -1195,6 +1196,8 @@ void spawnfunc_item_armor_small (void) {
                self.armorvalue = g_pickup_armorsmall;
        if(!self.max_armorvalue)
                self.max_armorvalue = g_pickup_armorsmall_max;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_armorsmall_anyway;
        StartItem ("models/items/g_a1.md3", "misc/armor1.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "5 Armor", IT_ARMOR_SHARD, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
 }
 
@@ -1203,6 +1206,8 @@ void spawnfunc_item_armor_medium (void) {
                self.armorvalue = g_pickup_armormedium;
        if(!self.max_armorvalue)
                self.max_armorvalue = g_pickup_armormedium_max;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_armormedium_anyway;
        StartItem ("models/items/g_armormedium.md3", "misc/armor10.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "25 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
 }
 
@@ -1211,6 +1216,8 @@ void spawnfunc_item_armor_big (void) {
                self.armorvalue = g_pickup_armorbig;
        if(!self.max_armorvalue)
                self.max_armorvalue = g_pickup_armorbig_max;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_armorbig_anyway;
        StartItem ("models/items/g_a50.md3", "misc/armor17_5.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "50 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, 20000);
 }
 
@@ -1219,6 +1226,8 @@ void spawnfunc_item_armor_large (void) {
                self.armorvalue = g_pickup_armorlarge;
        if(!self.max_armorvalue)
                self.max_armorvalue = g_pickup_armorlarge_max;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_armorlarge_anyway;
        StartItem ("models/items/g_a25.md3", "misc/armor25.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
 }
 
@@ -1227,6 +1236,8 @@ void spawnfunc_item_health_small (void) {
                self.max_health = g_pickup_healthsmall_max;
        if(!self.health)
                self.health = g_pickup_healthsmall;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_healthsmall_anyway;
        StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "5 Health", IT_5HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
 }
 
@@ -1235,6 +1246,8 @@ void spawnfunc_item_health_medium (void) {
                self.max_health = g_pickup_healthmedium_max;
        if(!self.health)
                self.health = g_pickup_healthmedium;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_healthmedium_anyway;
        StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "25 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
 }
 
@@ -1243,6 +1256,8 @@ void spawnfunc_item_health_large (void) {
                self.max_health = g_pickup_healthlarge_max;
        if(!self.health)
                self.health = g_pickup_healthlarge;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_healthlarge_anyway;
        StartItem ("models/items/g_h50.md3", "misc/mediumhealth.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "50 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
 }
 
@@ -1260,6 +1275,8 @@ void spawnfunc_item_health_mega (void) {
                        self.max_health = g_pickup_healthmega_max;
                if(!self.health)
                        self.health = g_pickup_healthmega;
+               if(!self.pickup_anyway)
+                       self.pickup_anyway = g_pickup_healthmega_anyway;
                StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Health", IT_HEALTH, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
        }
 }
@@ -1487,12 +1504,6 @@ void spawnfunc_item_jetpack(void)
        StartItem ("models/items/g_jetpack.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Jet pack", IT_JETPACK, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
 }
 
-// we no longer have the seeker
-void spawnfunc_weapon_seeker()
-{
-       spawnfunc_weapon_fireball();
-}
-
 
 #define OP_SET 0
 #define OP_MIN 1
@@ -1646,8 +1657,8 @@ float GiveItems(entity e, float beginarg, float endarg)
                                continue;
                        case "ALL":
                                got += GiveBit(e, items, IT_FUEL_REGEN, op, val);
-                               got += GiveValue(e, strength_finished, op, time + val);
-                               got += GiveValue(e, invincible_finished, op, time + val);
+                               got += GiveValue(e, strength_finished, op, time);
+                               got += GiveValue(e, invincible_finished, op, time);
                                got += GiveBit(e, items, IT_UNLIMITED_AMMO, op, val);
                        case "all":
                                got += GiveBit(e, items, IT_JETPACK, op, val);