home *** CD-ROM | disk | FTP | other *** search
/ Phenomenon / Phenomenon.iso / quake / teamfort / sources / tf1_21sc / source / items.qc < prev    next >
Encoding:
Text File  |  1996-09-17  |  29.9 KB  |  1,432 lines

  1. void() W_SetCurrentAmmo;
  2. /* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
  3. BE .8 .3 .4 IN COLOR */
  4.  
  5. // TeamFortress Prototypes
  6. float(entity Retriever, float AmmoType) TeamFortress_GetMaxAmmo;
  7. float(entity Retriever, float WeaponType) TeamFortress_CanGetWeapon;
  8. float(entity Retriever, entity Armor) TeamFortress_CanGetArmor;
  9. float(entity Retriever, entity Items) TeamFortress_AddBackpackItems;
  10.  
  11. // TeamFortress Goal Prototypes
  12. void() tfgoal_touch;
  13.  
  14.  
  15. void() SUB_regen =
  16. {
  17.     self.model = self.mdl;        // restore original model
  18.     self.solid = SOLID_TRIGGER;    // allow it to be touched again
  19.     sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);    // play respawn sound
  20.     setorigin (self, self.origin);
  21. };
  22.  
  23.  
  24.  
  25. /*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
  26. prints a warning message when spawned
  27. */
  28. void() noclass =
  29. {
  30.     dprint ("noclass spawned at");
  31.     dprint (vtos(self.origin));
  32.     dprint ("\n");
  33.     remove (self);
  34. };
  35.  
  36.  
  37.  
  38. /*
  39. ============
  40. PlaceItem
  41.  
  42. plants the object on the floor
  43. ============
  44. */
  45. void() PlaceItem =
  46. {
  47.     local float    oldz;
  48.  
  49.     self.mdl = self.model;        // so it can be restored on respawn
  50.     self.flags = FL_ITEM;        // make extra wide
  51.     self.solid = SOLID_TRIGGER;
  52.     self.movetype = MOVETYPE_TOSS;    
  53.     self.velocity = '0 0 0';
  54.     self.origin_z = self.origin_z + 6;
  55.     oldz = self.origin_z;
  56.     if (!droptofloor())
  57.     {
  58.         dprint ("Bonus item fell out of level at ");
  59.         dprint (vtos(self.origin));
  60.         dprint ("\n");
  61.         remove(self);
  62.         return;
  63.     }
  64. };
  65.  
  66. /*
  67. ============
  68. StartItem
  69.  
  70. Sets the clipping size and plants the object on the floor
  71. ============
  72. */
  73. void() StartItem =
  74. {
  75.     self.nextthink = time + 0.2;    // items start after other solids
  76.     self.think = PlaceItem;
  77. };
  78.  
  79. /*
  80. =========================================================================
  81.  
  82. HEALTH BOX
  83.  
  84. =========================================================================
  85. */
  86. //
  87. // T_Heal: add health to an entity, limiting health to max_health
  88. // "ignore" will ignore max_health limit
  89. //
  90. float (entity e, float healamount, float ignore) T_Heal =
  91. {
  92.     if (e.health <= 0)
  93.         return 0;
  94.     if ((!ignore) && (e.health >= e.max_health))
  95.         return 0;
  96.     healamount = ceil(healamount);
  97.  
  98.     e.health = e.health + healamount;
  99.     if ((!ignore) && (e.health >= e.max_health))
  100.         e.health = e.max_health;
  101.         
  102.     if (e.health > 250)
  103.         e.health = 250;
  104.     return 1;
  105. };
  106.  
  107. /*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth
  108. Health box. Normally gives 25 points.
  109. Rotten box heals 5-10 points,
  110. megahealth will add 100 health, then 
  111. rot you down to your maximum health limit, 
  112. one point per second.
  113. */
  114.  
  115. float    H_ROTTEN = 1;
  116. float    H_MEGA = 2;
  117. .float    healamount, healtype;
  118. void() health_touch;
  119. void() item_megahealth_rot;
  120.  
  121. void() item_health =
  122. {    
  123.     self.touch = health_touch;
  124.  
  125.     if (self.spawnflags & H_ROTTEN)
  126.     {
  127.         precache_model("maps/b_bh10.bsp");
  128.  
  129.         precache_sound("items/r_item1.wav");
  130.         setmodel(self, "maps/b_bh10.bsp");
  131.         self.noise = "items/r_item1.wav";
  132.         self.healamount = 15;
  133.         self.healtype = 0;
  134.     }
  135.     else
  136.     if (self.spawnflags & H_MEGA)
  137.     {
  138.         precache_model("maps/b_bh100.bsp");
  139.         precache_sound("items/r_item2.wav");
  140.         setmodel(self, "maps/b_bh100.bsp");
  141.         self.noise = "items/r_item2.wav";
  142.         self.healamount = 100;
  143.         self.healtype = 2;
  144.     }
  145.     else
  146.     {
  147.         precache_model("maps/b_bh25.bsp");
  148.         precache_sound("items/health1.wav");
  149.         setmodel(self, "maps/b_bh25.bsp");
  150.         self.noise = "items/health1.wav";
  151.         self.healamount = 25;
  152.         self.healtype = 1;
  153.     }
  154.     setsize (self, '0 0 0', '32 32 56');
  155.     StartItem ();
  156. };
  157.  
  158.  
  159. void() health_touch =
  160. {
  161.     local    float amount, medi;
  162.     local    string    s;
  163.     
  164.     if (other.classname != "player")
  165.         return;
  166.  
  167.     medi = 0;
  168.     
  169.     if (self.healtype == 2) // Megahealth?  Ignore max_health...
  170.     {
  171.         // only heal the player if they are not infected
  172.         if (!(other.tfstate & TFSTATE_INFECTED))
  173.         {
  174.             if (other.health >= 250)
  175.                 return;
  176.             if (!T_Heal(other, self.healamount, 1))
  177.                 return;
  178.         }
  179.     }
  180.     else
  181.     {
  182.         if (!T_Heal(other, self.healamount, 0))
  183.         {
  184.             if (other.secondary_items & NIT_MEDIKIT)
  185.             {
  186.                 if (other.ammo_medikit < other.maxammo_medikit)
  187.                 {
  188.                     other.ammo_medikit = other.ammo_medikit + self.healamount;
  189.                     if (other.ammo_medikit > other.maxammo_medikit)
  190.                         other.ammo_medikit = other.maxammo_medikit;
  191.  
  192.                     sprint(other, "You gather ");
  193.                     s = ftos(self.healamount);
  194.                     sprint(other, s);
  195.                     sprint(other, " medikit ammo\n");
  196.                     
  197.                     // health touch sound
  198.                     sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  199.  
  200.                     stuffcmd (other, "bf\n");
  201.                     
  202.                     self.model = string_null;
  203.                     self.solid = SOLID_NOT;
  204.  
  205.                     if (deathmatch != 2)        // deathmatch 2 is the silly old rules
  206.                     {
  207.                         if (deathmatch)
  208.                             self.nextthink = time + 20;
  209.                         self.think = SUB_regen;
  210.                     }
  211.  
  212.                     activator = other;
  213.                     SUB_UseTargets();                // fire all targets / killtargets
  214.                 }
  215.             }
  216.             return;
  217.         }
  218.     }
  219.  
  220.     if ((other.tfstate & TFSTATE_INFECTED) && (self.healamount > 80))
  221.     {
  222.         sprint(other, "You have been healed of your infection!");
  223.                 other.tfstate = other.tfstate - (other.tfstate & TFSTATE_INFECTED);
  224.     }
  225.     else
  226.     {
  227.         sprint(other, "You receive ");
  228.         s = ftos(self.healamount);
  229.         sprint(other, s);
  230.         sprint(other, " health\n");
  231.     }
  232.     
  233. // health touch sound
  234.     sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  235.  
  236.     stuffcmd (other, "bf\n");
  237.     
  238.     self.model = string_null;
  239.     self.solid = SOLID_NOT;
  240.  
  241.     // Megahealth = rot down the player's super health
  242.     if (self.healtype == 2)
  243.     {
  244.         other.items = other.items | IT_SUPERHEALTH;
  245.         self.nextthink = time + 5;
  246.         self.think = item_megahealth_rot;
  247.         self.owner = other;
  248.     }
  249.     else
  250.     {
  251.         if (deathmatch != 2)        // deathmatch 2 is the silly old rules
  252.         {
  253.             if (deathmatch)
  254.                 self.nextthink = time + 20;
  255.             self.think = SUB_regen;
  256.         }
  257.     }
  258.     
  259.     activator = other;
  260.     SUB_UseTargets();                // fire all targets / killtargets
  261. };    
  262.  
  263. void() item_megahealth_rot =
  264. {
  265.     other = self.owner;
  266.     
  267.     if (other.health > other.max_health)
  268.     {
  269.         other.health = other.health - 1;
  270.         self.nextthink = time + 1;
  271.         return;
  272.     }
  273.  
  274. // it is possible for a player to die and respawn between rots, so don't
  275. // just blindly subtract the flag off
  276.     other.items = other.items - (other.items & IT_SUPERHEALTH);
  277.     
  278.     if (deathmatch == 1)    // deathmatch 2 is silly old rules
  279.     {
  280.         self.nextthink = time + 20;
  281.         self.think = SUB_regen;
  282.     }
  283. };
  284.  
  285. /*
  286. ===============================================================================
  287.  
  288. ARMOR
  289.  
  290. ===============================================================================
  291. */
  292.  
  293. void() armor_touch;
  294.  
  295. void() armor_touch =
  296. {
  297.     local    float    type, value, bit;
  298.     
  299.     if (other.health <= 0)
  300.         return;
  301.     if (other.classname != "player")
  302.         return;
  303.  
  304.     if (self.classname == "item_armor1")
  305.     {
  306.         type = 0.3;
  307.         value = 100;
  308.         bit = IT_ARMOR1;
  309.     }
  310.     if (self.classname == "item_armor2")
  311.     {
  312.         type = 0.6;
  313.         value = 150;
  314.         bit = IT_ARMOR2;
  315.     }
  316.     if (self.classname == "item_armorInv")
  317.     {
  318.         type = 0.8;
  319.         value = 200;
  320.         bit = IT_ARMOR3;
  321.     }
  322.     if (other.armortype*other.armorvalue >= type*value)
  323.         return;
  324.  
  325.     // Check to make sure this player class can wear this armor
  326.     if (!TeamFortress_CanGetArmor(other, self))
  327.         return;
  328.         
  329.     other.armortype = type;
  330.     other.armorvalue = value;
  331.  
  332.     // Make sure armorvalue doesn't exceed this player class's maximum
  333.     value = other.maxarmor;
  334.     if (other.armorvalue > value)
  335.         other.armorvalue = value;
  336.  
  337.     // TBD Fix this : other.armorclass = self.spawnflags - (self.spawnflags & AT_NORMAL);
  338.  
  339.     other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
  340.  
  341.     self.solid = SOLID_NOT;
  342.     self.model = string_null;
  343.     if (deathmatch == 1)
  344.         self.nextthink = time + 20;
  345.     self.think = SUB_regen;
  346.  
  347.     sprint(other, "You got armor\n");
  348. // armor touch sound
  349.     sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
  350.     stuffcmd (other, "bf\n");
  351.     
  352.     activator = other;
  353.     SUB_UseTargets();                // fire all targets / killtargets
  354. };
  355.  
  356.  
  357. /*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
  358. */
  359.  
  360. void() item_armor1 =
  361. {
  362.     self.touch = armor_touch;
  363.     precache_model ("progs/armor.mdl");
  364.     setmodel (self, "progs/armor.mdl");
  365.     self.skin = 0;
  366.     setsize (self, '-16 -16 0', '16 16 56');
  367.     StartItem ();
  368. };
  369.  
  370. /*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
  371. */
  372.  
  373. void() item_armor2 =
  374. {
  375.     self.touch = armor_touch;
  376.     precache_model ("progs/armor.mdl");
  377.     setmodel (self, "progs/armor.mdl");
  378.     self.skin = 1;
  379.     setsize (self, '-16 -16 0', '16 16 56');
  380.     StartItem ();
  381. };
  382.  
  383. /*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
  384. */
  385.  
  386. void() item_armorInv =
  387. {
  388.     self.touch = armor_touch;
  389.     precache_model ("progs/armor.mdl");
  390.     setmodel (self, "progs/armor.mdl");
  391.     self.skin = 2;
  392.     setsize (self, '-16 -16 0', '16 16 56');
  393.     StartItem ();
  394. };
  395.  
  396. /*
  397. ===============================================================================
  398.  
  399. WEAPONS
  400.  
  401. ===============================================================================
  402. */
  403.  
  404. void() bound_other_ammo =
  405. {
  406.     if (other.ammo_shells > TeamFortress_GetMaxAmmo(other,IT_SHELLS))
  407.         other.ammo_shells = TeamFortress_GetMaxAmmo(other,IT_SHELLS);
  408.     if (other.ammo_nails > TeamFortress_GetMaxAmmo(other,IT_NAILS))
  409.         other.ammo_nails = TeamFortress_GetMaxAmmo(other,IT_NAILS);
  410.     if (other.ammo_rockets > TeamFortress_GetMaxAmmo(other,IT_ROCKETS))
  411.         other.ammo_rockets = TeamFortress_GetMaxAmmo(other,IT_ROCKETS);        
  412.     if (other.ammo_cells > TeamFortress_GetMaxAmmo(other,IT_CELLS))
  413.         other.ammo_cells = TeamFortress_GetMaxAmmo(other,IT_CELLS);        
  414. };
  415.  
  416.  
  417. float(float w) RankForWeapon =
  418. {
  419.     if (w == IT_LIGHTNING)
  420.         return 1;
  421.     if (w == IT_ROCKET_LAUNCHER)
  422.         return 2;
  423.     if (w == IT_SUPER_NAILGUN)
  424.         return 3;
  425.     if (w == IT_GRENADE_LAUNCHER)
  426.         return 4;
  427.     if (w == IT_SUPER_SHOTGUN)
  428.         return 5;
  429.     if (w == IT_NAILGUN)
  430.         return 6;
  431.     return 7;
  432. };
  433.  
  434. /*
  435. =============
  436. Deathmatch_Weapon
  437.  
  438. Deathmatch weapon change rules for picking up a weapon
  439.  
  440. .float        ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
  441. =============
  442. */
  443. void(float old, float new) Deathmatch_Weapon =
  444. {
  445.     local float or, nr;
  446.  
  447. // change self.weapon if desired
  448.     or = RankForWeapon (self.weapon);
  449.     nr = RankForWeapon (new);
  450.     if ( nr < or )
  451.         self.weapon = new;
  452. };
  453.  
  454. /*
  455. =============
  456. weapon_touch
  457. =============
  458. */
  459. float() W_BestWeapon;
  460.  
  461. void() weapon_touch =
  462. {
  463.     local    float    hadammo, best, new, old;
  464.     local    entity    stemp;
  465.     local    float    leave;
  466.  
  467.     if (!(other.flags & FL_CLIENT))
  468.         return;
  469.  
  470. // if the player was using his best weapon, change up to the new one if better        
  471.     stemp = self;
  472.     self = other;
  473.     best = W_BestWeapon();
  474.     self = stemp;
  475.  
  476.     if (deathmatch == 2 || coop)
  477.         leave = 1;
  478.     else
  479.         leave = 0;
  480.     
  481.     if (self.classname == "weapon_nailgun")
  482.     {
  483.         if (leave && (other.items & IT_NAILGUN) )
  484.             return;
  485.         if (!TeamFortress_CanGetWeapon(other,IT_NAILGUN))
  486.             return;
  487.         hadammo = other.ammo_nails;            
  488.         new = IT_NAILGUN;
  489.         other.ammo_nails = other.ammo_nails + 30;
  490.     }
  491.     else if (self.classname == "weapon_supernailgun")
  492.     {
  493.         if (leave && (other.items & IT_SUPER_NAILGUN) )
  494.             return;
  495.         if (!TeamFortress_CanGetWeapon(other,IT_SUPER_NAILGUN))
  496.             return;
  497.         hadammo = other.ammo_rockets;            
  498.         new = IT_SUPER_NAILGUN;
  499.         other.ammo_nails = other.ammo_nails + 30;
  500.     }
  501.     else if (self.classname == "weapon_supershotgun")
  502.     {
  503.         if (leave && (other.items & IT_SUPER_SHOTGUN) )
  504.             return;
  505.         if (!TeamFortress_CanGetWeapon(other,IT_SUPER_SHOTGUN))
  506.             return;
  507.         hadammo = other.ammo_rockets;
  508.         new = IT_SUPER_SHOTGUN;
  509.         other.ammo_shells = other.ammo_shells + 5;
  510.     }
  511.     else if (self.classname == "weapon_rocketlauncher")
  512.     {
  513.         if (leave && (other.items & IT_ROCKET_LAUNCHER) )
  514.             return;
  515.         if (!TeamFortress_CanGetWeapon(other,IT_ROCKET_LAUNCHER))
  516.             return;
  517.         hadammo = other.ammo_rockets;            
  518.         new = IT_ROCKET_LAUNCHER;
  519.         other.ammo_rockets = other.ammo_rockets + 5;
  520.     }
  521.     else if (self.classname == "weapon_grenadelauncher")
  522.     {
  523.         if (leave && (other.items & IT_GRENADE_LAUNCHER) )
  524.             return;
  525.         if (!TeamFortress_CanGetWeapon(other,IT_GRENADE_LAUNCHER))
  526.             return;
  527.         hadammo = other.ammo_rockets;            
  528.         new = IT_GRENADE_LAUNCHER;
  529.         other.ammo_rockets = other.ammo_rockets + 5;
  530.     }
  531.     else if (self.classname == "weapon_lightning")
  532.     {
  533.         if (leave && (other.items & IT_LIGHTNING) )
  534.             return;
  535.         if (!TeamFortress_CanGetWeapon(other,IT_LIGHTNING))
  536.             return;
  537.         hadammo = other.ammo_rockets;            
  538.         new = IT_LIGHTNING;
  539.         other.ammo_cells = other.ammo_cells + 15;
  540.     }
  541.     else
  542.         objerror ("weapon_touch: unknown classname");
  543.  
  544.     sprint (other, "You got the ");
  545.     sprint (other, self.netname);
  546.     sprint (other, "\n");
  547. // weapon touch sound
  548.     sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
  549.     stuffcmd (other, "bf\n");
  550.  
  551.     bound_other_ammo ();
  552.  
  553. // change to the weapon
  554.     old = other.items;
  555.     other.items = other.items | new;
  556.     
  557.     stemp = self;
  558.     self = other;
  559.  
  560.     if (!deathmatch)
  561.         self.weapon = new;
  562.     else
  563.         Deathmatch_Weapon (old, new);
  564.  
  565.     W_SetCurrentAmmo();
  566.  
  567.     self = stemp;
  568.  
  569.     if (leave)
  570.         return;
  571.  
  572. // remove it in single player, or setup for respawning in deathmatch
  573.     self.model = string_null;
  574.     self.solid = SOLID_NOT;
  575.     if (deathmatch == 1)
  576.         self.nextthink = time + 30;
  577.     self.think = SUB_regen;
  578.     
  579.     activator = other;
  580.     SUB_UseTargets();                // fire all targets / killtargets
  581. };
  582.  
  583.  
  584. /*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32)
  585. */
  586.  
  587. void() weapon_supershotgun =
  588. {
  589.     precache_model ("progs/g_shot.mdl");
  590.     setmodel (self, "progs/g_shot.mdl");
  591.     self.weapon = IT_SUPER_SHOTGUN;
  592.     self.netname = "Double-barrelled Shotgun";
  593.     self.touch = weapon_touch;
  594.     setsize (self, '-16 -16 0', '16 16 56');
  595.     StartItem ();
  596. };
  597.  
  598. /*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32)
  599. */
  600.  
  601. void() weapon_nailgun =
  602. {
  603.     precache_model ("progs/g_nail.mdl");
  604.     setmodel (self, "progs/g_nail.mdl");
  605.     self.weapon = IT_NAILGUN;
  606.     self.netname = "nailgun";
  607.     self.touch = weapon_touch;
  608.     setsize (self, '-16 -16 0', '16 16 56');
  609.     StartItem ();
  610. };
  611.  
  612. /*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32)
  613. */
  614.  
  615. void() weapon_supernailgun =
  616. {
  617.     precache_model ("progs/g_nail2.mdl");
  618.     setmodel (self, "progs/g_nail2.mdl");
  619.     self.weapon = IT_SUPER_NAILGUN;
  620.     self.netname = "Super Nailgun";
  621.     self.touch = weapon_touch;
  622.     setsize (self, '-16 -16 0', '16 16 56');
  623.     StartItem ();
  624. };
  625.  
  626. /*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32)
  627. */
  628.  
  629. void() weapon_grenadelauncher =
  630. {
  631.     precache_model ("progs/g_rock.mdl");
  632.     setmodel (self, "progs/g_rock.mdl");
  633.     self.weapon = 3;
  634.     self.netname = "Grenade Launcher";
  635.     self.touch = weapon_touch;
  636.     setsize (self, '-16 -16 0', '16 16 56');
  637.     StartItem ();
  638. };
  639.  
  640. /*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32)
  641. */
  642.  
  643. void() weapon_rocketlauncher =
  644. {
  645.     precache_model ("progs/g_rock2.mdl");
  646.     setmodel (self, "progs/g_rock2.mdl");
  647.     self.weapon = 3;
  648.     self.netname = "Rocket Launcher";
  649.     self.touch = weapon_touch;
  650.     setsize (self, '-16 -16 0', '16 16 56');
  651.     StartItem ();
  652. };
  653.  
  654.  
  655. /*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32)
  656. */
  657.  
  658. void() weapon_lightning =
  659. {
  660.     precache_model ("progs/g_light.mdl");
  661.     setmodel (self, "progs/g_light.mdl");
  662.     self.weapon = 3;
  663.     self.netname = "Thunderbolt";
  664.     self.touch = weapon_touch;
  665.     setsize (self, '-16 -16 0', '16 16 56');
  666.     StartItem ();
  667. };
  668.  
  669.  
  670. /*
  671. ===============================================================================
  672.  
  673. AMMO
  674.  
  675. ===============================================================================
  676. */
  677. void() ammo_touch =
  678. {
  679. local entity    stemp;
  680. local float        best;
  681.  
  682.     if (other.classname != "player")
  683.         return;
  684.     if (other.health <= 0)
  685.         return;
  686.  
  687. // if the player was using his best weapon, change up to the new one if better        
  688.     stemp = self;
  689.     self = other;
  690.     best = W_BestWeapon();
  691.     self = stemp;
  692.  
  693.  
  694. // shotgun
  695.     if (self.weapon == 1)
  696.     {
  697.         if (other.ammo_shells >= TeamFortress_GetMaxAmmo(other,IT_SHELLS))
  698.             return;
  699.         other.ammo_shells = other.ammo_shells + self.aflag;
  700.     }
  701.  
  702. // spikes
  703.     if (self.weapon == 2)
  704.     {
  705.         if (other.ammo_nails >= TeamFortress_GetMaxAmmo(other,IT_SHELLS))
  706.             return;
  707.         other.ammo_nails = other.ammo_nails + self.aflag;
  708.     }
  709.  
  710. //    rockets
  711.     if (self.weapon == 3)
  712.     {
  713.         if (other.ammo_rockets >= TeamFortress_GetMaxAmmo(other,IT_ROCKETS))
  714.             return;
  715.         other.ammo_rockets = other.ammo_rockets + self.aflag;
  716.     }
  717.  
  718. //    cells
  719.     if (self.weapon == 4)
  720.     {
  721.         if (other.ammo_cells >= TeamFortress_GetMaxAmmo(other,IT_CELLS))
  722.             return;
  723.         other.ammo_cells = other.ammo_cells + self.aflag;
  724.     }
  725.  
  726.     bound_other_ammo ();
  727.     
  728.     sprint (other, "You got the ");
  729.     sprint (other, self.netname);
  730.     sprint (other, "\n");
  731. // ammo touch sound
  732.     sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
  733.     stuffcmd (other, "bf\n");
  734.  
  735. // change to a better weapon if appropriate
  736.  
  737.     if ( other.weapon == best )
  738.     {
  739.         stemp = self;
  740.         self = other;
  741.         self.weapon = W_BestWeapon();
  742.         W_SetCurrentAmmo ();
  743.         self = stemp;
  744.     }
  745.  
  746. // if changed current ammo, update it
  747.     stemp = self;
  748.     self = other;
  749.     W_SetCurrentAmmo();
  750.     self = stemp;
  751.  
  752. // remove it in single player, or setup for respawning in deathmatch
  753.     self.model = string_null;
  754.     self.solid = SOLID_NOT;
  755.     if (deathmatch == 1)
  756.         self.nextthink = time + 30;
  757.     
  758.     self.think = SUB_regen;
  759.  
  760.     activator = other;
  761.     SUB_UseTargets();                // fire all targets / killtargets
  762. };
  763.  
  764.  
  765.  
  766.  
  767. float WEAPON_BIG2 = 1;
  768.  
  769. /*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) big
  770. */
  771.  
  772. void() item_shells =
  773. {
  774.     self.touch = ammo_touch;
  775.  
  776.     if (self.spawnflags & WEAPON_BIG2)
  777.     {
  778.         precache_model ("maps/b_shell1.bsp");
  779.         setmodel (self, "maps/b_shell1.bsp");
  780.         self.aflag = 40;
  781.     }
  782.     else
  783.     {
  784.         precache_model ("maps/b_shell0.bsp");
  785.         setmodel (self, "maps/b_shell0.bsp");
  786.         self.aflag = 20;
  787.     }
  788.     self.weapon = 1;
  789.     self.netname = "shells";
  790.     setsize (self, '0 0 0', '32 32 56');
  791.     StartItem ();
  792. };
  793.  
  794. /*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) big
  795. */
  796.  
  797. void() item_spikes =
  798. {
  799.     self.touch = ammo_touch;
  800.  
  801.     if (self.spawnflags & WEAPON_BIG2)
  802.     {
  803.         precache_model ("maps/b_nail1.bsp");
  804.         setmodel (self, "maps/b_nail1.bsp");
  805.         self.aflag = 50;
  806.     }
  807.     else
  808.     {
  809.         precache_model ("maps/b_nail0.bsp");
  810.         setmodel (self, "maps/b_nail0.bsp");
  811.         self.aflag = 25;
  812.     }
  813.     self.weapon = 2;
  814.     self.netname = "nails";
  815.     setsize (self, '0 0 0', '32 32 56');
  816.     StartItem ();
  817. };
  818.  
  819. /*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) big
  820. */
  821.  
  822. void() item_rockets =
  823. {
  824.     self.touch = ammo_touch;
  825.  
  826.     if (self.spawnflags & WEAPON_BIG2)
  827.     {
  828.         precache_model ("maps/b_rock1.bsp");
  829.         setmodel (self, "maps/b_rock1.bsp");
  830.         self.aflag = 10;
  831.     }
  832.     else
  833.     {
  834.         precache_model ("maps/b_rock0.bsp");
  835.         setmodel (self, "maps/b_rock0.bsp");
  836.         self.aflag = 5;
  837.     }
  838.     self.weapon = 3;
  839.     self.netname = "rockets";
  840.     setsize (self, '0 0 0', '32 32 56');
  841.     StartItem ();
  842. };
  843.  
  844.  
  845. /*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) big
  846. */
  847.  
  848. void() item_cells =
  849. {
  850.     self.touch = ammo_touch;
  851.  
  852.     if (self.spawnflags & WEAPON_BIG2)
  853.     {
  854.         precache_model ("maps/b_batt1.bsp");
  855.         setmodel (self, "maps/b_batt1.bsp");
  856.         self.aflag = 12;
  857.     }
  858.     else
  859.     {
  860.         precache_model ("maps/b_batt0.bsp");
  861.         setmodel (self, "maps/b_batt0.bsp");
  862.         self.aflag = 6;
  863.     }
  864.     self.weapon = 4;
  865.     self.netname = "cells";
  866.     setsize (self, '0 0 0', '32 32 56');
  867.     StartItem ();
  868. };
  869.  
  870.  
  871. /*QUAKED item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big
  872. DO NOT USE THIS!!!! IT WILL BE REMOVED!
  873. */
  874.  
  875. float WEAPON_SHOTGUN = 1;
  876. float WEAPON_ROCKET = 2;
  877. float WEAPON_SPIKES = 4;
  878. float WEAPON_BIG = 8;
  879. void() item_weapon =
  880. {
  881.     self.touch = ammo_touch;
  882.  
  883.     if (self.spawnflags & WEAPON_SHOTGUN)
  884.     {
  885.         if (self.spawnflags & WEAPON_BIG)
  886.         {
  887.             precache_model ("maps/b_shell1.bsp");
  888.             setmodel (self, "maps/b_shell1.bsp");
  889.             self.aflag = 40;
  890.         }
  891.         else
  892.         {
  893.             precache_model ("maps/b_shell0.bsp");
  894.             setmodel (self, "maps/b_shell0.bsp");
  895.             self.aflag = 20;
  896.         }
  897.         self.weapon = 1;
  898.         self.netname = "shells";
  899.     }
  900.  
  901.     if (self.spawnflags & WEAPON_SPIKES)
  902.     {
  903.         if (self.spawnflags & WEAPON_BIG)
  904.         {
  905.             precache_model ("maps/b_nail1.bsp");
  906.             setmodel (self, "maps/b_nail1.bsp");
  907.             self.aflag = 40;
  908.         }
  909.         else
  910.         {
  911.             precache_model ("maps/b_nail0.bsp");
  912.             setmodel (self, "maps/b_nail0.bsp");
  913.             self.aflag = 20;
  914.         }
  915.         self.weapon = 2;
  916.         self.netname = "spikes";
  917.     }
  918.  
  919.     if (self.spawnflags & WEAPON_ROCKET)
  920.     {
  921.         if (self.spawnflags & WEAPON_BIG)
  922.         {
  923.             precache_model ("maps/b_rock1.bsp");
  924.             setmodel (self, "maps/b_rock1.bsp");
  925.             self.aflag = 10;
  926.         }
  927.         else
  928.         {
  929.             precache_model ("maps/b_rock0.bsp");
  930.             setmodel (self, "maps/b_rock0.bsp");
  931.             self.aflag = 5;
  932.         }
  933.         self.weapon = 3;
  934.         self.netname = "rockets";
  935.     }
  936.     
  937.     setsize (self, '0 0 0', '32 32 56');
  938.     StartItem ();
  939. };
  940.  
  941.  
  942. /*
  943. ===============================================================================
  944.  
  945. KEYS
  946.  
  947. ===============================================================================
  948. */
  949.  
  950. void() key_touch =
  951. {
  952. local entity    stemp;
  953. local float        best;
  954.  
  955.     if (other.classname != "player")
  956.         return;
  957.     if (other.health <= 0)
  958.         return;
  959.     if (other.items & self.items)
  960.         return;
  961.  
  962.     sprint (other, "You got the ");
  963.     sprint (other, self.netname);
  964.     sprint (other,"\n");
  965.  
  966.     sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  967.     stuffcmd (other, "bf\n");
  968.     other.items = other.items | self.items;
  969.  
  970.     if (!coop)
  971.     {    
  972.         self.solid = SOLID_NOT;
  973.         self.model = string_null;
  974.     }
  975.  
  976.     activator = other;
  977.     SUB_UseTargets();                // fire all targets / killtargets
  978. };
  979.  
  980.  
  981. void() key_setsounds =
  982. {
  983.     if (world.worldtype == 0)
  984.     {
  985.         precache_sound ("misc/medkey.wav");
  986.         self.noise = "misc/medkey.wav";
  987.     }
  988.     if (world.worldtype == 1)
  989.     {
  990.         precache_sound ("misc/runekey.wav");
  991.         self.noise = "misc/runekey.wav";
  992.     }
  993.     if (world.worldtype == 2)
  994.     {
  995.         precache_sound2 ("misc/basekey.wav");
  996.         self.noise = "misc/basekey.wav";
  997.     }
  998. };
  999.  
  1000. /*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32)
  1001. SILVER key
  1002. In order for keys to work
  1003. you MUST set your maps
  1004. worldtype to one of the
  1005. following:
  1006. 0: medieval
  1007. 1: metal
  1008. 2: base
  1009. */
  1010.  
  1011. void() item_key1 =
  1012. {
  1013.     if (world.worldtype == 0)
  1014.     {
  1015.         precache_model ("progs/w_s_key.mdl");
  1016.         setmodel (self, "progs/w_s_key.mdl");
  1017.         self.netname = "silver key";
  1018.     }
  1019.     else if (world.worldtype == 1)
  1020.     {
  1021.         precache_model ("progs/m_s_key.mdl");
  1022.         setmodel (self, "progs/m_s_key.mdl");
  1023.         self.netname = "silver runekey";
  1024.     }
  1025.     else if (world.worldtype == 2)
  1026.     {
  1027.         precache_model2 ("progs/b_s_key.mdl");
  1028.         setmodel (self, "progs/b_s_key.mdl");
  1029.         self.netname = "silver keycard";
  1030.     }
  1031.     key_setsounds();
  1032.     self.touch = key_touch;
  1033.     self.items = IT_KEY1;
  1034.     setsize (self, '-16 -16 -24', '16 16 32');
  1035.     StartItem ();
  1036. };
  1037.  
  1038. /*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32)
  1039. GOLD key
  1040. In order for keys to work
  1041. you MUST set your maps
  1042. worldtype to one of the
  1043. following:
  1044. 0: medieval
  1045. 1: metal
  1046. 2: base
  1047. */
  1048.  
  1049. void() item_key2 =
  1050. {
  1051.     if (world.worldtype == 0)
  1052.     {
  1053.         precache_model ("progs/w_g_key.mdl");
  1054.         setmodel (self, "progs/w_g_key.mdl");
  1055.         self.netname = "gold key";
  1056.     }
  1057.     if (world.worldtype == 1)
  1058.     {
  1059.         precache_model ("progs/m_g_key.mdl");
  1060.         setmodel (self, "progs/m_g_key.mdl");
  1061.         self.netname = "gold runekey";
  1062.     }
  1063.     if (world.worldtype == 2)
  1064.     {
  1065.         precache_model2 ("progs/b_g_key.mdl");
  1066.         setmodel (self, "progs/b_g_key.mdl");
  1067.         self.netname = "gold keycard";
  1068.     }
  1069.     key_setsounds();
  1070.     self.touch = key_touch;
  1071.     self.items = IT_KEY2;
  1072.     setsize (self, '-16 -16 -24', '16 16 32');
  1073.     StartItem ();
  1074. };
  1075.  
  1076.  
  1077.  
  1078. /*
  1079. ===============================================================================
  1080.  
  1081. END OF LEVEL RUNES
  1082.  
  1083. ===============================================================================
  1084. */
  1085.  
  1086. void() sigil_touch =
  1087. {
  1088. local entity    stemp;
  1089. local float        best;
  1090.  
  1091.     if (other.classname != "player")
  1092.         return;
  1093.     if (other.health <= 0)
  1094.         return;
  1095.  
  1096.     centerprint (other, "You got the rune!");
  1097.  
  1098.     sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  1099.     stuffcmd (other, "bf\n");
  1100.     self.solid = SOLID_NOT;
  1101.     self.model = string_null;
  1102.     serverflags = serverflags | (self.spawnflags & 15);
  1103.     self.classname = "";        // so rune doors won't find it
  1104.     
  1105.     activator = other;
  1106.     SUB_UseTargets();                // fire all targets / killtargets
  1107. };
  1108.  
  1109.  
  1110. /*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4
  1111. End of level sigil, pick up to end episode and return to jrstart.
  1112. */
  1113.  
  1114. void() item_sigil =
  1115. {
  1116.     if (!self.spawnflags)
  1117.         objerror ("no spawnflags");
  1118.  
  1119.     precache_sound ("misc/runekey.wav");
  1120.     self.noise = "misc/runekey.wav";
  1121.  
  1122.     if (self.spawnflags & 1)
  1123.     {
  1124.         precache_model ("progs/end1.mdl");
  1125.         setmodel (self, "progs/end1.mdl");
  1126.     }
  1127.     if (self.spawnflags & 2)
  1128.     {
  1129.         precache_model2 ("progs/end2.mdl");
  1130.         setmodel (self, "progs/end2.mdl");
  1131.     }
  1132.     if (self.spawnflags & 4)
  1133.     {
  1134.         precache_model2 ("progs/end3.mdl");
  1135.         setmodel (self, "progs/end3.mdl");
  1136.     }
  1137.     if (self.spawnflags & 8)
  1138.     {
  1139.         precache_model2 ("progs/end4.mdl");
  1140.         setmodel (self, "progs/end4.mdl");
  1141.     }
  1142.  
  1143.     self.touch = sigil_touch;
  1144.     setsize (self, '-16 -16 -24', '16 16 32');
  1145.     
  1146.     StartItem ();
  1147. };
  1148.  
  1149. /*
  1150. ===============================================================================
  1151.  
  1152. POWERUPS
  1153.  
  1154. ===============================================================================
  1155. */
  1156.  
  1157. void() powerup_touch;
  1158.  
  1159.  
  1160. void() powerup_touch =
  1161. {
  1162. local entity    stemp;
  1163. local float        best;
  1164.  
  1165.     if (other.classname != "player")
  1166.         return;
  1167.     if (other.health <= 0)
  1168.         return;
  1169.  
  1170.     sprint (other, "You got the ");
  1171.     sprint (other, self.netname);
  1172.     sprint (other,"\n");
  1173.  
  1174.     if (deathmatch)
  1175.     {
  1176.         self.mdl = self.model;
  1177.         
  1178.         if ((self.classname == "item_artifact_invulnerability") ||
  1179.             (self.classname == "item_artifact_invisibility"))
  1180.             self.nextthink = time + 60*5;
  1181.         else
  1182.             self.nextthink = time + 60;
  1183.         
  1184.         self.think = SUB_regen;
  1185.     }    
  1186.  
  1187.     sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  1188.     stuffcmd (other, "bf\n");
  1189.     self.solid = SOLID_NOT;
  1190.     other.items = other.items | self.items;
  1191.     self.model = string_null;
  1192.  
  1193. // do the apropriate action
  1194.     if (self.classname == "item_artifact_envirosuit")
  1195.     {
  1196.         other.rad_time = 1;
  1197.         other.radsuit_finished = time + 30;
  1198.     }
  1199.     
  1200.     if (self.classname == "item_artifact_invulnerability")
  1201.     {
  1202.         other.invincible_time = 1;
  1203.         other.invincible_finished = time + 30;
  1204.     }
  1205.     
  1206.     if (self.classname == "item_artifact_invisibility")
  1207.     {
  1208.         other.invisible_time = 1;
  1209.         other.invisible_finished = time + 30;
  1210.     }
  1211.  
  1212.     if (self.classname == "item_artifact_super_damage")
  1213.     {
  1214.         other.super_time = 1;
  1215.         other.super_damage_finished = time + 30;
  1216.     }    
  1217.  
  1218.     activator = other;
  1219.     SUB_UseTargets();                // fire all targets / killtargets
  1220. };
  1221.  
  1222.  
  1223.  
  1224. /*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
  1225. Player is invulnerable for 30 seconds
  1226. */
  1227. void() item_artifact_invulnerability =
  1228. {
  1229.     self.touch = powerup_touch;
  1230.  
  1231.     precache_model ("progs/invulner.mdl");
  1232.     precache_sound ("items/protect.wav");
  1233.     precache_sound ("items/protect2.wav");
  1234.     precache_sound ("items/protect3.wav");
  1235.     self.noise = "items/protect.wav";
  1236.     setmodel (self, "progs/invulner.mdl");
  1237.     self.netname = "Pentagram of Protection";
  1238.     self.items = IT_INVULNERABILITY;
  1239.     setsize (self, '-16 -16 -24', '16 16 32');
  1240.     StartItem ();
  1241. };
  1242.  
  1243. /*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32)
  1244. Player takes no damage from water or slime for 30 seconds
  1245. */
  1246. void() item_artifact_envirosuit =
  1247. {
  1248.     self.touch = powerup_touch;
  1249.  
  1250.     precache_model ("progs/suit.mdl");
  1251.     precache_sound ("items/suit.wav");
  1252.     precache_sound ("items/suit2.wav");
  1253.     self.noise = "items/suit.wav";
  1254.     setmodel (self, "progs/suit.mdl");
  1255.     self.netname = "Biosuit";
  1256.     self.items = IT_SUIT;
  1257.     setsize (self, '-16 -16 -24', '16 16 32');
  1258.     StartItem ();
  1259. };
  1260.  
  1261.  
  1262. /*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32)
  1263. Player is invisible for 30 seconds
  1264. */
  1265. void() item_artifact_invisibility =
  1266. {
  1267.     self.touch = powerup_touch;
  1268.  
  1269.     precache_model ("progs/invisibl.mdl");
  1270.     precache_sound ("items/inv1.wav");
  1271.     precache_sound ("items/inv2.wav");
  1272.     precache_sound ("items/inv3.wav");
  1273.     self.noise = "items/inv1.wav";
  1274.     setmodel (self, "progs/invisibl.mdl");
  1275.     self.netname = "Ring of Shadows";
  1276.     self.items = IT_INVISIBILITY;
  1277.     setsize (self, '-16 -16 -24', '16 16 32');
  1278.     StartItem ();
  1279. };
  1280.  
  1281.  
  1282. /*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
  1283. The next attack from the player will do 4x damage
  1284. */
  1285. void() item_artifact_super_damage =
  1286. {
  1287.     self.touch = powerup_touch;
  1288.  
  1289.     precache_model ("progs/quaddama.mdl");
  1290.     precache_sound ("items/damage.wav");
  1291.     precache_sound ("items/damage2.wav");
  1292.     precache_sound ("items/damage3.wav");
  1293.     self.noise = "items/damage.wav";
  1294.     setmodel (self, "progs/quaddama.mdl");
  1295.     self.netname = "Quad Damage";
  1296.     self.items = IT_QUAD;
  1297.     setsize (self, '-16 -16 -24', '16 16 32');
  1298.     StartItem ();
  1299. };
  1300.  
  1301.  
  1302.  
  1303. /*
  1304. ===============================================================================
  1305.  
  1306. PLAYER BACKPACKS
  1307.  
  1308. ===============================================================================
  1309. */
  1310.  
  1311. void() BackpackTouch =
  1312. {
  1313.     local string    s;
  1314.     local float        best;
  1315.     local entity    stemp;
  1316.     
  1317.     if (other.classname != "player")
  1318.         return;
  1319.     if (other.health <= 0)
  1320.         return;
  1321.  
  1322.     // You can't pick up Backpacks while firing.
  1323.     if (other.button0)
  1324.         return;
  1325.  
  1326.     // if the player was using his best weapon, change up to the new one if better        
  1327.     if (!(other.tfstate & TFSTATE_RELOADING))
  1328.     {
  1329.         stemp = self;
  1330.         self = other;
  1331.         best = W_BestWeapon();
  1332.         self = stemp;
  1333.     }
  1334.  
  1335.     // change weapons
  1336.     other.ammo_shells = other.ammo_shells + self.ammo_shells;
  1337.     other.ammo_nails = other.ammo_nails + self.ammo_nails;
  1338.     other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
  1339.     other.ammo_cells = other.ammo_cells + self.ammo_cells;
  1340.  
  1341.     // Add only the weapons this playerclass can use
  1342.     TeamFortress_AddBackpackItems(other,self);
  1343.         
  1344.     bound_other_ammo ();
  1345.  
  1346.     sprint (other, "You get ");
  1347.  
  1348.     if (self.ammo_shells)
  1349.     {
  1350.         s = ftos(self.ammo_shells);
  1351.         sprint (other, s);
  1352.         sprint (other, " shells  ");
  1353.     }
  1354.     if (self.ammo_nails)
  1355.     {
  1356.         s = ftos(self.ammo_nails);
  1357.         sprint (other, s);
  1358.         sprint (other, " nails ");
  1359.     }
  1360.     if (self.ammo_rockets)
  1361.     {
  1362.         s = ftos(self.ammo_rockets);
  1363.         sprint (other, s);
  1364.         sprint (other, " rockets  ");
  1365.     }
  1366.     if (self.ammo_cells)
  1367.     {
  1368.         s = ftos(self.ammo_cells);
  1369.         sprint (other, s);
  1370.         sprint (other, " cells  ");
  1371.     }
  1372.     
  1373.     sprint (other, "\n");
  1374.     // backpack touch sound
  1375.     sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
  1376.     stuffcmd (other, "bf\n");
  1377.  
  1378.     // change to a better weapon if appropriate
  1379. /*    if ( (!(other.tfstate & TFSTATE_RELOADING)) && (other.weapon == best))
  1380.     {
  1381.         stemp = self;
  1382.         self = other;
  1383.         self.weapon = W_BestWeapon();
  1384.         self = stemp;
  1385.     }
  1386. */
  1387.     remove(self);
  1388.     
  1389.     self = other;
  1390.     if ((!(other.weapon == IT_EXTRA_WEAPON)) && (!(other.secondary_weapon == NIT_ASSAULT_CANNON)))
  1391.         W_SetCurrentAmmo ();
  1392. };
  1393.  
  1394. /*
  1395. ===============
  1396. DropBackpack
  1397. ===============
  1398. */
  1399. void() DropBackpack =
  1400. {
  1401.     local entity    item;
  1402.  
  1403.     if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells))
  1404.         return;    // nothing in it
  1405.  
  1406.     item = spawn();
  1407.     item.origin = self.origin - '0 0 24';
  1408.     
  1409.     item.items = self.weapon;
  1410.  
  1411.     item.ammo_shells = self.ammo_shells;
  1412.     item.ammo_nails = self.ammo_nails;
  1413.     item.ammo_rockets = self.ammo_rockets;
  1414.     item.ammo_cells = self.ammo_cells;
  1415.  
  1416.     item.velocity_z = 300;
  1417.     item.velocity_x = -100 + (random() * 200);
  1418.     item.velocity_y = -100 + (random() * 200);
  1419.     
  1420.     item.flags = FL_ITEM;
  1421.     item.solid = SOLID_TRIGGER;
  1422.     item.movetype = MOVETYPE_TOSS;
  1423.     setmodel (item, "progs/backpack.mdl");
  1424.     setsize (item, '-16 -16 0', '16 16 56');
  1425.     item.touch = BackpackTouch;
  1426.     
  1427.     item.nextthink = time + 120;    // remove after 2 minutes
  1428.     item.think = SUB_Remove;
  1429. };
  1430.  
  1431.  
  1432.