void() Laser_Touch_P =
{
	local vector org;
	
	if (other == self.owner)
		return;		// don't explode on owner

	if (pointcontents(self.origin) == CONTENT_SKY)
	{
		remove(self);
		return;
	}
	
	org = self.origin - 8*normalize(self.velocity);

	if (other.health)
	{
		SpawnBlood (org, self.velocity*0.2, 15);
		T_Damage (other, self, self.owner, 15);
	}
	else
	{
		WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
                WriteByte (MSG_BROADCAST,  TE_KNIGHTSPIKE);
		WriteCoord (MSG_BROADCAST, org_x);
		WriteCoord (MSG_BROADCAST, org_y);
		WriteCoord (MSG_BROADCAST, org_z);
	}
	remove(self);	
};

void(vector org, vector dir) Launch_Laser =
{
        sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
	newmis = spawn();
	newmis.owner = self;
        newmis.movetype = MOVETYPE_FLYMISSILE;
        newmis.solid = SOLID_BBOX;
	newmis.effects = EF_DIMLIGHT;
        newmis.velocity = dir * 1800;
	newmis.angles = vectoangles(newmis.velocity);
        newmis.touch = Laser_Touch_P;
        newmis.nextthink = time + 6;
	newmis.think = SUB_Remove;
	setmodel (newmis, "progs/laser.mdl");
	setsize (newmis, '0 0 0', '0 0 0');		
        setorigin (newmis, org);
};
