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;
27 //RadiusDamage (self,self, min(self.ammo,50),min(self.ammo,50) * 0.25,250,world,min(self.ammo,50)*5,DEATH_TURRET,world);
29 if(self.damage_flags & TFL_DMG_DEATH_NORESPAWN)
31 if (self.turret_diehook)
32 self.turret_diehook();
34 remove(self.tur_head);
40 self.SendFlags |= TNSF_STATUS;
41 self.nextthink = time + 0.2;
42 self.think = turret_hide;
44 if (self.turret_diehook)
45 self.turret_diehook();
49 void turret_stdproc_respawn()
51 // Make sure all parts belong to the same team since
52 // this function doubles as "teamchange" function.
53 self.tur_head.team = self.team;
55 self.effects &= ~EF_NODRAW;
56 self.deadflag = DEAD_NO;
57 self.effects = EF_LOWPRECISION;
58 self.solid = SOLID_BBOX;
60 self.takedamage = DAMAGE_AIM;
61 self.event_damage = turret_stdproc_damage;
63 self.avelocity = '0 0 0';
64 self.tur_head.avelocity = self.avelocity;
65 self.tur_head.angles = self.idle_aim;
66 self.health = self.tur_health;
69 self.volly_counter = self.shot_volly;
70 self.ammo = self.ammo_max;
72 self.nextthink = time + self.ticrate;
73 self.think = turret_think;
75 self.SendFlags = TNSF_FULL_UPDATE;
77 if (self.turret_respawnhook)
78 self.turret_respawnhook();
82 * Standard damage proc.
84 void turret_stdproc_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
87 if(self.deadflag == DEAD_DEAD)
90 // Inactive turrets take no damage. (hm..)
95 if (self.team == attacker.team)
97 // This does not happen anymore. Re-enable if you fix that.
98 if(IS_REAL_CLIENT(attacker))
99 sprint(attacker, "\{1}Turret tells you: I'm on your team!\n");
101 if(autocvar_g_friendlyfire)
102 damage = damage * autocvar_g_friendlyfire;
107 self.health = self.health - damage;
109 // thorw head slightly off aim when hit?
110 if (self.damage_flags & TFL_DMG_HEADSHAKE)
112 self.tur_head.angles_x = self.tur_head.angles.x + (-0.5 + random()) * damage;
113 self.tur_head.angles_y = self.tur_head.angles.y + (-0.5 + random()) * damage;
115 self.SendFlags |= TNSF_ANG;
118 if (self.turrcaps_flags & TFL_TURRCAPS_MOVE)
119 self.velocity = self.velocity + vforce;
121 if (self.health <= 0)
123 self.event_damage = func_null;
124 self.tur_head.event_damage = func_null;
125 self.takedamage = DAMAGE_NO;
126 self.nextthink = time;
127 self.think = turret_stdproc_die;
130 self.SendFlags |= TNSF_STATUS;