.entity gunner1;
.entity gunner2;
-void bumb_gunner_exit(float _exitflag)
+float bumb_gunner_frame()
{
- dprint("^2Gunner1 exits\n");
-
- if (clienttype(self) == CLIENTTYPE_REAL)
- {
- msg_entity = self;
- WriteByte (MSG_ONE, SVC_SETVIEWPORT);
- WriteEntity( MSG_ONE, self);
-
- WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
- WriteAngle(MSG_ONE, 0);
- WriteAngle(MSG_ONE, self.vehicle.angles_y);
- WriteAngle(MSG_ONE, 0);
- }
-
- setsize(self, PL_MIN,PL_MAX);
-
- self.takedamage = DAMAGE_AIM;
- self.solid = SOLID_SLIDEBOX;
- self.movetype = MOVETYPE_WALK;
- self.effects &~= EF_NODRAW;
- self.alpha = 1;
- self.PlayerPhysplug = SUB_Null;
- self.view_ofs = PL_VIEW_OFS;
- self.event_damage = PlayerDamage;
- self.hud = HUD_NORMAL;
- self.switchweapon = self.vehicle.switchweapon;
-
- if(self.flagcarried)
- {
- self.flagcarried.scale = 0.6;
- setattachment(self.flagcarried, self, "");
- setorigin(self.flagcarried, FLAG_CARRY_POS);
- }
-
- CSQCVehicleSetup(self, HUD_NORMAL);
- self.vehicle.vehicle_hudmodel.viewmodelforclient = self.vehicle;
-
- if(self == self.vehicle.owner.gunner1)
- self.vehicle.owner.gunner1 = world;
- else if(self == self.vehicle.owner.gunner2)
- self.vehicle.owner.gunner2 = world;
- else
- dprint("^1self != gunner1 or gunner2, this is a BIG PROBLEM, tell tZork this happend.\n");
-
- self.vehicle.phase = time + 1;
- self.vehicle = world;
-}
-
-float bumb_gunner_enter()
-{
- RemoveGrapplingHook(other);
- entity _gun, _gunner;
- if(!self.gunner1)
- {
- _gun = self.gun1;
- _gunner = self.gunner1;
- self.gunner1 = other;
- }
- else
- {
- _gun = self.gun2;
- _gunner = self.gunner2;
- self.gunner2 = other;
- }
-
- _gun.vehicle_pilot = other;
- _gunner = other;
- //_gun.owner = other;
- _gunner.vehicle = _gun;
- _gun.switchweapon = other.switchweapon;
- _gun.vehicle_exit = bumb_gunner_exit;
-
-
- other.angles = self.angles;
- other.takedamage = DAMAGE_NO;
- other.solid = SOLID_NOT;
- other.movetype = MOVETYPE_NOCLIP;
- other.alpha = -1;
- other.event_damage = SUB_Null;
- other.view_ofs = '0 0 0';
- other.hud = _gun.hud;
- other.PlayerPhysplug = _gun.PlayerPhysplug;
- other.vehicle_ammo1 = self.vehicle_ammo1;
- other.vehicle_ammo2 = self.vehicle_ammo2;
- other.vehicle_reload1 = self.vehicle_reload1;
- other.vehicle_reload2 = self.vehicle_reload2;
- other.vehicle_energy = self.vehicle_energy;
- other.PlayerPhysplug = bumb_gunner_frame;
- other.flags &~= FL_ONGROUND;
-
- msg_entity = other;
- WriteByte (MSG_ONE, SVC_SETVIEWPORT);
- WriteEntity(MSG_ONE, _gun.vehicle_viewport);
- WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
- WriteAngle(MSG_ONE, _gun.angles_x + self.angles_x); // tilt
- WriteAngle(MSG_ONE, _gun.angles_y + self.angles_y); // yaw
- WriteAngle(MSG_ONE, 0); // roll
- _gun.vehicle_hudmodel.viewmodelforclient = other;
-
- if(!self.gunner1)
- {
- self.gun1 = other;
- _gunner = self.gunner1;
- }
- else
- {
- _gun = self.gun2;
- _gunner = self.gunner2;
- }
-
- return TRUE;
+ entity vehic = self.vehicle.owner;
+ entity gun = self.vehicle;
+ entity gunner = self;
-
-
+ self = vehic;
+
- //gun.vehicle_energy = ((gun == vehic.gun1) ? vehic.vehicle_ammo1 : vehic.vehicle_ammo2);
-
+ vehic.solid = SOLID_NOT;
+ setorigin ( gunner, vehic.origin );
+ gunner.velocity = vehic.velocity;
+ crosshair_trace ( gunner );
+ vector _ct = trace_endpos;
+ vector ad;
+
+ float _in = ( ( gun == vehic.gun1 ) ? autocvar_g_vehicle_bumblebee_cannon_turnlimit_in : autocvar_g_vehicle_bumblebee_cannon_turnlimit_out );
+ float _out = ( ( gun == vehic.gun1 ) ? autocvar_g_vehicle_bumblebee_cannon_turnlimit_out : autocvar_g_vehicle_bumblebee_cannon_turnlimit_in );
+
+ if ( autocvar_g_vehicle_bumblebee_cannon_lock )
+ {
+ if ( gun.lock_time < time )
+ gun.enemy = world;
+
+ if ( trace_ent )
+ if ( trace_ent.movetype )
+ if ( trace_ent.takedamage )
+ if ( !trace_ent.deadflag )
+ {
+ if ( teamplay )
+ {
+ if ( trace_ent.team != gunner.team )
+ {
+ gun.enemy = trace_ent;
+ gun.lock_time = time + 5;
+ }
+ }
+ else
+ {
+ gun.enemy = trace_ent;
+ gun.lock_time = time + 5;
+ }
+ }
+ }
+
+ if ( gun.enemy )
+ {
+ float i, distance, impact_time;
+
+ vector vf = real_origin ( gun.enemy );
+ vector _vel = gun.enemy.velocity;
+ if ( gun.enemy.movetype == MOVETYPE_WALK )
+ _vel_z *= 0.1;
+
+
+ ad = vf;
+ for ( i = 0; i < 4; ++i )
+ {
+ distance = vlen ( ad - gunner.origin );
+ impact_time = distance / autocvar_g_vehicle_bumblebee_cannon_speed;
+ ad = vf + _vel * impact_time;
+ }
+ trace_endpos = ad;
+
+
+ UpdateAuxiliaryXhair ( gunner, ad, '1 0 1', 1 );
+ vehicle_aimturret ( vehic, trace_endpos, gun, "fire",
- autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
++ autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
+ _out * -1, _in, autocvar_g_vehicle_bumblebee_cannon_turnspeed );
+
+ }
+ else
+ vehicle_aimturret ( vehic, _ct, gun, "fire",
- autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
++ autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
+ _out * -1, _in, autocvar_g_vehicle_bumblebee_cannon_turnspeed );
+
+ if ( gunner.BUTTON_ATCK )
+ if ( time > gun.attack_finished_single )
+ if ( gun.vehicle_energy >= autocvar_g_vehicle_bumblebee_cannon_cost )
+ {
+ gun.vehicle_energy -= autocvar_g_vehicle_bumblebee_cannon_cost;
+ bumb_fire_cannon ( gun, "fire", gunner );
+ gun.delay = time;
+ gun.attack_finished_single = time + autocvar_g_vehicle_bumblebee_cannon_refire;
+ }
+
- VEHICLE_UPDATE_PLAYER ( gunner, health, bumblebee );
- //VEHICLE_UPDATE_PLAYER(gunner, energy, bumblebee);
++ VEHICLE_UPDATE_PLAYER (gunner, health, bumblebee);
+
+ if ( vehic.vehicle_flags & VHF_HASSHIELD )
- VEHICLE_UPDATE_PLAYER ( gunner, shield, bumblebee );
++ VEHICLE_UPDATE_PLAYER (gunner, shield, bumblebee);
+
+ ad = gettaginfo ( gun, gettagindex ( gun, "fire" ) );
+ traceline ( ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, gun );
+
+ UpdateAuxiliaryXhair ( gunner, trace_endpos, ( '1 0 0' * gunner.vehicle_reload1 ) + ( '0 1 0' * ( 1 - gunner.vehicle_reload1 ) ), 0 );
+
+ if ( vehic.owner )
+ UpdateAuxiliaryXhair ( vehic.owner, trace_endpos, ( '1 0 0' * gunner.vehicle_reload1 ) + ( '0 1 0' * ( 1 - gunner.vehicle_reload1 ) ), ( ( gunner == vehic.gunner1 ) ? 1 : 2 ) );
+
+ vehic.solid = SOLID_BBOX;
+ gunner.BUTTON_ATCK = gunner.BUTTON_ATCK2 = gunner.BUTTON_CROUCH = 0;
-
- //vehic.vehicle_ammo1 = vehic.gun1.vehicle_energy;
- //vehic.vehicle_ammo2 = vehic.gun2.vehicle_energy;
-
+ gunner.vehicle_energy = ( gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo ) * 100;
+
+ self = gunner;
+ return 1;
}
-float vehicles_valid_pilot()
+void bumb_gunner_exit ( float _exitflag )
{
- if(other.classname != "player")
- return FALSE;
-
- if(other.deadflag != DEAD_NO)
- return FALSE;
-
- if(other.vehicle != world)
- return FALSE;
-
- // Remove this when bots know how to use vehicles.
- if (clienttype(other) != CLIENTTYPE_REAL)
- return FALSE;
-
- if(teamplay && other.team != self.team)
- return FALSE;
-
- return TRUE;
+ if ( clienttype ( self ) == CLIENTTYPE_REAL )
+ {
+ msg_entity = self;
+ WriteByte ( MSG_ONE, SVC_SETVIEWPORT );
+ WriteEntity ( MSG_ONE, self );
+
+ WriteByte ( MSG_ONE, SVC_SETVIEWANGLES );
+ WriteAngle ( MSG_ONE, 0 );
+ WriteAngle ( MSG_ONE, self.vehicle.angles_y );
+ WriteAngle ( MSG_ONE, 0 );
+ }
+
+ setsize ( self, PL_MIN, PL_MAX );
+
+ self.takedamage = DAMAGE_AIM;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_WALK;
- self.effects &~ = EF_NODRAW;
++ self.effects &~= EF_NODRAW;
+ self.alpha = 1;
+ self.PlayerPhysplug = SUB_Null;
+ self.view_ofs = PL_VIEW_OFS;
+ self.event_damage = PlayerDamage;
+ self.hud = HUD_NORMAL;
+ self.switchweapon = self.vehicle.switchweapon;
+
+ if ( self.flagcarried )
+ {
+ self.flagcarried.scale = 0.6;
+ setattachment ( self.flagcarried, self, "" );
+ setorigin ( self.flagcarried, FLAG_CARRY_POS );
+ }
+
+ CSQCVehicleSetup ( self, HUD_NORMAL );
+ self.vehicle.vehicle_hudmodel.viewmodelforclient = self.vehicle;
+
+ if ( self == self.vehicle.owner.gunner1 )
+ self.vehicle.owner.gunner1 = world;
+ else if ( self == self.vehicle.owner.gunner2 )
+ self.vehicle.owner.gunner2 = world;
+ else
+ dprint ( "^1self != gunner1 or gunner2, this is a BIG PROBLEM, tell tZork this happend.\n" );
+
+ self.vehicle.phase = time + 5;
+ self.vehicle = world;
}
-void bumb_touch()
+float bumb_gunner_enter()
{
-
- if(self.gunner1 != world && self.gunner2 != world)
- {
- vehicles_touch();
- return;
- }
-
- if (vehicles_valid_pilot())
- {
- if(self.gun1.phase <= time)
- if (bumb_gunner_enter())
- return;
-
- if(self.gun2.phase <= time)
- if (bumb_gunner_enter())
- return;
-
- }
-
- vehicles_touch();
+ RemoveGrapplingHook ( other );
+ entity _gun, _gunner;
+ if ( !self.gunner1 )
+ {
+ _gun = self.gun1;
+ _gunner = self.gunner1;
+ self.gunner1 = other;
+ }
+ else if ( !self.gunner2 )
+ {
+ _gun = self.gun2;
+ _gunner = self.gunner2;
+ self.gunner2 = other;
+ }
+ else
+ {
+ dprint ( "^1ERROR:^7Tried to enter a fully occupied vehicle!\n" );
+ return FALSE;
+ }
+
+ _gunner = other;
+ _gunner.vehicle = _gun;
+ _gun.switchweapon = other.switchweapon;
+ _gun.vehicle_exit = bumb_gunner_exit;
+
+ other.angles = self.angles;
+ other.takedamage = DAMAGE_NO;
+ other.solid = SOLID_NOT;
+ other.movetype = MOVETYPE_NOCLIP;
+ other.alpha = -1;
+ other.event_damage = SUB_Null;
+ other.view_ofs = '0 0 0';
+ other.hud = _gun.hud;
+ other.PlayerPhysplug = _gun.PlayerPhysplug;
+ other.vehicle_ammo1 = self.vehicle_ammo1;
+ other.vehicle_ammo2 = self.vehicle_ammo2;
+ other.vehicle_reload1 = self.vehicle_reload1;
+ other.vehicle_reload2 = self.vehicle_reload2;
+ other.vehicle_energy = self.vehicle_energy;
+ other.PlayerPhysplug = bumb_gunner_frame;
- other.flags &~ = FL_ONGROUND;
++ other.flags &~= FL_ONGROUND;
+
+ msg_entity = other;
+ WriteByte ( MSG_ONE, SVC_SETVIEWPORT );
+ WriteEntity ( MSG_ONE, _gun.vehicle_viewport );
+ WriteByte ( MSG_ONE, SVC_SETVIEWANGLES );
+ WriteAngle ( MSG_ONE, _gun.angles_x + self.angles_x ); // tilt
+ WriteAngle ( MSG_ONE, _gun.angles_y + self.angles_y ); // yaw
+ WriteAngle ( MSG_ONE, 0 ); // roll
+ _gun.vehicle_hudmodel.viewmodelforclient = other;
+
+ CSQCVehicleSetup ( other, other.hud );
+
+ return TRUE;
}
-float bumb_pilot_frame()
+float vehicles_valid_pilot()
{
- entity pilot, vehic;
- vector newvel;
+ if ( other.classname != "player" )
+ return FALSE;
- pilot = self;
- vehic = self.vehicle;
- self = vehic;
+ if ( other.deadflag != DEAD_NO )
+ return FALSE;
- if(vehic.deadflag != DEAD_NO)
- {
- self = pilot;
- pilot.BUTTON_ATCK = pilot.BUTTON_ATCK2 = 0;
- return 1;
- }
+ if ( other.vehicle != world )
+ return FALSE;
- crosshair_trace(pilot);
+ if ( clienttype ( other ) != CLIENTTYPE_REAL )
+ if ( !autocvar_g_vehicles_allow_bots )
+ return FALSE;
- vector vang;
- float ftmp;
+ if ( teamplay && other.team != self.team )
+ return FALSE;
+
+ return TRUE;
+}
- vang = vehic.angles;
- newvel = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
- vang_x *= -1;
- newvel_x *= -1;
- if(newvel_x > 180) newvel_x -= 360;
- if(newvel_x < -180) newvel_x += 360;
- if(newvel_y > 180) newvel_y -= 360;
- if(newvel_y < -180) newvel_y += 360;
+void bumb_touch()
+{
- ftmp = shortangle_f(pilot.v_angle_y - vang_y, vang_y);
- if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
- vehic.avelocity_y = bound(-autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed);
+ if ( self.gunner1 != world && self.gunner2 != world )
+ {
+ vehicles_touch();
+ return;
+ }
- // Pitch
- ftmp = 0;
- if(pilot.movement_x > 0 && vang_x < autocvar_g_vehicle_bumblebee_pitchlimit) ftmp = 5;
- else if(pilot.movement_x < 0 && vang_x > -autocvar_g_vehicle_bumblebee_pitchlimit) ftmp = -20;
+ if ( vehicles_valid_pilot() )
+ {
+ if ( self.gun1.phase <= time )
+ if ( bumb_gunner_enter() )
+ return;
- newvel_x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x , autocvar_g_vehicle_bumblebee_pitchlimit);
- ftmp = vang_x - bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x + ftmp, autocvar_g_vehicle_bumblebee_pitchlimit);
- vehic.avelocity_x = bound(-autocvar_g_vehicle_bumblebee_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_bumblebee_pitchspeed);
+ if ( self.gun2.phase <= time )
+ if ( bumb_gunner_enter() )
+ return;
- vehic.angles_x = anglemods(vehic.angles_x);
- vehic.angles_y = anglemods(vehic.angles_y);
- vehic.angles_z = anglemods(vehic.angles_z);
+ }
- makevectors('0 1 0' * vehic.angles_y);
- newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
+ vehicles_touch();
+}
- if(pilot.movement_x != 0)
- {
- if(pilot.movement_x > 0)
- newvel += v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
- else if(pilot.movement_x < 0)
- newvel -= v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
- }
+void bumb_regen()
+{
+ if ( self.gun1.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time )
+ self.gun1.vehicle_energy = min ( autocvar_g_vehicle_bumblebee_cannon_ammo,
+ self.gun1.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime );
- if(pilot.movement_y != 0)
- {
- if(pilot.movement_y < 0)
- newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
- else if(pilot.movement_y > 0)
- newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
- ftmp = newvel * v_right;
- ftmp *= frametime * 0.1;
- vehic.angles_z = bound(-15, vehic.angles_z + ftmp, 15);
- }
- else
- {
- vehic.angles_z *= 0.95;
- if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
- vehic.angles_z = 0;
- }
+ if ( self.gun2.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time )
+ self.gun2.vehicle_energy = min ( autocvar_g_vehicle_bumblebee_cannon_ammo,
+ self.gun2.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime );
- if(pilot.BUTTON_CROUCH)
- newvel -= v_up * autocvar_g_vehicle_bumblebee_speed_down;
- else if (pilot.BUTTON_JUMP)
- newvel += v_up * autocvar_g_vehicle_bumblebee_speed_up;
-
- vehic.velocity += newvel * frametime;
- pilot.velocity = pilot.movement = vehic.velocity;
- setorigin(pilot,vehic.origin + '0 0 32');
-
- vehicle_aimturret(vehic, trace_endpos, self.gun3, "fire",
- autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up,
- autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides * -1, autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides, autocvar_g_vehicle_bumblebee_raygun_turnspeed);
-
- /*
- if(!vehic.gunner1)
- vehicle_aimturret(vehic, trace_endpos, self.gun1, "fire",
- autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
- autocvar_g_vehicle_bumblebee_cannon_turnlimit_out * -1, autocvar_g_vehicle_bumblebee_cannon_turnlimit_in, autocvar_g_vehicle_bumblebee_cannon_turnspeed);
- //if(!vehic.gunner2)
- vehicle_aimturret(vehic, trace_endpos, self.gun2, "fire",
- autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
- autocvar_g_vehicle_bumblebee_cannon_turnlimit_in * -1, autocvar_g_vehicle_bumblebee_cannon_turnlimit_out, autocvar_g_vehicle_bumblebee_cannon_turnspeed);
-
-
-
- if(pilot.BUTTON_ATCK)
- if(time > vehic.attack_finished_single)
- if(vehic.vehicle_energy >= autocvar_g_vehicle_bumblebee_cannon_cost)
- {
- vehic.vehicle_energy -= autocvar_g_vehicle_bumblebee_cannon_cost;
- vehic.wait = time;
-
- if(vehic.cnt)
- {
- bumb_fire_cannon(vehic.gun1, "fire", pilot);
- vehic.cnt = 0;
- }
- else
- {
- bumb_fire_cannon(vehic.gun2, "fire", pilot);
- vehic.cnt = 1;
- }
- vehic.attack_finished_single = time + autocvar_g_vehicle_bumblebee_cannon_refire;
- }
- */
-
- if(vehic.vehicle_flags & VHF_SHIELDREGEN)
- vehicles_regen(dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, frametime, TRUE);
+ /*
- if(vehic.vehicle_flags & VHF_HEALTHREGEN)
- vehicles_regen(dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, frametime, FALSE);
+ vehicles_regen( self.gun1.delay, vehicle_ammo1, autocvar_g_vehicle_bumblebee_cannon_ammo,
+ autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause,
+ autocvar_g_vehicle_bumblebee_cannon_ammo_regen, frametime, FALSE);
- if(vehic.vehicle_flags & VHF_ENERGYREGEN)
- vehicles_regen(wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, frametime, FALSE);
+ vehicles_regen( self.gun2.delay, vehicle_ammo2, autocvar_g_vehicle_bumblebee_cannon_ammo,
+ autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause,
+ autocvar_g_vehicle_bumblebee_cannon_ammo_regen, frametime, FALSE);
+ */
- VEHICLE_UPDATE_PLAYER(pilot, health, bumblebee);
- VEHICLE_UPDATE_PLAYER(pilot, energy, bumblebee);
+ if ( self.vehicle_flags & VHF_SHIELDREGEN )
+ vehicles_regen ( self.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, frametime, TRUE );
- if(vehic.vehicle_flags & VHF_HASSHIELD)
- VEHICLE_UPDATE_PLAYER(pilot, shield, bumblebee);
+ if ( self.vehicle_flags & VHF_HEALTHREGEN )
+ vehicles_regen ( self.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, frametime, FALSE );
+ if ( self.vehicle_flags & VHF_ENERGYREGEN )
+ vehicles_regen ( self.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, frametime, FALSE );
- pilot.BUTTON_ATCK = pilot.BUTTON_ATCK2 = pilot.BUTTON_CROUCH = 0;
- self = pilot;
+}
- return 1;
+float bumb_pilot_frame()
+{
+ entity pilot, vehic;
+ vector newvel;
+
+ pilot = self;
+ vehic = self.vehicle;
+ self = vehic;
+
+
+ if ( vehic.deadflag != DEAD_NO )
+ {
+ self = pilot;
+ pilot.BUTTON_ATCK = pilot.BUTTON_ATCK2 = 0;
+ return 1;
+ }
+
+ bumb_regen();
+
+ crosshair_trace ( pilot );
+
+ vector vang;
+ float ftmp;
+
+ vang = vehic.angles;
+ newvel = vectoangles ( normalize ( trace_endpos - self.origin + '0 0 32' ) );
+ vang_x *= -1;
+ newvel_x *= -1;
+ if ( newvel_x > 180 ) newvel_x -= 360;
+ if ( newvel_x < -180 ) newvel_x += 360;
+ if ( newvel_y > 180 ) newvel_y -= 360;
+ if ( newvel_y < -180 ) newvel_y += 360;
+
+ ftmp = shortangle_f ( pilot.v_angle_y - vang_y, vang_y );
+ if ( ftmp > 180 ) ftmp -= 360;
+ if ( ftmp < -180 ) ftmp += 360;
+ vehic.avelocity_y = bound ( -autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed );
+
+ // Pitch
+ ftmp = 0;
+ if ( pilot.movement_x > 0 && vang_x < autocvar_g_vehicle_bumblebee_pitchlimit ) ftmp = 5;
+ else if ( pilot.movement_x < 0 && vang_x > -autocvar_g_vehicle_bumblebee_pitchlimit ) ftmp = -20;
+
+ newvel_x = bound ( -autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x , autocvar_g_vehicle_bumblebee_pitchlimit );
+ ftmp = vang_x - bound ( -autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x + ftmp, autocvar_g_vehicle_bumblebee_pitchlimit );
+ vehic.avelocity_x = bound ( -autocvar_g_vehicle_bumblebee_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_bumblebee_pitchspeed );
+
+ vehic.angles_x = anglemods ( vehic.angles_x );
+ vehic.angles_y = anglemods ( vehic.angles_y );
+ vehic.angles_z = anglemods ( vehic.angles_z );
+
+ makevectors ( '0 1 0' * vehic.angles_y );
+ newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
+
+ if ( pilot.movement_x != 0 )
+ {
+ if ( pilot.movement_x > 0 )
+ newvel += v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
+ else if ( pilot.movement_x < 0 )
+ newvel -= v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
+ }
+
+ if ( pilot.movement_y != 0 )
+ {
+ if ( pilot.movement_y < 0 )
+ newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
+ else if ( pilot.movement_y > 0 )
+ newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
+ ftmp = newvel * v_right;
+ ftmp *= frametime * 0.1;
+ vehic.angles_z = bound ( -15, vehic.angles_z + ftmp, 15 );
+ }
+ else
+ {
+ vehic.angles_z *= 0.95;
+ if ( vehic.angles_z >= -1 && vehic.angles_z <= -1 )
+ vehic.angles_z = 0;
+ }
+
+ if ( pilot.BUTTON_CROUCH )
+ newvel -= v_up * autocvar_g_vehicle_bumblebee_speed_down;
+ else if ( pilot.BUTTON_JUMP )
+ newvel += v_up * autocvar_g_vehicle_bumblebee_speed_up;
+
+ vehic.velocity += newvel * frametime;
+ pilot.velocity = pilot.movement = vehic.velocity;
+ setorigin ( pilot, vehic.origin + '0 0 32' );
+
+ vehicle_aimturret ( vehic, trace_endpos, self.gun3, "fire",
+ autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up,
+ autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides * -1, autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides, autocvar_g_vehicle_bumblebee_raygun_turnspeed );
+
+
+ if ( ( pilot.BUTTON_ATCK || pilot.BUTTON_ATCK2 ) && vehic.vehicle_energy > autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime )
+ {
+
+ if ( vehic.gun3.enemy == world )
+ {
+ vehic.gun3.enemy = spawn();
+ Net_LinkEntity ( vehic.gun3.enemy, FALSE, 0, bumble_raygun_send );
+ vehic.gun3.enemy.SendFlags = BRG_SETUP;
+ vehic.gun3.enemy.think = SUB_Remove;
+ vehic.gun3.enemy.realowner = pilot;
+ vehic.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
+ }
+
+ vehic.gun3.enemy.nextthink = time + 0.1;
+ setorigin ( vehic.gun3.enemy, gettaginfo ( vehic.gun3, gettagindex ( vehic.gun3, "fire" ) ) );
+ traceline ( vehic.gun3.enemy.origin, vehic.gun3.enemy.origin + v_forward * autocvar_g_vehicle_bumblebee_raygun_range, MOVE_NORMAL, vehic );
+ if ( trace_ent )
+ {
+ if ( autocvar_g_vehicle_bumblebee_raygun )
+ {
+ Damage ( trace_ent, vehic, pilot, autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime, DEATH_GENERIC, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * sys_frametime );
+ vehic.vehicle_energy -= autocvar_g_vehicle_bumblebee_raygun_aps * sys_frametime;
+ }
+ else
+ {
+ if ( trace_ent.deadflag == DEAD_NO )
+ if ( ( teamplay && trace_ent.team == pilot.team ) || !teamplay )
+ {
+
+ if ( trace_ent.vehicle_flags & VHF_ISVEHICLE )
+ {
+ if ( autocvar_g_vehicle_bumblebee_healgun_sps && trace_ent.vehicle_health <= trace_ent.tur_health )
+ trace_ent.vehicle_shield = min ( trace_ent.vehicle_shield + autocvar_g_vehicle_bumblebee_healgun_sps * frametime, trace_ent.tur_head.tur_health );
+
+ if ( autocvar_g_vehicle_bumblebee_healgun_hps )
+ trace_ent.vehicle_health = min ( trace_ent.vehicle_health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, trace_ent.tur_health );
+ }
+ else if ( trace_ent.flags & FL_CLIENT )
+ {
+ if ( trace_ent.health <= autocvar_g_vehicle_bumblebee_healgun_hmax && autocvar_g_vehicle_bumblebee_healgun_hps )
+ trace_ent.health = min ( trace_ent.health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, autocvar_g_vehicle_bumblebee_healgun_hmax );
+
+ if ( trace_ent.armorvalue <= autocvar_g_vehicle_bumblebee_healgun_amax && autocvar_g_vehicle_bumblebee_healgun_aps )
+ trace_ent.armorvalue = min ( trace_ent.armorvalue + autocvar_g_vehicle_bumblebee_healgun_aps * frametime, autocvar_g_vehicle_bumblebee_healgun_amax );
+
+ trace_ent.health = min ( trace_ent.health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, autocvar_g_vehicle_bumblebee_healgun_hmax );
+ }
+ else if ( trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET )
+ {
+ if ( trace_ent.health <= trace_ent.tur_health && autocvar_g_vehicle_bumblebee_healgun_hps )
+ trace_ent.health = min ( trace_ent.health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, trace_ent.tur_health );
+ //else ..hmmm what? ammo?
+
+ trace_ent.SendFlags |= TNSF_STATUS;
+ }
+ }
+ }
+ }
+ vehic.gun3.enemy.hook_end = trace_endpos;
+ vehic.gun3.enemy.SendFlags |= BRG_START;
+ vehic.gun3.enemy.SendFlags |= BRG_END;
+ vehic.wait = time + 1;
+ }
+ else
+ {
+ if ( vehic.gun3.enemy )
+ remove ( vehic.gun3.enemy );
+
+ vehic.gun3.enemy = world;
+ }
+
- VEHICLE_UPDATE_PLAYER ( pilot, health, bumblebee );
- VEHICLE_UPDATE_PLAYER ( pilot, energy, bumblebee );
++ VEHICLE_UPDATE_PLAYER ( pilot, health, bumblebee);
++ VEHICLE_UPDATE_PLAYER ( pilot, energy, bumblebee);
+
+ pilot.vehicle_ammo1 = ( vehic.gun1.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo ) * 100;
+ pilot.vehicle_ammo2 = ( vehic.gun2.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo ) * 100;
+
+ if ( vehic.vehicle_flags & VHF_HASSHIELD )
- VEHICLE_UPDATE_PLAYER ( pilot, shield, bumblebee );
++ VEHICLE_UPDATE_PLAYER ( pilot, shield, bumblebee);
+
+
+ pilot.BUTTON_ATCK = pilot.BUTTON_ATCK2 = pilot.BUTTON_CROUCH = 0;
+ self = pilot;
+
+ return 1;
}
void bumb_think()