void () W_FireGrenade;

void () NullGrenadeTouch;


void()  nu_explode1      =       [0,             nu_explode2] {

   self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 25, other);
   
   };

void()  nu_explode2      =       [1,             nu_explode3] {
      self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 50, other);
        sound(self, CHAN_WEAPON, "explo.wav", 1, ATTN_NORM);
};

void()  nu_explode3      =       [2,             nu_explode4] {self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 75, other);
};

void()  nu_explode4      =       [3,             nu_explode5] 

   {
      self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 100, other);
      
   };

void()  nu_explode5      =       [4,             nu_explode6] {self.nextthink = time + 0.1;

      T_RadiusDamage (self, self.owner, 125, other);

};

void()  nu_explode6      =       [5,             nu_explode7] {self.nextthink = time + 0.1;

      T_RadiusDamage (self, self.owner, 150, other);

};

void()  nu_explode7      =       [6,             nu_explode8] {

   self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 175, other);

};

void()  nu_explode8      =       [7,             nu_explode9] {self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 200, other);
};

void()  nu_explode9      =       [8,             nu_explode10] {self.nextthink = time + 0.1;

      T_RadiusDamage (self, self.owner, 225, other);

};

void()  nu_explode10     =       [9,             nu_explode11] {self.nextthink = time + 0.1;

      T_RadiusDamage (self, self.owner, 250, other);

};

void()  nu_explode11     =       [10,             nu_explode12] {self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 275, other);
};

void()  nu_explode12     =       [11,             nu_explode13] {

   self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 300, other);

};

void()  nu_explode13     =       [12,             nu_explode14] {self.nextthink = time + 0.1;

      T_RadiusDamage (self, self.owner, 325, other);

};

void()  nu_explode14     =       [13,             nu_explode15] {self.nextthink = time + 0.1;

      T_RadiusDamage (self, self.owner, 350, other);

};

void()  nu_explode15     =       [14,             SUB_Remove ] {self.nextthink = time + 0.1;
      T_RadiusDamage (self, self.owner, 375, other);
};

void () NukeExploTouch;

void() MNExplosion =
{
        self.movetype = MOVETYPE_NONE;
        self.velocity = '0 0 0';
        self.touch = NukeExploTouch;
        setmodel (self, "progs/nuke.mdl");
        //self.solid = SOLID_NOT;
        self.solid = SOLID_BBOX;
        self.avelocity = '0 0 0';
        self.angles_x = 0;
        self.angles_y = 0;
        self.angles_z = 0;
        self.effects = EF_DIMLIGHT;
      T_RadiusDamage (self, self.owner, 200, other);
		T_Damage (other, self, self.owner, 200);

		if (self.classname == "rottbomb")
			totalrott = totalrott - 1;

        nu_explode1 ();
};

void () W_FireDukeNuke = {

   local entity missile;
   local entity mpuff;

	if (deathmatch)
	{
		if (self.ammo_rockets < 10)
			W_FireGrenade();
		
		self.currentammo = self.ammo_rockets = self.ammo_rockets - 10;
	}
	else
		self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
	
   sound (self,CHAN_WEAPON,"weapons/grenade.wav",TRUE,ATTN_NORM);
   self.punchangle_x = CONTENT_SOLID;
   missile = spawn ();
   missile.owner = self;
   missile.movetype = MOVETYPE_BOUNCE;
   missile.solid = SOLID_BBOX;
   missile.classname = "grenade";
   makevectors (self.v_angle);
   if ( self.v_angle_x ) {

      missile.velocity = ((((v_forward * 1000.000) + (v_up * 200.000)) + ((crandom () * v_right) * MOVETYPE_BOUNCE)) + ((crandom () * v_up) * MOVETYPE_BOUNCE));

   } else {

      missile.velocity = aim (self,10000.000);
      missile.velocity = (missile.velocity * 1000.000);
      missile.velocity_z = 200.000;

   }
   missile.avelocity = '300.000 300.000 300.000';
   missile.angles = vectoangles (missile.velocity);

		missile.touch = NullGrenadeTouch;

	
   missile.nextthink = (time + 2.500);
   missile.think = MNExplosion;
   setmodel (missile,"progs/pds.mdl");

   setsize (missile,VEC_ORIGIN,VEC_ORIGIN);
   setorigin (missile,self.origin);

};


