fangflecked-old

old project. ive since repurposed the name
git clone git://moonbender.net/fangflecked-old
Log | Files | Refs | README

combat.qc (845B)


      1 void(entity target, entity attacker) Killed =
      2 {
      3 
      4 	local entity oself;
      5 	
      6 	oself = self;
      7 	self = target;
      8 	
      9 	if (self.health < 0)
     10 		self.health = 0;
     11 		
     12 	if (self.movetype == MOVETYPE_PUSH || self.movetype == MOVETYPE_NONE)
     13 	{	//doors and such
     14 //		self.th_die();
     15 		return;
     16 	}
     17 	
     18 	self.enemy = attacker;
     19 	self.takedamage = DAMAGE_NO;
     20 	self.touch = SUB_Null;
     21 	
     22 	self.th_die();
     23 	
     24 	self = oself;
     25 }
     26 
     27 /*
     28 Inflictor is what deals the damage. Attacker is who shot. Sometimes the same, not always.
     29 Use only this function to reduce health.
     30 */
     31 
     32 void(entity target, entity inflictor, entity attacker, float damage) T_Damage=
     33 {
     34 	if (!target.takedamage)
     35 		return;
     36 	
     37 	
     38 	target.health = target.health - damage;
     39 	
     40 	if (target.health <= 0)
     41 	{
     42 		Killed (target, attacker);
     43 		return;
     44 	}
     45 	
     46 	target.th_pain(attacker, damage);
     47 }