1 void spawnfunc_turret_tesla();
2 void turret_tesla_dinit();
3 void turret_tesla_fire();
5 entity toast(entity from, float range, float damage)
14 e = findradius(from.origin,range);
17 if ((e.railgunhit != 1) && (e != from))
19 r = turret_validate_target(self,e,self.target_validate_flags);
22 traceline(from.origin,0.5 * (e.absmin + e.absmax),MOVE_WORLDONLY,from);
23 if (trace_fraction == 1.0)
25 d = vlen(e.origin - from.origin);
39 te_csqc_lightningarc(from.origin,etarget.origin);
40 Damage(etarget, self, self, damage, DEATH_TURRET_TESLA, etarget.origin, '0 0 0');
41 etarget.railgunhit = 1;
47 float turret_tesla_firecheck()
49 if not (turret_stdproc_firecheck())
52 self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;
54 self.enemy = turret_select_target();
63 void turret_tesla_fire()
68 //w_deathtypestring = "discoverd how a tesla coil works";
71 r = self.target_range;
73 setorigin(e,self.tur_shotorg);
75 self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;
80 if (t == world) return;
82 self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_TEAMCHECK;
84 self.attack_finished_single = time + self.shot_refire;
85 for (i = 0; i < 10; ++i)
90 if (t == world) break;
94 e = findchainfloat(railgunhit, 1);
102 void turret_tesla_postthink()
104 if not (self.tur_active)
106 self.tur_head.avelocity = '0 0 0';
110 if(self.ammo < self.shot_dmg)
112 self.tur_head.avelocity = '0 45 0' * (self.ammo / self.shot_dmg);
116 self.tur_head.avelocity = '0 180 0' * (self.ammo / self.shot_dmg);
118 if(self.attack_finished_single > time)
122 f = (self.ammo / self.ammo_max);
126 te_csqc_lightningarc(self.tur_shotorg,self.tur_shotorg + (randomvec() * 350));
131 void turret_tesla_dinit()
133 if (self.netname == "") self.netname = "Tesla Coil";
135 self.turrcaps_flags = TFL_TURRCAPS_HITSCAN | TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_MISSILEKILL;
137 self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES |
138 TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;
140 self.firecheck_flags = TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_OWM_AMMO;
141 self.shoot_flags = TFL_SHOOT_CUSTOM;
142 self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
143 self.aim_flags = TFL_AIM_NO;
144 self.track_flags = TFL_TRACK_NO;
146 if (turret_stdproc_init("tesla_std", "models/turrets/tesla_base.md3", "models/turrets/tesla_head.md3", TID_TESLA) == 0)
151 setsize(self,'-60 -60 0','60 60 128');
153 self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES |
154 TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;
156 self.turret_firefunc = turret_tesla_fire;
157 self.turret_postthink = turret_tesla_postthink;
158 self.turret_firecheckfunc = turret_tesla_firecheck;
161 /*QUAKED turret_tesla (0 .5 .8) ?
163 void spawnfunc_turret_tesla()
165 precache_model ("models/turrets/tesla_head.md3");
166 precache_model ("models/turrets/tesla_base.md3");
169 self.think = turret_tesla_dinit;
170 self.nextthink = time + 0.5;