]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/t_items.qc
hook now takes fuel
[divverent/nexuiz.git] / data / qcsrc / server / t_items.qc
1 floatfield Item_CounterField(float it)
2 {
3         switch(it)
4         {
5                 case IT_SHELLS:      return ammo_shells;
6                 case IT_NAILS:       return ammo_nails;
7                 case IT_ROCKETS:     return ammo_rockets;
8                 case IT_CELLS:       return ammo_cells;
9                 case IT_FUEL:        return ammo_fuel;
10                 case IT_5HP:         return health;
11                 case IT_25HP:        return health;
12                 case IT_HEALTH:      return health;
13                 case IT_ARMOR_SHARD: return armorvalue;
14                 case IT_ARMOR:       return armorvalue;
15                 // add more things here (health, armor)
16                 default:             error("requested item has no counter field");
17         }
18 }
19
20 string Item_CounterFieldName(float it)
21 {
22         switch(it)
23         {
24                 case IT_SHELLS:      return "shells";
25                 case IT_NAILS:       return "nails";
26                 case IT_ROCKETS:     return "rockets";
27                 case IT_CELLS:       return "cells";
28                 case IT_FUEL:        return "fuel";
29
30                 // add more things here (health, armor)
31                 default:             error("requested item has no counter field name");
32         }
33 }
34
35 .float max_armorvalue;
36
37 void Item_Respawn (void)
38 {
39         self.model = self.mdl;          // restore original model
40         self.solid = SOLID_TRIGGER;     // allow it to be touched again
41         sound (self, CHAN_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTN_NORM);        // play respawn sound
42         setorigin (self, self.origin);
43
44         //pointparticles(particleeffectnum("item_respawn"), self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
45         pointparticles(particleeffectnum("item_respawn"), self.origin + 0.5 * (self.mins + self.maxs), '0 0 0', 1);
46 }
47
48 float Item_GiveTo(entity item, entity player)
49 {
50         float _switchweapon;
51         float pickedup;
52         float it;
53         float i;
54         entity e;
55
56         // if nothing happens to player, just return without taking the item
57         pickedup = FALSE;
58         _switchweapon = FALSE;
59
60         if (g_minstagib)
61         {
62                 _switchweapon = TRUE;
63                 if (item.ammo_cells)
64                 {
65                         pickedup = TRUE;
66                         // play some cool sounds ;)
67                         centerprint(player, "\n");
68                         if(player.health <= 5)
69                                 announce(player, "announcer/robotic/lastsecond.wav");
70                         else if(player.health < 50)
71                                 announce(player, "announcer/robotic/narrowly.wav");
72                         // sound not available
73                         // else if(item.items == IT_CELLS)
74                         //      play2(player, "announce/robotic/ammo.wav");
75
76                         if (item.weapons & WEPBIT_MINSTANEX)
77                                 W_GiveWeapon (player, WEP_MINSTANEX, "Nex");
78                         if (item.ammo_cells)
79                                 player.ammo_cells = min (player.ammo_cells + cvar("g_minstagib_ammo_drop"), 999);
80                         player.health = 100;
81                 }
82
83                 // extralife powerup
84                 if (item.max_health)
85                 {
86                         pickedup = TRUE;
87                         // sound not available
88                         // play2(player, "announce/robotic/extra.ogg\nplay2 announce/robotic/_lives.wav");
89                         player.armorvalue = player.armorvalue + cvar("g_minstagib_extralives");
90                         sprint(player, "^3You picked up some extra lives\n");
91                 }
92
93                 // invis powerup
94                 if (item.strength_finished)
95                 {
96                         pickedup = TRUE;
97                         // sound not available
98                         // play2(player, "announce/robotic/invisible.wav");
99                         player.strength_finished = max(player.strength_finished, time) + cvar("g_balance_powerup_strength_time");
100                 }
101
102                 // speed powerup
103                 if (item.invincible_finished)
104                 {
105                         pickedup = TRUE;
106                         // sound not available
107                         // play2(player, "announce/robotic/speed.wav");
108                         player.invincible_finished = max(player.invincible_finished, time) + cvar("g_balance_powerup_strength_time");
109                 }
110         }
111         else
112         {
113                 if (g_weapon_stay == 1)
114                 if not(item.flags & FL_NO_WEAPON_STAY)
115                 if (item.flags & FL_WEAPON)
116                 {
117                         if(item.classname == "droppedweapon")
118                         {
119                                 if (player.weapons & item.weapons)      // don't let players stack ammo by tossing weapons
120                                         goto skip;
121                         }
122                         else
123                         {
124                                 if (player.weapons & item.weapons)
125                                         goto skip;
126                         }
127                 }
128
129                 // in case the player has autoswitch enabled do the following:
130                 // if the player is using their best weapon before items are given, they
131                 // probably want to switch to an even better weapon after items are given
132                 if (player.autoswitch)
133                 if (player.switchweapon == w_getbestweapon(player))
134                         _switchweapon = TRUE;
135
136                 if not(player.weapons & W_WeaponBit(player.switchweapon))
137                         _switchweapon = TRUE;
138
139                 if (item.ammo_shells)
140                 if (player.ammo_shells < g_pickup_shells_max)
141                 {
142                         pickedup = TRUE;
143                         player.ammo_shells = min (player.ammo_shells + item.ammo_shells, g_pickup_shells_max);
144                 }
145                 if (item.ammo_nails)
146                 if (player.ammo_nails < g_pickup_nails_max)
147                 {
148                         pickedup = TRUE;
149                         player.ammo_nails = min (player.ammo_nails + item.ammo_nails, g_pickup_nails_max);
150                 }
151                 if (item.ammo_rockets)
152                 if (player.ammo_rockets < g_pickup_rockets_max)
153                 {
154                         pickedup = TRUE;
155                         player.ammo_rockets = min (player.ammo_rockets + item.ammo_rockets, g_pickup_rockets_max);
156                 }
157                 if (item.ammo_cells)
158                 if (player.ammo_cells < g_pickup_cells_max)
159                 {
160                         pickedup = TRUE;
161                         player.ammo_cells = min (player.ammo_cells + item.ammo_cells, g_pickup_cells_max);
162                 }
163                 if (item.ammo_fuel)
164                 if (player.ammo_fuel < g_pickup_fuel_max)
165                 {
166                         pickedup = TRUE;
167                         player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
168                         player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
169                 }
170
171                 if (item.flags & FL_WEAPON)
172                 if ((it = item.weapons - (item.weapons & player.weapons)))
173                 {
174                         pickedup = TRUE;
175                         for(i = WEP_FIRST; i <= WEP_LAST; ++i)
176                         {
177                                 e = get_weaponinfo(i);
178                                 if(it & e.weapons)
179                                         W_GiveWeapon (player, e.weapon, item.netname);
180                         }
181                 }
182
183                 if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
184                 {
185                         pickedup = TRUE;
186                         player.items |= it;
187                 }
188
189                 if (item.strength_finished)
190                 {
191                         pickedup = TRUE;
192                         player.strength_finished = max(player.strength_finished, time) + cvar("g_balance_powerup_strength_time");
193                 }
194                 if (item.invincible_finished)
195                 {
196                         pickedup = TRUE;
197                         player.invincible_finished = max(player.invincible_finished, time) + cvar("g_balance_powerup_invincible_time");
198                 }
199                 //if (item.speed_finished)
200                 //{
201                 //      pickedup = TRUE;
202                 //      player.speed_finished = max(player.speed_finished, time) + cvar("g_balance_powerup_speed_time");
203                 //}
204                 //if (item.slowmo_finished)
205                 //{
206                 //      pickedup = TRUE;
207                 //      player.slowmo_finished = max(player.slowmo_finished, time) + (cvar("g_balance_powerup_slowmo_time") * cvar("g_balance_powerup_slowmo_speed"));
208                 //}
209
210                 if (item.health)
211                 if (player.health < item.max_health)
212                 {
213                         pickedup = TRUE;
214                         player.health = min(player.health + item.health, item.max_health);
215                         player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));
216                 }
217                 if (item.armorvalue)
218                 if (player.armorvalue < item.max_armorvalue)
219                 {
220                         pickedup = TRUE;
221                         player.armorvalue = min(player.armorvalue + item.armorvalue, item.max_armorvalue);
222                         player.pauserotarmor_finished = max(player.pauserotarmor_finished, time + cvar("g_balance_pause_armor_rot"));
223                 }
224         }
225
226 :skip
227         // always eat teamed entities
228         if(item.team)
229                 pickedup = TRUE;
230
231         if (!pickedup)
232                 return 0;
233
234         sound (player, CHAN_AUTO, item.item_pickupsound, VOL_BASE, ATTN_NORM);
235         if (_switchweapon)
236                 if (player.switchweapon != w_getbestweapon(player))
237                         W_SwitchWeapon_Force(player, w_getbestweapon(player));
238
239         return 1;
240 }
241
242 void Item_Touch (void)
243 {
244         entity e, head;
245
246         // remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
247         if (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
248         {
249                 remove(self);
250                 return;
251         }
252         if (other.classname != "player")
253                 return;
254         if (other.deadflag)
255                 return;
256         if (self.solid != SOLID_TRIGGER)
257                 return;
258         if (self.owner == other)
259                 return;
260
261         if(!Item_GiveTo(self, other))
262                 return;
263
264         if (self.classname == "droppedweapon")
265                 remove (self);
266         else if((self.flags & FL_WEAPON) && !(self.flags & FL_NO_WEAPON_STAY) && g_weapon_stay)
267                 return;
268         else
269         {
270                 self.solid = SOLID_NOT;
271                 self.model = string_null;
272                 if(self.team)
273                 {
274                         RandomSelection_Init();
275                         for(head = world; (head = findfloat(head, team, self.team)); ) if(head.flags & FL_ITEM)
276                                 RandomSelection_Add(head, 0, head.cnt, 0);
277                         e = RandomSelection_chosen_ent;
278                 }
279                 else
280                         e = self;
281                 e.nextthink = time + self.respawntime;
282                 e.think = Item_Respawn;
283         }
284 }
285
286 void Item_FindTeam()
287 {
288         entity head, e;
289
290         if(self.effects & EF_NODRAW)
291         {
292                 // marker for item team search
293                 dprint("Initializing item team ", ftos(self.team), "\n");
294                 RandomSelection_Init();
295                 for(head = world; (head = findfloat(head, team, self.team)); ) if(head.flags & FL_ITEM)
296                         RandomSelection_Add(head, 0, head.cnt, 0);
297                 e = RandomSelection_chosen_ent;
298                 e.state = 0;
299
300                 for(head = world; (head = findfloat(head, team, self.team)); ) if(head.flags & FL_ITEM)
301                 {
302                         if(head != e)
303                         {
304                                 // make it a non-spawned item
305                                 head.solid = SOLID_NOT;
306                                 head.model = string_null;
307                                 head.state = 1; // state 1 = initially hidden item
308                         }
309                         head.effects = head.effects - (head.effects & EF_NODRAW);
310                 }
311         }
312 }
313
314 void Item_Reset()
315 {
316         if(self.state == 1)
317         {
318                 self.model = string_null;
319                 self.solid = SOLID_NOT;
320         }
321         else
322         {
323                 self.model = self.mdl;
324                 self.solid = SOLID_TRIGGER;
325         }
326         setorigin (self, self.origin);
327         self.think = SUB_Null;
328         self.nextthink = 0;
329 }
330
331 // Savage: used for item garbage-collection
332 // TODO: perhaps nice special effect?
333 void RemoveItem(void)
334 {
335         remove(self);
336 }
337
338 // pickup evaluation functions
339 // these functions decide how desirable an item is to the bots
340
341 float generic_pickupevalfunc(entity player, entity item) {return item.bot_pickupbasevalue;};
342
343 float weapon_pickupevalfunc(entity player, entity item)
344 {
345         // if we already have the weapon, rate it 1/5th normal value
346         if ((player.weapons & item.weapons) == item.weapons)
347                 return item.bot_pickupbasevalue * 0.2;
348         return item.bot_pickupbasevalue;
349 };
350
351 float commodity_pickupevalfunc(entity player, entity item)
352 {
353         float c;
354         c = 0;
355         // TODO: figure out if the player even has the weapon this ammo is for?
356         // may not affect strategy much though...
357         // find out how much more ammo/armor/health the player can hold
358         if (item.ammo_shells)
359         if (player.ammo_shells < g_pickup_shells_max)
360                 c = c + max(0, 1 - player.ammo_shells / g_pickup_shells_max);
361         if (item.ammo_nails)
362         if (player.ammo_nails < g_pickup_nails_max)
363                 c = c + max(0, 1 - player.ammo_nails / g_pickup_nails_max);
364         if (item.ammo_rockets)
365         if (player.ammo_rockets < g_pickup_rockets_max)
366                 c = c + max(0, 1 - player.ammo_rockets / g_pickup_rockets_max);
367         if (item.ammo_cells)
368         if (player.ammo_cells < g_pickup_cells_max)
369                 c = c + max(0, 1 - player.ammo_cells / g_pickup_cells_max);
370         if (item.armorvalue)
371         if (player.armorvalue < item.max_armorvalue)
372                 c = c + max(0, 1 - player.armorvalue / item.max_armorvalue);
373         if (item.health)
374         if (player.health < item.max_health)
375                 c = c + max(0, 1 - player.health / item.max_health);
376
377         return item.bot_pickupbasevalue * c;
378 };
379
380
381 .float is_item;
382 void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue)
383 {
384         startitem_failed = FALSE;
385
386         // is it a dropped weapon?
387         if (self.classname == "droppedweapon")
388         {
389                 self.reset = SUB_Remove;
390                 // it's a dropped weapon
391                 self.movetype = MOVETYPE_TOSS;
392                 self.solid = SOLID_TRIGGER;
393                 // Savage: remove thrown items after a certain period of time ("garbage collection")
394                 self.think = RemoveItem;
395                 self.nextthink = time + 60;
396                 // don't drop if in a NODROP zone (such as lava)
397                 traceline(self.origin, self.origin, MOVE_NORMAL, self);
398                 if (trace_dpstartcontents & DPCONTENTS_NODROP)
399                 {
400                         startitem_failed = TRUE;
401                         remove(self);
402                         return;
403                 }
404         }
405         else
406         {
407                 self.reset = Item_Reset;
408                 // it's a level item
409                 if(self.spawnflags & 1)
410                         self.noalign = 1;
411                 if (self.noalign)
412                         self.movetype = MOVETYPE_NONE;
413                 else
414                         self.movetype = MOVETYPE_TOSS;
415                 self.solid = SOLID_TRIGGER;
416                 // do item filtering according to game mode and other things
417                 if (!self.noalign)
418                 {
419                         // first nudge it off the floor a little bit to avoid math errors
420                         setorigin(self, self.origin + '0 0 1');
421                         // set item size before we spawn a spawnfunc_waypoint
422                         if((itemflags & FL_POWERUP) || self.health || self.armorvalue)
423                                 setsize (self, '-16 -16 0', '16 16 48');
424                         else
425                                 setsize (self, '-16 -16 0', '16 16 32');
426                         // note droptofloor returns FALSE if stuck/or would fall too far
427                         droptofloor();
428                         waypoint_spawnforitem(self);
429                 }
430
431                 if(teams_matter)
432                 {
433                         if(self.notteam)
434                         {
435                                 print("removed non-teamplay ", self.classname, "\n");
436                                 startitem_failed = TRUE;
437                                 remove (self);
438                                 return;
439                         }
440                 }
441                 else
442                 {
443                         if(self.notfree)
444                         {
445                                 print("removed non-FFA ", self.classname, "\n");
446                                 startitem_failed = TRUE;
447                                 remove (self);
448                                 return;
449                         }
450                 }
451
452                 if(self.notq3a)
453                 {
454                         // We aren't TA or something like that, so we keep the Q3A entities
455                         print("removed non-Q3A ", self.classname, "\n");
456                         startitem_failed = TRUE;
457                         remove (self);
458                         return;
459                 }
460
461                 /*
462                  * can't do it that way, as it would break maps
463                  * TODO make a target_give like entity another way, that perhaps has
464                  * the weapon name in a key
465                 if(self.targetname)
466                 {
467                         // target_give not yet supported; maybe later
468                         print("removed targeted ", self.classname, "\n");
469                         startitem_failed = TRUE;
470                         remove (self);
471                         return;
472                 }
473                 */
474
475                 if(cvar("spawn_debug") >= 2)
476                 {
477                         entity otheritem;
478                         for(otheritem = findradius(self.origin, 3); otheritem; otheritem = otheritem.chain)
479                         {
480                                 if(otheritem.is_item)
481                                 {
482                                         dprint("XXX Found duplicated item: ", itemname, vtos(self.origin));
483                                         dprint(" vs ", otheritem.netname, vtos(otheritem.origin), "\n");
484                                         error("Mapper sucks.");
485                                 }
486                         }
487                         self.is_item = TRUE;
488                 }
489
490                 weaponsInMap |= weaponid;
491
492                 if(g_lms)
493                 {
494                         startitem_failed = TRUE;
495                         remove(self);
496                         return;
497                 }
498                 else if (g_weaponarena && ((weaponid & WEPBIT_ALL) || (itemid & IT_AMMO)))
499                 {
500                         startitem_failed = TRUE;
501                         remove(self);
502                         return;
503                 }
504                 else if (g_minstagib)
505                 {
506                         // don't remove dropped items and powerups
507                         if (self.classname != "minstagib")
508                         {
509                                 startitem_failed = TRUE;
510                                 remove (self);
511                                 return;
512                         }
513                 }
514                 else if ((!cvar("g_pickup_items") || g_nixnex) && itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH)
515                 {
516                         startitem_failed = TRUE;
517                         remove (self);
518                         return;
519                 }
520
521                 precache_model (itemmodel);
522                 precache_sound (pickupsound);
523                 precache_sound ("misc/itemrespawn.wav");
524
525                 if((itemid & (IT_STRENGTH | IT_INVINCIBLE | IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2)) || (weaponid & WEPBIT_ALL))
526                         self.target = "###item###"; // for finding the nearest item using find()
527         }
528
529         self.bot_pickup = TRUE;
530         self.bot_pickupevalfunc = pickupevalfunc;
531         self.bot_pickupbasevalue = pickupbasevalue;
532         self.mdl = itemmodel;
533         self.item_pickupsound = pickupsound;
534         // let mappers override respawntime
535         if (!self.respawntime)
536                 self.respawntime = defaultrespawntime;
537         self.netname = itemname;
538         self.items = itemid;
539         self.weapons = weaponid;
540         self.flags = FL_ITEM | itemflags;
541         self.touch = Item_Touch;
542         setmodel (self, self.mdl); // precision set below
543         self.effects |= EF_LOWPRECISION;
544         if((itemflags & FL_POWERUP) || self.health || self.armorvalue)
545                 setsize (self, '-16 -16 0', '16 16 48');
546         else
547                 setsize (self, '-16 -16 0', '16 16 32');
548         if(itemflags & FL_WEAPON)
549                 self.modelflags |= MF_ROTATE;
550
551         if (self.classname != "droppedweapon") // if dropped, colormap is already set up nicely
552         if (itemflags & FL_WEAPON)
553         {
554                 // neutral team color for pickup weapons
555                 self.colormap = 1024; // color shirt=0 pants=0 grey
556         }
557
558         if (cvar("g_fullbrightitems"))
559                 self.effects = self.effects | EF_FULLBRIGHT;
560
561         self.state = 0;
562         if(self.team)
563         {
564                 if(!self.cnt)
565                         self.cnt = 1; // item probability weight
566                 self.effects = self.effects | EF_NODRAW; // marker for item team search
567                 InitializeEntity(self, Item_FindTeam, INITPRIO_FINDTARGET);
568         }
569 }
570
571 /* replace items in minstagib
572  * IT_STRENGTH   = invisibility
573  * IT_NAILS      = extra lives
574  * IT_INVINCIBLE = speed
575  */
576 void minstagib_items (float itemid)
577 {
578         // we don't want to replace dropped weapons ;)
579         if (self.classname == "droppedweapon")
580         {
581                 self.ammo_cells = 25;
582                 StartItem ("models/weapons/g_nex.md3",
583                         "weapons/weaponpickup.wav", 15,
584                         "MinstaNex", 0, WEPBIT_MINSTANEX, FL_WEAPON, generic_pickupevalfunc, 1000);
585                 return;
586         }
587
588         local float rnd;
589         self.classname = "minstagib";
590
591         // replace rocket launchers and nex guns with ammo cells
592         if (itemid == IT_CELLS)
593         {
594                 self.ammo_cells = 1;
595                 StartItem ("models/items/a_cells.md3",
596                         "misc/itempickup.wav", 45,
597                         "Nex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
598                 return;
599         }
600
601         // randomize
602         rnd = random() * 3;
603         if (rnd <= 1)
604                 itemid = IT_STRENGTH;
605         else if (rnd <= 2)
606                 itemid = IT_NAILS;
607         else
608                 itemid = IT_INVINCIBLE;
609
610         // replace with invis
611         if (itemid == IT_STRENGTH)
612         {
613                 self.effects = EF_ADDITIVE;
614                 self.strength_finished = 30;
615                 StartItem ("models/items/g_strength.md3",
616                         "misc/powerup.wav", g_pickup_respawntime_powerup,
617                         "Invisibility", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
618         }
619         // replace with extra lives
620         if (itemid == IT_NAILS)
621         {
622                 self.max_health = 1;
623                 StartItem ("models/items/g_h100.md3",
624                         "misc/megahealth.wav", g_pickup_respawntime_powerup,
625                         "Extralife", IT_NAILS, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
626
627         }
628         // replace with speed
629         if (itemid == IT_INVINCIBLE)
630         {
631                 self.effects = EF_ADDITIVE;
632                 self.invincible_finished = 30;
633                 StartItem ("models/items/g_invincible.md3",
634                         "misc/powerup_shield.wav", g_pickup_respawntime_powerup,
635                         "Speed", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
636         }
637
638 }
639
640 float minst_no_auto_cells;
641 void minst_remove_item (void) {
642         if(minst_no_auto_cells)
643                 remove(self);
644 }
645
646 float weaponswapping;
647 float internalteam;
648
649 void weapon_defaultspawnfunc(float wpn)
650 {
651         entity e;
652         float t;
653         var .float ammofield;
654         string s;
655         entity oldself;
656         float i, j;
657
658         // set the respawntime in advance (so replaced weapons can copy it)
659         if(!self.respawntime)
660         {
661                 e = get_weaponinfo(wpn);
662                 if(e.items == IT_SUPERWEAPON)
663                         self.respawntime = g_pickup_respawntime_powerup;
664                 else
665                         self.respawntime = g_pickup_respawntime_weapon;
666         }
667
668         if(self.classname != "droppedweapon" && self.classname != "replacedweapon")
669         {
670                 e = get_weaponinfo(wpn);
671                 s = cvar_string(strcat("g_weaponreplace_", e.netname));
672                 if(s == "0")
673                 {
674                         remove(self);
675                         startitem_failed = TRUE;
676                         return;
677                 }
678                 t = tokenize_console(s);
679                 if(t >= 2)
680                 {
681                         self.team = --internalteam;
682                         oldself = self;
683                         for(i = 1; i < t; ++i)
684                         {
685                                 s = argv(i);
686                                 for(j = WEP_FIRST; j <= WEP_LAST; ++j)
687                                 {
688                                         e = get_weaponinfo(j);
689                                         if(e.netname == s)
690                                         {
691                                                 self = spawn();
692                                                 copyentity(oldself, self);
693                                                 self.classname = "replacedweapon";
694                                                 weapon_defaultspawnfunc(j);
695                                                 break;
696                                         }
697                                 }
698                                 if(j > WEP_LAST)
699                                 {
700                                         print("The weapon replace list for ", oldself.classname, " contains an unknown weapon ", s, ". Skipped.\n");
701                                 }
702                         }
703                         self = oldself;
704                 }
705                 if(t >= 1)
706                 {
707                         s = argv(0);
708                         wpn = 0;
709                         for(j = WEP_FIRST; j <= WEP_LAST; ++j)
710                         {
711                                 e = get_weaponinfo(j);
712                                 if(e.netname == s)
713                                 {
714                                         wpn = j;
715                                         break;
716                                 }
717                         }
718                         if(j > WEP_LAST)
719                         {
720                                 print("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n");
721                         }
722                 }
723                 if(wpn == 0)
724                 {
725                         remove(self);
726                         startitem_failed = TRUE;
727                         return;
728                 }
729         }
730
731         e = get_weaponinfo(wpn);
732
733         if(e.items && e.items != IT_SUPERWEAPON)
734         {
735                 for(i = 0, j = 1; i < 24; ++i, j *= 2)
736                 {
737                         if(e.items & j)
738                         {
739                                 ammofield = Item_CounterField(j);
740                                 if(!self.ammofield)
741                                         self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j)));
742                         }
743                 }
744         }
745         else
746         {
747                 self.flags |= FL_NO_WEAPON_STAY;
748         }
749
750         // weapon stay isn't supported for teamed weapons
751         if(self.team)
752                 self.flags |= FL_NO_WEAPON_STAY;
753
754         if(g_weapon_stay == 2 && self.classname != "droppedweapon")
755         {
756                 self.ammo_shells = 0;
757                 self.ammo_nails = 0;
758                 self.ammo_cells = 0;
759                 self.ammo_rockets = 0;
760                 // weapon stay 2: don't use ammo on weapon pickups; instead
761                 // initialize all ammo types to the pickup ammo unless set by g_start_ammo_*
762         }
763
764         StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, e.message, 0, e.weapons, FL_WEAPON, weapon_pickupevalfunc, e.bot_pickupbasevalue);
765         if (self.modelindex) // don't precache if self was removed
766                 weapon_action(e.weapon, WR_PRECACHE);
767 }
768
769 void spawnfunc_weapon_shotgun (void);
770 void spawnfunc_weapon_uzi (void) {
771         if(q3acompat_machineshotgunswap)
772         if(self.classname != "droppedweapon")
773         {
774                 weapon_defaultspawnfunc(WEP_SHOTGUN);
775                 return;
776         }
777         weapon_defaultspawnfunc(WEP_UZI);
778 }
779
780 void spawnfunc_weapon_shotgun (void) {
781         if(q3acompat_machineshotgunswap)
782         if(self.classname != "droppedweapon")
783         {
784                 weapon_defaultspawnfunc(WEP_UZI);
785                 return;
786         }
787         weapon_defaultspawnfunc(WEP_SHOTGUN);
788 }
789
790 void spawnfunc_weapon_nex (void)
791 {
792         if (g_minstagib)
793         {
794                 minstagib_items(IT_CELLS);
795                 self.think = minst_remove_item;
796                 self.nextthink = time;
797                 return;
798         }
799         weapon_defaultspawnfunc(WEP_NEX);
800 }
801
802 void spawnfunc_weapon_minstanex (void)
803 {
804         if (g_minstagib)
805         {
806                 minstagib_items(IT_CELLS);
807                 self.think = minst_remove_item;
808                 self.nextthink = time;
809                 return;
810         }
811         weapon_defaultspawnfunc(WEP_MINSTANEX);
812 }
813
814 void spawnfunc_weapon_rocketlauncher (void)
815 {
816         if (g_minstagib)
817         {
818                 minstagib_items(IT_CELLS);
819                 self.think = minst_remove_item;
820                 self.nextthink = time;
821                 return;
822         }
823         weapon_defaultspawnfunc(WEP_ROCKET_LAUNCHER);
824 }
825
826 void spawnfunc_item_rockets (void) {
827         if(!self.ammo_rockets)
828                 self.ammo_rockets = g_pickup_rockets;
829         StartItem ("models/items/a_rockets.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, "rockets", IT_ROCKETS, 0, 0, commodity_pickupevalfunc, 3000);
830 }
831
832 void spawnfunc_item_shells (void);
833 void spawnfunc_item_bullets (void) {
834         if(!weaponswapping)
835         if(q3acompat_machineshotgunswap)
836         if(self.classname != "droppedweapon")
837         {
838                 weaponswapping = TRUE;
839                 spawnfunc_item_shells();
840                 weaponswapping = FALSE;
841                 return;
842         }
843
844         if(!self.ammo_nails)
845                 self.ammo_nails = g_pickup_nails;
846         StartItem ("models/items/a_bullets.mdl", "misc/itempickup.wav", g_pickup_respawntime_ammo, "bullets", IT_NAILS, 0, 0, commodity_pickupevalfunc, 2000);
847 }
848
849 void spawnfunc_item_cells (void) {
850         if(!self.ammo_cells)
851                 self.ammo_cells = g_pickup_cells;
852         StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, "cells", IT_CELLS, 0, 0, commodity_pickupevalfunc, 2000);
853 }
854
855 void spawnfunc_item_shells (void) {
856         if(!weaponswapping)
857         if(q3acompat_machineshotgunswap)
858         if(self.classname != "droppedweapon")
859         {
860                 weaponswapping = TRUE;
861                 spawnfunc_item_bullets();
862                 weaponswapping = FALSE;
863                 return;
864         }
865
866         if(!self.ammo_shells)
867                 self.ammo_shells = g_pickup_shells;
868         StartItem ("models/items/a_shells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, "shells", IT_SHELLS, 0, 0, commodity_pickupevalfunc, 500);
869 }
870
871 void spawnfunc_item_armor_small (void) {
872         if(!self.armorvalue)
873                 self.armorvalue = g_pickup_armorsmall;
874         if(!self.max_armorvalue)
875                 self.max_armorvalue = g_pickup_armorsmall_max;
876         StartItem ("models/items/g_a1.md3", "misc/armor1.wav", g_pickup_respawntime_short, "5 Armor", IT_ARMOR_SHARD, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
877 }
878
879 void spawnfunc_item_armor_medium (void) {
880         if(!self.armorvalue)
881                 self.armorvalue = g_pickup_armormedium;
882         if(!self.max_armorvalue)
883                 self.max_armorvalue = g_pickup_armormedium_max;
884         StartItem ("models/items/g_armormedium.md3", "misc/armor10.wav", g_pickup_respawntime_medium, "25 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
885 }
886
887 void spawnfunc_item_armor_big (void) {
888         if(!self.armorvalue)
889                 self.armorvalue = g_pickup_armorbig;
890         if(!self.max_armorvalue)
891                 self.max_armorvalue = g_pickup_armorbig_max;
892         StartItem ("models/items/g_a50.md3", "misc/armor17_5.wav", g_pickup_respawntime_long, "50 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, 20000);
893 }
894
895 void spawnfunc_item_armor_large (void) {
896         if(!self.armorvalue)
897                 self.armorvalue = g_pickup_armorlarge;
898         if(!self.max_armorvalue)
899                 self.max_armorvalue = g_pickup_armorlarge_max;
900         StartItem ("models/items/g_a25.md3", "misc/armor25.wav", g_pickup_respawntime_long, "100 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
901 }
902
903 void spawnfunc_item_health_small (void) {
904         if(!self.max_health)
905                 self.max_health = g_pickup_healthsmall_max;
906         if(!self.health)
907                 self.health = g_pickup_healthsmall;
908         StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", g_pickup_respawntime_short, "5 Health", IT_5HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
909 }
910
911 void spawnfunc_item_health_medium (void) {
912         if(!self.max_health)
913                 self.max_health = g_pickup_healthmedium_max;
914         if(!self.health)
915                 self.health = g_pickup_healthmedium;
916         StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", g_pickup_respawntime_short, "25 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
917 }
918
919 void spawnfunc_item_health_large (void) {
920         if(!self.max_health)
921                 self.max_health = g_pickup_healthlarge_max;
922         if(!self.health)
923                 self.health = g_pickup_healthlarge;
924         StartItem ("models/items/g_h50.md3", "misc/mediumhealth.wav", g_pickup_respawntime_medium, "50 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
925 }
926
927 void spawnfunc_item_health_mega (void) {
928         if(!cvar("g_powerup_superhealth"))
929                 return;
930
931         if(g_arena && !cvar("g_arena_powerups"))
932                 return;
933
934         if(g_minstagib) {
935                 minstagib_items(IT_NAILS);
936         } else {
937                 if(!self.max_health)
938                         self.max_health = g_pickup_healthmega_max;
939                 if(!self.health)
940                         self.health = g_pickup_healthmega;
941                 StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", g_pickup_respawntime_long, "100 Health", IT_HEALTH, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
942         }
943 }
944
945 // support old misnamed entities
946 void spawnfunc_item_armor1() { spawnfunc_item_armor_small(); }  // FIXME: in Quake this is green armor, in Nexuiz maps it is an armor shard
947 void spawnfunc_item_armor25() { spawnfunc_item_armor_large(); }
948 void spawnfunc_item_health1() { spawnfunc_item_health_small(); }
949 void spawnfunc_item_health25() { spawnfunc_item_health_medium(); }
950 void spawnfunc_item_health100() { spawnfunc_item_health_mega(); }
951
952 void spawnfunc_item_strength (void) {
953         if(!cvar("g_powerup_strength"))
954                 return;
955
956         if(g_arena && !cvar("g_arena_powerups"))
957                 return;
958
959         if(g_minstagib) {
960                 minstagib_items(IT_STRENGTH);
961         } else {
962                 precache_sound("weapons/strength_fire.wav");
963                 self.strength_finished = 30;
964                 self.effects = EF_ADDITIVE;
965                 StartItem ("models/items/g_strength.md3", "misc/powerup.wav", g_pickup_respawntime_powerup, "Strength Powerup", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
966         }
967 }
968
969 void spawnfunc_item_invincible (void) {
970         if(!cvar("g_powerup_shield"))
971                 return;
972
973         if(g_arena && !cvar("g_arena_powerups"))
974                 return;
975
976         if(g_minstagib) {
977                 minstagib_items(IT_INVINCIBLE);
978         } else {
979                 self.invincible_finished = 30;
980                 self.effects = EF_ADDITIVE;
981                 StartItem ("models/items/g_invincible.md3", "misc/powerup_shield.wav", g_pickup_respawntime_powerup, "Invulnerability", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
982         }
983 }
984
985 void spawnfunc_item_minst_cells (void) {
986         if (g_minstagib)
987         {
988                 minst_no_auto_cells = 1;
989                 minstagib_items(IT_CELLS);
990         }
991         else
992                 remove(self);
993 }
994
995 // compatibility:
996 void spawnfunc_item_quad (void) {self.classname = "item_strength";spawnfunc_item_strength();}
997
998 float target_item_func_set(float a, float b)
999 {
1000         if(b == 0)
1001                 return a;
1002         else if(b < 0)
1003                 return 0;
1004         else
1005                 return b;
1006 }
1007
1008 float target_item_func_min(float a, float b)
1009 {
1010         if(b == 0)
1011                 return a;
1012         else if(b < 0)
1013                 return 0;
1014         else
1015                 return min(a, b);
1016 }
1017
1018 float target_item_func_max(float a, float b)
1019 {
1020         return max(a, b);
1021 }
1022
1023 float target_item_func_bitset(float a, float b)
1024 {
1025         return b;
1026 }
1027
1028 float target_item_func_and(float a, float b)
1029 {
1030         return a & b;
1031 }
1032
1033 float target_item_func_itembitset(float a, float b)
1034 {
1035         return (a - (a & (IT_PICKUPMASK | IT_STRENGTH | IT_INVINCIBLE))) | b;
1036 }
1037
1038 float target_item_func_itemand(float a, float b)
1039 {
1040         return (a - (a & (IT_PICKUPMASK | IT_STRENGTH | IT_INVINCIBLE))) | (a & b);
1041 }
1042
1043 float target_item_func_or(float a, float b)
1044 {
1045         return a | b;
1046 }
1047
1048 float target_item_func_andnot(float a, float b)
1049 {
1050         return a - (a & b);
1051 }
1052
1053 float target_item_changed;
1054 void target_item_change(float binary, .float field, float(float a, float b) func, string sound_increase, string sound_decrease)
1055 {
1056         float n, d;
1057         n = func(activator.field, self.field);
1058
1059         if(binary)
1060         {
1061                 d = n & activator.field;
1062                 if(d != n) // bits added?
1063                         d = +1;
1064                 else if(d != activator.field) // bits removed?
1065                         d = -1;
1066                 else
1067                         d = 0;
1068         }
1069         else
1070                 d = n - activator.field;
1071
1072         if(d < 0)
1073         {
1074                 if(sound_decrease != "")
1075                         sound (activator, CHAN_AUTO, sound_decrease, VOL_BASE, ATTN_NORM);
1076                 target_item_changed = 1;
1077         }
1078         else if(d > 0)
1079         {
1080                 if(sound_increase != "")
1081                         sound (activator, CHAN_AUTO, sound_increase, VOL_BASE, ATTN_NORM);
1082                 target_item_changed = 1;
1083         }
1084         activator.field = n;
1085 }
1086
1087 void target_items_use (void)
1088 {
1089         float h0, a0;
1090
1091         if(activator.classname == "droppedweapon")
1092         {
1093                 EXACTTRIGGER_TOUCH;
1094                 remove(activator);
1095                 return;
1096         }
1097
1098         if(activator.classname != "player")
1099                 return;
1100         if(activator.deadflag != DEAD_NO)
1101                 return;
1102         EXACTTRIGGER_TOUCH;
1103
1104         entity e;
1105         for(e = world; (e = find(e, classname, "droppedweapon")); )
1106                 if(e.enemy == activator)
1107                         remove(e);
1108
1109         float _switchweapon;
1110         _switchweapon = FALSE;
1111         if (activator.autoswitch)
1112                 if (activator.switchweapon == w_getbestweapon(activator))
1113                         _switchweapon = TRUE;
1114
1115         a0 = activator.armorvalue;
1116         h0 = activator.health;
1117         target_item_changed = 0;
1118
1119         if(self.spawnflags == 0) // SET
1120         {
1121                 target_item_change(0, ammo_shells, target_item_func_set, "misc/itempickup.wav", "");
1122                 target_item_change(0, ammo_nails, target_item_func_set, "misc/itempickup.wav", "");
1123                 target_item_change(0, ammo_rockets, target_item_func_set, "misc/itempickup.wav", "");
1124                 target_item_change(0, ammo_cells, target_item_func_set, "misc/itempickup.wav", "");
1125                 target_item_change(0, ammo_fuel, target_item_func_set, "misc/itempickup.wav", "");
1126                 target_item_change(0, health, target_item_func_set, "misc/megahealth.wav", "");
1127                 target_item_change(0, armorvalue, target_item_func_set, "misc/armor25.wav", "");
1128                 target_item_change(1, items, target_item_func_itembitset, "misc/powerup.wav", "misc/poweroff.wav");
1129                 target_item_change(1, weapons, target_item_func_bitset, "weapons/weaponpickup.wav", "");
1130
1131                 if((self.items & activator.items) & IT_STRENGTH)
1132                         activator.strength_finished = time + self.strength_finished;
1133                 if((self.items & activator.items) & IT_INVINCIBLE)
1134                         activator.invincible_finished = time + self.invincible_finished;
1135         }
1136         else if(self.spawnflags == 1) // AND/MIN
1137         {
1138                 target_item_change(0, ammo_shells, target_item_func_min, "misc/itempickup.wav", "");
1139                 target_item_change(0, ammo_nails, target_item_func_min, "misc/itempickup.wav", "");
1140                 target_item_change(0, ammo_rockets, target_item_func_min, "misc/itempickup.wav", "");
1141                 target_item_change(0, ammo_cells, target_item_func_min, "misc/itempickup.wav", "");
1142                 target_item_change(0, ammo_fuel, target_item_func_min, "misc/itempickup.wav", "");
1143                 target_item_change(0, health, target_item_func_min, "misc/megahealth.wav", "");
1144                 target_item_change(0, armorvalue, target_item_func_min, "misc/armor25.wav", "");
1145                 target_item_change(1, items, target_item_func_itemand, "misc/powerup.wav", "misc/poweroff.wav");
1146                 target_item_change(1, weapons, target_item_func_and, "weapons/weaponpickup.wav", "");
1147
1148                 if((self.items & activator.items) & IT_STRENGTH)
1149                         activator.strength_finished = min(activator.strength_finished, time + self.strength_finished);
1150                 if((self.items & activator.items) & IT_INVINCIBLE)
1151                         activator.invincible_finished = min(activator.invincible_finished, time + self.invincible_finished);
1152         }
1153         else if(self.spawnflags == 2) // OR/MAX
1154         {
1155                 target_item_change(0, ammo_shells, target_item_func_max, "misc/itempickup.wav", "");
1156                 target_item_change(0, ammo_nails, target_item_func_max, "misc/itempickup.wav", "");
1157                 target_item_change(0, ammo_rockets, target_item_func_max, "misc/itempickup.wav", "");
1158                 target_item_change(0, ammo_cells, target_item_func_max, "misc/itempickup.wav", "");
1159                 target_item_change(0, ammo_fuel, target_item_func_max, "misc/itempickup.wav", "");
1160                 target_item_change(0, health, target_item_func_max, "misc/megahealth.wav", "");
1161                 target_item_change(0, armorvalue, target_item_func_max, "misc/armor25.wav", "");
1162                 target_item_change(1, items, target_item_func_or, "misc/powerup.wav", "misc/poweroff.wav");
1163                 target_item_change(1, weapons, target_item_func_or, "weapons/weaponpickup.wav", "");
1164
1165                 if((self.items & activator.items) & IT_STRENGTH)
1166                         activator.strength_finished = max(activator.strength_finished, time + self.strength_finished);
1167                 if((self.items & activator.items) & IT_INVINCIBLE)
1168                         activator.invincible_finished = max(activator.invincible_finished, time + self.invincible_finished);
1169         }
1170         else if(self.spawnflags == 4) // ANDNOT/MIN
1171         {
1172                 target_item_change(0, ammo_shells, target_item_func_min, "misc/itempickup.wav", "");
1173                 target_item_change(0, ammo_nails, target_item_func_min, "misc/itempickup.wav", "");
1174                 target_item_change(0, ammo_rockets, target_item_func_min, "misc/itempickup.wav", "");
1175                 target_item_change(0, ammo_cells, target_item_func_min, "misc/itempickup.wav", "");
1176                 target_item_change(0, ammo_fuel, target_item_func_min, "misc/itempickup.wav", "");
1177                 target_item_change(0, health, target_item_func_min, "misc/megahealth.wav", "");
1178                 target_item_change(0, armorvalue, target_item_func_min, "misc/armor25.wav", "");
1179                 target_item_change(1, items, target_item_func_andnot, "misc/powerup.wav", "misc/poweroff.wav");
1180                 target_item_change(1, weapons, target_item_func_andnot, "weapons/weaponpickup.wav", "");
1181
1182                 if((self.items & activator.items) & IT_STRENGTH)
1183                         activator.strength_finished = min(activator.strength_finished, time + self.strength_finished);
1184                 if((self.items & activator.items) & IT_INVINCIBLE)
1185                         activator.invincible_finished = min(activator.invincible_finished, time + self.invincible_finished);
1186         }
1187
1188         if not(activator.items & IT_STRENGTH)
1189                 activator.strength_finished = 0;
1190         if not(activator.items & IT_INVINCIBLE)
1191                 activator.invincible_finished = 0;
1192
1193         if(activator.health > h0)
1194                 activator.pauserothealth_finished = max(activator.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));
1195         else if(activator.health < h0)
1196                 activator.pauseregen_finished = max(activator.pauseregen_finished, time + cvar("g_balance_pause_health_regen"));
1197
1198         if(activator.armorvalue > a0)
1199                 activator.pauserotarmor_finished = max(activator.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));
1200
1201         if not(activator.weapons & W_WeaponBit(activator.switchweapon))
1202                 _switchweapon = TRUE;
1203         if(_switchweapon)
1204                 W_SwitchWeapon_Force(activator, w_getbestweapon(activator));
1205
1206         if(target_item_changed)
1207                 centerprint(activator, self.message);
1208 }
1209
1210 void spawnfunc_target_items (void)
1211 {
1212         float n, i, j;
1213         entity e;
1214         self.use = target_items_use;
1215         if(!self.strength_finished)
1216                 self.strength_finished = cvar("g_balance_powerup_strength_time");
1217         if(!self.invincible_finished)
1218                 self.invincible_finished = cvar("g_balance_powerup_invincible_time");
1219
1220         precache_sound("misc/itempickup.wav");
1221         precache_sound("misc/itempickup.wav");
1222         precache_sound("misc/itempickup.wav");
1223         precache_sound("misc/itempickup.wav");
1224         precache_sound("misc/megahealth.wav");
1225         precache_sound("misc/armor25.wav");
1226         precache_sound("misc/powerup.wav");
1227         precache_sound("misc/poweroff.wav");
1228         precache_sound("weapons/weaponpickup.wav");
1229
1230         n = tokenize_console(self.netname);
1231         for(i = 0; i < n; ++i)
1232         {
1233                 if(argv(i) == "unlimited_ammo")         self.items |= IT_UNLIMITED_AMMO;
1234                 if(argv(i) == "unlimited_weapon_ammo")  self.items |= IT_UNLIMITED_WEAPON_AMMO;
1235                 if(argv(i) == "unlimited_superweapons") self.items |= IT_UNLIMITED_SUPERWEAPONS;
1236                 if(argv(i) == "strength")               self.items |= IT_STRENGTH;
1237                 if(argv(i) == "invincible")             self.items |= IT_INVINCIBLE;
1238                 if(argv(i) == "jetpack")                self.items |= IT_JETPACK;
1239                 if(argv(i) == "fuel_regen")             self.items |= IT_FUEL_REGEN;
1240                 for(j = WEP_FIRST; j <= WEP_LAST; ++j)
1241                 {
1242                         e = get_weaponinfo(j);
1243                         if(argv(i) == e.netname)
1244                         {
1245                                 self.weapons |= e.weapons;
1246                                 if(self.spawnflags == 0 || self.spawnflags == 2)
1247                                         weapon_action(e.weapon, WR_PRECACHE);
1248                         }
1249                 }
1250         }
1251 }
1252
1253 void spawnfunc_item_fuel(void)
1254 {
1255         if(!self.ammo_fuel)
1256                 self.ammo_fuel = g_pickup_fuel;
1257         StartItem ("models/items/g_fuel.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, "Fuel", IT_FUEL, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
1258 }
1259
1260 void spawnfunc_item_fuel_regen(void)
1261 {
1262         StartItem ("models/items/g_fuelregen.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, "Fuel regenerator", IT_FUEL_REGEN, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
1263 }
1264
1265 void spawnfunc_item_jetpack(void)
1266 {
1267         if(g_grappling_hook)
1268                 return; // sorry, but these two can't coexist (same button)
1269         if(!self.ammo_fuel)
1270                 self.ammo_fuel = g_pickup_fuel_jetpack;
1271         StartItem ("models/items/g_jetpack.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, "Jet pack", IT_JETPACK, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
1272 }