2 * Spawn a boom, trow fake bits arround
3 * and hide the real ones.
7 self.effects |= EF_NODRAW;
8 self.nextthink = time + self.respawntime - 0.2;
9 self.think = turret_stdproc_respawn;
12 void turret_stdproc_die()
14 self.deadflag = DEAD_DEAD;
15 self.tur_head.deadflag = self.deadflag;
17 // Unsolidify and hide real parts
18 self.solid = SOLID_NOT;
19 self.tur_head.solid = self.solid;
21 self.event_damage = func_null;
22 self.takedamage = DAMAGE_NO;
26 MUTATOR_CALLHOOK(TurretDies);
29 //RadiusDamage (self,self, min(self.ammo,50),min(self.ammo,50) * 0.25,250,world,min(self.ammo,50)*5,DEATH_TURRET,world);
31 if(self.damage_flags & TFL_DMG_DEATH_NORESPAWN)
33 if (self.turret_diehook)
34 self.turret_diehook();
36 remove(self.tur_head);
42 self.SendFlags |= TNSF_STATUS;
43 self.nextthink = time + 0.2;
44 self.think = turret_hide;
46 if (self.turret_diehook)
47 self.turret_diehook();
51 void turret_stdproc_respawn()
53 // Make sure all parts belong to the same team since
54 // this function doubles as "teamchange" function.
55 self.tur_head.team = self.team;
57 self.effects &~= EF_NODRAW;
58 self.deadflag = DEAD_NO;
59 self.effects = EF_LOWPRECISION;
60 self.solid = SOLID_BBOX;
62 self.takedamage = DAMAGE_AIM;
63 self.event_damage = turret_stdproc_damage;
65 self.avelocity = '0 0 0';
66 self.tur_head.avelocity = self.avelocity;
67 self.tur_head.angles = self.idle_aim;
68 self.health = self.tur_health;
71 self.volly_counter = self.shot_volly;
72 self.ammo = self.ammo_max;
74 self.nextthink = time + self.ticrate;
75 self.think = turret_think;
77 self.SendFlags = TNSF_FULL_UPDATE;
79 if (self.turret_respawnhook)
80 self.turret_respawnhook();
84 * Standard damage proc.
86 void turret_stdproc_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
89 if(self.deadflag == DEAD_DEAD)
92 // Inactive turrets take no damage. (hm..)
97 if (self.team == attacker.team)
99 // This does not happen anymore. Re-enable if you fix that.
100 if(IS_REAL_CLIENT(attacker))
101 sprint(attacker, "\{1}Turret tells you: I'm on your team!\n");
103 if(autocvar_g_friendlyfire)
104 damage = damage * autocvar_g_friendlyfire;
109 self.health = self.health - damage;
111 // thorw head slightly off aim when hit?
112 if (self.damage_flags & TFL_DMG_HEADSHAKE)
114 self.tur_head.angles_x = self.tur_head.angles_x + (-0.5 + random()) * damage;
115 self.tur_head.angles_y = self.tur_head.angles_y + (-0.5 + random()) * damage;
117 self.SendFlags |= TNSF_ANG;
120 if (self.turrcaps_flags & TFL_TURRCAPS_MOVE)
121 self.velocity = self.velocity + vforce;
123 if (self.health <= 0)
125 self.event_damage = func_null;
126 self.tur_head.event_damage = func_null;
127 self.takedamage = DAMAGE_NO;
128 self.nextthink = time;
129 self.think = turret_stdproc_die;
132 self.SendFlags |= TNSF_STATUS;