void(string gibname, float dm) ThrowGib;
float() random;

void() SUB_Gib =
{
	local vector x,y,v;
	x='1 0 0';
	y='0 1 0';
	v=x*(50-random()*100)+y*(50-random()*100);
	if (random() < 0.8)  // Meat spray only, most of the time
		SpawnMeatSpray(self.origin, v);
        else if (random() < 0.3)
                ThrowGib("progs/gib1.mdl", self.health);
        else if (random() < 0.5)
                ThrowGib("progs/gib2.mdl", self.health);
        else
                ThrowGib("progs/gib3.mdl", self.health);
};

void(string headmdl) monster_gib =
{
		
	if ((self.classname == "monster_army"))
	{
	ThrowGib ("progs/mangib1.mdl", self.health);
	ThrowGib ("progs/mangib2.mdl", self.health);
	ThrowGib ("progs/mangib3.mdl", self.health);
	ThrowHead (headmdl, self.health);
	}
	else
	{
	ThrowGib ("progs/gib1.mdl", self.health);
	ThrowGib ("progs/gib2.mdl", self.health);
	ThrowGib ("progs/gib3.mdl", self.health);
	ThrowHead (headmdl, self.health);
	}

	if (random() < 0.7) 
	   HomerTaunt(damage_attacker);
	else
   	sound (self,CHAN_VOICE,"player/udeath.wav",TRUE,ATTN_NORM);


};
/*
void() monster_corpse_gib =
{
		monster_gib(self.weaponmodel);
};

void(vector bb1, vector bb2, string headmdl) monster_corpse_setup =
{
	setsize(self, bb1, bb2);
	self.weaponmodel=headmdl; // This should be unused in monsters
		
	self.health=35;
	self.th_stand = SUB_Null;
	self.th_walk = SUB_Null;
	self.th_run = SUB_Null;
   self.th_pain = SUB_Gib;
   self.th_die = monster_corpse_gib;
	self.th_melee = SUB_Null;
	self.th_missile = SUB_Null;
	// self.touch = monster_dead_push; // This does funny things
	self.takedamage= DAMAGE_AIM; // grenades explode 
	self.flags = self.flags &! FL_MONSTER;  // Next "death" isn't counted

};
*/
