- //tracebox(pre_pos + '0 0 32',self.enemy.mins,self.enemy.maxs,pre_pos -'0 0 64',MOVE_WORLDONLY,self.enemy);
- traceline(pre_pos + '0 0 32',pre_pos -'0 0 64',MOVE_WORLDONLY,self.enemy);
+ //tracebox(pre_pos + '0 0 32',this.enemy.mins,this.enemy.maxs,pre_pos -'0 0 64',MOVE_WORLDONLY,this.enemy);
+ traceline(pre_pos + '0 0 32',pre_pos -'0 0 64',MOVE_WORLDONLY,this.enemy);
- //RadiusDamage (self,self, min(self.ammo,50),min(self.ammo,50) * 0.25,250,world,min(self.ammo,50)*5,DEATH_TURRET,world);
+ //RadiusDamage (this,this, min(this.ammo,50),min(this.ammo,50) * 0.25,250,NULL,min(this.ammo,50)*5,DEATH_TURRET,NULL);
- self.tur_head.team = self.team;
- self.effects &= ~EF_NODRAW;
- self.deadflag = DEAD_NO;
- self.effects = EF_LOWPRECISION;
- self.solid = SOLID_BBOX;
- self.takedamage = DAMAGE_AIM;
- self.event_damage = turret_damage;
- self.avelocity = '0 0 0';
- self.tur_head.avelocity = self.avelocity;
- self.tur_head.angles = self.idle_aim;
- self.health = self.max_health;
- self.enemy = world;
- self.volly_counter = self.shot_volly;
- self.ammo = self.ammo_max;
-
- self.nextthink = time + self.ticrate;
- self.think = turret_think;
-
- self.SendFlags = TNSF_FULL_UPDATE;
-
- Turret tur = get_turretinfo(self.m_id);
- tur.tr_setup(tur, self);
+ this.tur_head.team = this.team;
+ this.effects &= ~EF_NODRAW;
+ this.deadflag = DEAD_NO;
+ this.effects = EF_LOWPRECISION;
+ this.solid = SOLID_BBOX;
+ this.takedamage = DAMAGE_AIM;
+ this.event_damage = turret_damage;
+ this.avelocity = '0 0 0';
+ this.tur_head.avelocity = this.avelocity;
+ this.tur_head.angles = this.idle_aim;
+ this.health = this.max_health;
+ this.enemy = NULL;
+ this.volly_counter = this.shot_volly;
+ this.ammo = this.ammo_max;
+
+ this.nextthink = time + this.ticrate;
+ setthink(this, turret_think);
+
+ this.SendFlags = TNSF_FULL_UPDATE;
+
+ Turret tur = get_turretinfo(this.m_id);
+ tur.tr_setup(tur, this);
- d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
- self.owner.tur_debug_dmg_t_h = self.owner.tur_debug_dmg_t_h + d;
- self.owner.tur_debug_dmg_t_f = self.owner.tur_debug_dmg_t_f + self.owner.shot_dmg;
+ d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, NULL);
+ this.owner.tur_debug_dmg_t_h = this.owner.tur_debug_dmg_t_h + d;
+ this.owner.tur_debug_dmg_t_f = this.owner.tur_debug_dmg_t_f + this.owner.shot_dmg;
- oldpos = self.enemy.origin;
- setorigin(self.enemy, self.tur_aimpos);
- tracebox(self.tur_shotorg, '-1 -1 -1', '1 1 1', self.tur_shotorg + (self.tur_shotdir_updated * self.tur_dist_aimpos), MOVE_NORMAL,self);
- setorigin(self.enemy, oldpos);
+ oldpos = t_turret.enemy.origin;
+ setorigin(t_turret.enemy, t_turret.tur_aimpos);
+ tracebox(t_turret.tur_shotorg, '-1 -1 -1', '1 1 1', t_turret.tur_shotorg + (t_turret.tur_shotdir_updated * t_turret.tur_dist_aimpos), MOVE_NORMAL,t_turret);
+ setorigin(t_turret.enemy, oldpos);
- f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic
- move_angle_x = bound(-self.aim_speed, move_angle_x * self.track_accel_pitch * f_tmp, self.aim_speed);
- move_angle_y = bound(-self.aim_speed, move_angle_y * self.track_accel_rotate * f_tmp, self.aim_speed);
- move_angle = (self.tur_head.avelocity * self.track_blendrate) + (move_angle * (1 - self.track_blendrate));
+ f_tmp = this.aim_speed * this.ticrate; // dgr/sec -> dgr/tic
+ move_angle_x = bound(-this.aim_speed, move_angle_x * this.track_accel_pitch * f_tmp, this.aim_speed);
+ move_angle_y = bound(-this.aim_speed, move_angle_y * this.track_accel_rotate * f_tmp, this.aim_speed);
+ move_angle = (this.tur_head.avelocity * this.track_blendrate) + (move_angle * (1 - this.track_blendrate));
- if (self.enemy) paint_target (self.enemy,128,self.tur_debug_rvec,0.9);
- paint_target(self,256,self.tur_debug_rvec,0.9);
- self.tur_debug_tmr1 = time + 1;
+ if (this.enemy) paint_target (this.enemy,128,this.tur_debug_rvec,0.9);
+ paint_target(this,256,this.tur_debug_rvec,0.9);
+ this.tur_debug_tmr1 = time + 1;
- if(!(self.spawnflags & TSF_SUSPENDED))
- builtin_droptofloor();
-
- self.netname = tur.netname;
- load_unit_settings(self, 0);
-
- if(!self.team || !teamplay) { self.team = MAX_SHOT_DISTANCE; }
- if(!self.ticrate) { self.ticrate = ((self.turret_flags & TUR_FLAG_SUPPORT) ? 0.2 : 0.1); }
- if(!self.health) { self.health = 1000; }
- if(!self.shot_refire) { self.shot_refire = 1; }
- if(!self.tur_shotorg) { self.tur_shotorg = '50 0 50'; }
- if(!self.turret_flags) { self.turret_flags = TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER; }
- if(!self.damage_flags) { self.damage_flags = TFL_DMG_YES | TFL_DMG_RETALIATE | TFL_DMG_AIMSHAKE; }
- if(!self.aim_flags) { self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE; }
- if(!self.track_type) { self.track_type = TFL_TRACKTYPE_STEPMOTOR; }
- if(!self.track_flags) { self.track_flags = TFL_TRACK_PITCH | TFL_TRACK_ROTATE; }
- if(!self.ammo_flags) { self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE; }
- if(!self.target_select_flags) { self.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_ANGLELIMITS; }
- if(!self.firecheck_flags) { self.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES | TFL_FIRECHECK_LOS
+ if(!(this.spawnflags & TSF_SUSPENDED))
+ droptofloor(this);
+
+ this.netname = tur.netname;
+ load_unit_settings(this, 0);
+
+ if(!this.team || !teamplay) { this.team = MAX_SHOT_DISTANCE; }
+ if(!this.ticrate) { this.ticrate = ((this.turret_flags & TUR_FLAG_SUPPORT) ? 0.2 : 0.1); }
+ if(!this.health) { this.health = 1000; }
+ if(!this.shot_refire) { this.shot_refire = 1; }
+ if(!this.tur_shotorg) { this.tur_shotorg = '50 0 50'; }
+ if(!this.turret_flags) { this.turret_flags = TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER; }
+ if(!this.damage_flags) { this.damage_flags = TFL_DMG_YES | TFL_DMG_RETALIATE | TFL_DMG_AIMSHAKE; }
+ if(!this.aim_flags) { this.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE; }
+ if(!this.track_type) { this.track_type = TFL_TRACKTYPE_STEPMOTOR; }
+ if(!this.track_flags) { this.track_flags = TFL_TRACK_PITCH | TFL_TRACK_ROTATE; }
+ if(!this.ammo_flags) { this.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE; }
+ if(!this.target_select_flags) { this.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_ANGLELIMITS; }
+ if(!this.firecheck_flags) { this.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES | TFL_FIRECHECK_LOS
- _setmodel(self, tur.model);
- setsize(self, tur.mins, tur.maxs);
-
- self.m_id = tur.m_id;
- self.classname = "turret_main";
- self.active = ACTIVE_ACTIVE;
- self.effects = EF_NODRAW;
- self.netname = tur.turret_name;
- self.ticrate = bound(sys_frametime, self.ticrate, 60);
- self.max_health = self.health;
- self.target_validate_flags = self.target_select_flags;
- self.ammo = self.ammo_max;
- self.ammo_recharge *= self.ticrate;
- self.solid = SOLID_BBOX;
- self.takedamage = DAMAGE_AIM;
- self.movetype = MOVETYPE_NOCLIP;
- self.view_ofs = '0 0 0';
- self.turret_firecheckfunc = turret_firecheck;
- self.event_damage = turret_damage;
- self.use = turret_use;
- self.bot_attack = true;
- self.nextthink = time + 1;
- self.nextthink += turret_count * sys_frametime;
-
- self.tur_head = new(turret_head);
- _setmodel(self.tur_head, tur.head_model);
- setsize(self.tur_head, '0 0 0', '0 0 0');
- setorigin(self.tur_head, '0 0 0');
- setattachment(self.tur_head, self, "tag_head");
-
- self.tur_head.netname = self.tur_head.classname;
- self.tur_head.team = self.team;
- self.tur_head.owner = self;
- self.tur_head.takedamage = DAMAGE_NO;
- self.tur_head.solid = SOLID_NOT;
- self.tur_head.movetype = self.movetype;
-
- if(!self.tur_defend)
- if(self.target != "")
+ _setmodel(this, tur.model);
+ setsize(this, tur.mins, tur.maxs);
+
+ this.m_id = tur.m_id;
+ this.classname = "turret_main";
+ this.active = ACTIVE_ACTIVE;
+ this.effects = EF_NODRAW;
+ this.netname = tur.turret_name;
+ this.ticrate = bound(sys_frametime, this.ticrate, 60);
+ this.max_health = this.health;
+ this.target_validate_flags = this.target_select_flags;
+ this.ammo = this.ammo_max;
+ this.ammo_recharge *= this.ticrate;
+ this.solid = SOLID_BBOX;
+ this.takedamage = DAMAGE_AIM;
+ this.movetype = MOVETYPE_NOCLIP;
+ this.view_ofs = '0 0 0';
+ this.turret_firecheckfunc = turret_firecheck;
+ this.event_damage = turret_damage;
+ this.use = turret_use;
+ this.bot_attack = true;
+ this.nextthink = time + 1;
+ this.nextthink += turret_count * sys_frametime;
+
+ this.tur_head = new(turret_head);
+ _setmodel(this.tur_head, tur.head_model);
+ setsize(this.tur_head, '0 0 0', '0 0 0');
+ setorigin(this.tur_head, '0 0 0');
+ setattachment(this.tur_head, this, "tag_head");
+
+ this.tur_head.netname = this.tur_head.classname;
+ this.tur_head.team = this.team;
+ this.tur_head.owner = this;
+ this.tur_head.takedamage = DAMAGE_NO;
+ this.tur_head.solid = SOLID_NOT;
+ this.tur_head.movetype = this.movetype;
+
+ if(!this.tur_defend)
+ if(this.target != "")