114 if(gun.lock_time <
time ||
IS_DEAD(gun.enemy) ||
STAT(FROZEN, gun.enemy))
127 gun.lock_time =
time + 2.5;
133 gun.lock_time =
time + 0.5;
140 float distance, impact_time;
143 vector _vel = gun.enemy.velocity;
151 ad = vf + _vel * impact_time;
168 if(
time > gun.attack_finished_single[0])
188 UpdateAuxiliaryXhair(vehic.owner,
trace_endpos, (
'1 0 0' *
this.vehicle_reload1) + (
'0 1 0' *(1 -
this.vehicle_reload1)), ((
this == vehic.gunner1) ? 1 : 2));
200 tracebox(gunner.origin +
'0 0 32',
STAT(PL_MIN, player),
STAT(PL_MAX, player), prefer_spot,
MOVE_NORMAL, player);
204 mysize = 1.5 *
vlen(
STAT(PL_MAX, player) -
STAT(PL_MIN, player));
207 v2 = 0.5 * (gunner.absmin + gunner.absmax);
208 for(i = 0; i < 100; ++i)
225 entity vehic = gunner.owner;
248 player.view_ofs =
STAT(PL_VIEW_OFS, player);
255 player.(weaponentity).
m_switchweapon = gunner.(weaponentity).m_switchweapon;
256 delete(gunner.(weaponentity));
258 player.vehicle_enter_delay =
time + 2;
259 setsize(player,
STAT(PL_MIN, player),
STAT(PL_MAX, player));
263 if(player == vehic.gunner1) { vehic.gunner1 =
NULL; }
264 if(player == vehic.gunner2) { vehic.gunner2 =
NULL;
v_right *= -1; }
272 player.velocity = 0.75 * vehic.velocity +
normalize(spot - vehic.origin) * 200;
273 player.velocity_z += 10;
275 gunner.phase =
time + 5;
276 gunner.vehicle_hudmodel.viewmodelforclient = gunner;
280 player.vehicle =
NULL;
288 if(!vehic.gunner1 && !vehic.gunner2 && ((
time >= vehic.gun1.phase) + (
time >= vehic.gun2.phase)) == 2)
293 if(
vlen2(player.origin - v1) <
vlen2(player.origin - v2))
296 vehic.gunner1 = player;
301 vehic.gunner2 = player;
304 else if(!vehic.gunner1 &&
time >= vehic.gun1.phase) { gunner = vehic.gun1; vehic.gunner1 = player; }
305 else if(!vehic.gunner2 &&
time >= vehic.gun2.phase) { gunner = vehic.gun2; vehic.gunner2 = player; }
306 else {
LOG_TRACE(
"Vehicle is full, fail");
return false; }
308 player.vehicle = gunner;
309 player.angles = vehic.angles;
315 player.view_ofs =
'0 0 0';
316 STAT(HUD, player) =
STAT(HUD, gunner);
317 player.teleportable =
false;
318 player.PlayerPhysplug = gunner.PlayerPhysplug;
319 player.vehicle_ammo1 = vehic.vehicle_ammo1;
320 player.vehicle_ammo2 = vehic.vehicle_ammo2;
321 player.vehicle_reload1 = vehic.vehicle_reload1;
322 player.vehicle_reload2 = vehic.vehicle_reload2;
323 player.vehicle_energy = vehic.vehicle_energy;
332 gunner.(weaponentity) =
new(temp_wepent);
333 gunner.(weaponentity).
m_switchweapon = player.(weaponentity).m_switchweapon;
336 gunner.vehicle_hudmodel.viewmodelforclient = player;
374 if(autocvar_g_vehicles_enter) {
return; }
386 if(
time >=
toucher.vehicle_enter_delay && phase_time)
440 vector vang = vehic.angles;
444 if(newvel.x > 180) newvel.x -= 360;
445 if(newvel.x < -180) newvel.x += 360;
446 if(newvel.y > 180) newvel.y -= 360;
447 if(newvel.y < -180) newvel.y += 360;
450 if(ftmp > 180) ftmp -= 360;
451 if(ftmp < -180) ftmp += 360;
465 vehic.angles_x =
anglemods(vehic.angles.x);
466 vehic.angles_y =
anglemods(vehic.angles.y);
467 vehic.angles_z =
anglemods(vehic.angles.z);
488 vehic.angles_z =
bound(-15, vehic.angles.z + ftmp, 15);
492 vehic.angles_z *= 0.95;
493 if(vehic.angles.z >= -1 && vehic.angles.z <= -1)
502 vehic.velocity += newvel * dt;
503 this.
velocity =
CS(
this).movement = vehic.velocity;
508 if(vehic.tur_head.lock_time <
time ||
IS_DEAD(vehic.tur_head.enemy) ||
STAT(FROZEN, vehic.tur_head.enemy))
509 vehic.tur_head.enemy =
NULL;
531 if(vehic.tur_head.enemy)
545 vehic.gun3.enemy.realowner =
this;
590 vehic.gun3.enemy.SendFlags |=
BRG_END;
592 vehic.wait =
time + 1;
613 vehic.angles_x *= -1;
615 vehic.angles_x *= -1;
628 this.angles_x *= 0.95;
629 this.angles_z *= 0.95;
641 if(this.
owner.vehicleid == VEH_BUMBLEBEE.vehicleid)
670 if(this.
gun3.enemy || !wasfreed(this.
gun3.enemy))
674 this.
owner.velocity_z += 10;
675 setorigin(this.
owner, spot);
726 vehicles_impact(instance, autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
731 instance.nextthink = 0;
736 if(!instance.gunner1)
737 if(
time >= instance.gun1.phase)
738 if(instance.gun1.vehicle_enter)
739 if(instance.gun1.vehicle_enter(instance, actor))
742 if(!instance.gunner2)
743 if(
time >= instance.gun2.phase)
744 if(instance.gun2.vehicle_enter)
745 if(instance.gun2.vehicle_enter(instance, actor))
750 instance.angles_z *= 0.8;
751 instance.angles_x *= 0.8;
753 instance.nextthink =
time;
759 entity e = instance.gunner1;
760 instance.gun1.vehicle_exit(instance.gun1,
VHEF_EJECT);
768 entity e = instance.gunner2;
769 instance.gun2.vehicle_exit(instance.gun2,
VHEF_EJECT);
781 if(instance.gun3.enemy || !wasfreed(instance.gun3.enemy))
782 instance.gun3.enemy.effects |=
EF_NODRAW;
785 instance.gun1.vehicle_exit(instance.gun1,
VHEF_EJECT);
788 instance.gun2.vehicle_exit(instance.gun2,
VHEF_EJECT);
805 _body.nextthink =
time;
807 _body.owner = instance;
808 _body.enemy = instance.enemy;
810 _body.angles = instance.angles;
821 instance.colormod =
'0 0 0';
822 instance.avelocity =
'0 0 0';
823 instance.velocity =
'0 0 0';
825 instance.nextthink = 0;
827 setorigin(instance, instance.pos1);
836 setmodel(instance.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD);
837 setattachment(instance.vehicle_shieldent, instance,
"");
838 setorigin(instance.vehicle_shieldent,
real_origin(instance) - instance.origin);
839 instance.vehicle_shieldent.scale = 512 /
vlen(instance.maxs - instance.mins);
841 instance.vehicle_shieldent.alpha = -1;
844 instance.gun1 =
new(vehicle_playerslot);
845 instance.gun2 =
new(vehicle_playerslot);
846 instance.gun3 =
new(bumblebee_raygun);
850 instance.gun1.owner = instance;
851 instance.gun2.owner = instance;
852 instance.gun3.owner = instance;
854 setmodel(instance.gun1, MDL_VEH_BUMBLEBEE_CANNON_RIGHT);
855 setmodel(instance.gun2, MDL_VEH_BUMBLEBEE_CANNON_LEFT);
856 setmodel(instance.gun3, MDL_VEH_BUMBLEBEE_CANNON_CENTER);
858 setattachment(instance.gun1, instance,
"cannon_right");
859 setattachment(instance.gun2, instance,
"cannon_left");
862 instance.gun3.pos1 = instance.angles;
863 instance.angles =
'0 0 0';
865 ofs -= instance.origin;
866 setattachment(instance.gun3, instance,
"");
867 setorigin(instance.gun3, ofs);
868 instance.angles = instance.gun3.pos1;
873 setorigin(instance.vehicle_hudmodel,
'50 0 -5');
874 setorigin(instance.vehicle_viewport,
'5 0 2');
877 setorigin(instance.gun1.vehicle_hudmodel,
'90 -27 -23');
878 setorigin(instance.gun1.vehicle_viewport,
'-85 0 50');
880 setorigin(instance.gun2.vehicle_hudmodel,
'90 27 -23');
881 setorigin(instance.gun2.vehicle_viewport,
'-85 0 50');
883 instance.scale = 1.5;
886 if(instance.gun3.enemy ==
NULL)
888 instance.gun3.enemy =
new(bumble_raygun);
890 instance.gun3.enemy.SendFlags =
BRG_SETUP;
903 instance.damageforcescale = 0.025;
907 setorigin(instance, instance.origin +
'0 0 25');
927 instance.max_health =
GetResource(instance, RES_HEALTH);
943 Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon,
"vehicle_bumble_weapon1",
"vehicle_bumble_weapon2",
948 float blinkValue = 0.55 +
sin(
time * 7) * 0.45;
985 PAR(_(
"The %s vehicle seats up to three passengers, who are given different roles based on the order they enter."),
COLORED_NAME(
this));
986 PAR(_(
"The first player to enter will be the pilot, flying the vehicle up into the skies. "
987 "The first player can also shoot a green healing wave to heal other teammates on the ground."));
988 PAR(_(
"The second player to enter is the right gunner and the third player to enter is the left gunner."));
989 PAR(_(
"When the pilot exits the vehicle, the players switch roles by moving up in position."));
ERASEABLE float anglemods(float v)
ERASEABLE float shortangle_f(float ang1, float ang2)
void antilag_clear(entity e, entity store)
#define MUTATOR_CALLHOOK(id,...)
#define MUTATOR_IS_ENABLED(this)
bool autocvar_g_vehicle_bumblebee_raygun
float autocvar_g_vehicle_bumblebee_cannon_lock
float autocvar_g_vehicle_bumblebee_health_regen
float autocvar_g_vehicle_bumblebee_raygun_turnspeed
float autocvar_g_vehicle_bumblebee_respawntime
bool bumblebee_gunner_enter(entity this, entity player)
float autocvar_g_vehicle_bumblebee_healgun_locktime
float autocvar_g_vehicle_bumblebee_shield_regen
float autocvar_g_vehicle_bumblebee_energy_regen
float autocvar_g_vehicle_bumblebee_pitchspeed
float autocvar_g_vehicle_bumblebee_healgun_sps
float autocvar_g_vehicle_bumblebee_healgun_hmax
void bumblebee_exit(entity this, int eject)
float autocvar_g_vehicle_bumblebee_blowup_forceintensity
float autocvar_g_vehicle_bumblebee_cannon_ammo_regen
float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out
void bumblebee_diethink(entity this)
float autocvar_g_vehicle_bumblebee_raygun_aps
void bumblebee_blowup(entity this)
bool vehicles_valid_pilot(entity this, entity toucher)
float autocvar_g_vehicle_bumblebee_cannon_ammo
bool bumblebee_gunner_frame(entity this, float dt)
float autocvar_g_vehicle_bumblebee_turnspeed
float autocvar_g_vehicle_bumblebee_blowup_edgedamage
bool bumblebee_pilot_frame(entity this, float dt)
float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down
float autocvar_g_vehicle_bumblebee_healgun_aps
float autocvar_g_vehicle_bumblebee_speed_strafe
float autocvar_g_vehicle_bumblebee_healgun_hps
float autocvar_g_vehicle_bumblebee_speed_forward
float autocvar_g_vehicle_bumblebee_raygun_range
float autocvar_g_vehicle_bumblebee_blowup_coredamage
float autocvar_g_vehicle_bumblebee_blowup_radius
float autocvar_g_vehicle_bumblebee_energy_regen_pause
float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause
void bumblebee_regen(entity this, float dt)
bool autocvar_g_vehicle_bumblebee
float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides
vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity player)
vector autocvar_g_vehicle_bumblebee_bouncepain
float autocvar_g_vehicle_bumblebee_healgun_amax
float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up
float autocvar_g_vehicle_bumblebee_raygun_fps
float autocvar_g_vehicle_bumblebee_health
void bumblebee_land(entity this)
void bumblebee_gunner_exit(entity this, int _exitflag)
float autocvar_g_vehicle_bumblebee_shield
float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in
float autocvar_g_vehicle_bumblebee_pitchlimit
void bumblebee_dead_touch(entity this, entity toucher)
float autocvar_g_vehicle_bumblebee_shield_regen_pause
float autocvar_g_vehicle_bumblebee_raygun_dps
bool autocvar_g_vehicle_bumblebee_swim
float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up
float autocvar_g_vehicle_bumblebee_friction
float autocvar_g_vehicle_bumblebee_cannon_turnspeed
void CSQC_BUMBLE_GUN_HUD()
float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down
float autocvar_g_vehicle_bumblebee_health_regen_pause
float autocvar_g_vehicle_bumblebee_energy
float autocvar_g_vehicle_bumblebee_speed_down
void bumblebee_touch(entity this, entity toucher)
float autocvar_g_vehicle_bumblebee_speed_up
void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner)
bool bumble_raygun_send(entity this, entity to, float sf)
float autocvar_g_vehicle_bumblebee_cannon_speed
float autocvar_g_vehicle_bumblebee_cannon_refire
float autocvar_g_vehicle_bumblebee_cannon_cost
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
void Vehicles_drawCrosshair(string crosshair)
void Vehicles_drawHUD(string vehicle, string vehicleWeapon1, string vehicleWeapon2, string iconAmmo1, vector colorAmmo1, string iconAmmo2, vector colorAmmo2)
vector autocvar_hud_progressbar_vehicles_ammo1_color
const string vCROSS_BURST
entity AuxiliaryXhair[MAX_AXH]
#define drawstring(position, text, scale, rgb, alpha, flag)
#define COLORED_NAME(this)
#define setmodel(this, m)
#define PHYS_INPUT_BUTTON_CROUCH(s)
#define PHYS_INPUT_BUTTON_JUMP(s)
#define PHYS_INPUT_FRAMETIME
#define PHYS_INPUT_BUTTON_ATCK(s)
#define PHYS_INPUT_BUTTON_ATCK2(s)
vector real_origin(entity ent)
vector findbetterlocation(vector org, float mindist)
const int HUD_BUMBLEBEE_GUN
const float DRAWFLAG_NORMAL
const float SOLID_SLIDEBOX
float DPCONTENTS_LIQUIDSMASK
#define CSQCMODEL_AUTOUPDATE(e)
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
bool Heal(entity targ, entity inflictor, float amount, float limit)
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
float autocvar_hud_panel_fg_alpha
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
void set_movetype(entity this, int mt)
const int MOVETYPE_BOUNCEMISSILE
#define UNSET_ONGROUND(s)
const int MOVETYPE_NOCLIP
#define METHOD(cname, name, prototype)
float health
Legacy fields for the resources. To be removed.
void RemoveGrapplingHooks(entity pl)
void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
#define sound(e, c, s, v, a)
ClientState CS(Client this)
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
int autocvar_g_instagib_extralives
void CSQCModel_UnlinkEntity(entity e)
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
void vehicles_touch(entity this, entity toucher)
void vehicles_regen(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
vector vehicles_findgoodexit(entity this, entity player, vector prefer_spot)
void shieldhit_think(entity this)
bool vehicle_addplayerslot(entity _owner, entity _slot, int _hud, Model _hud_model, bool(entity, float) _framefunc, void(entity, bool) _exitfunc, float(entity, entity) _enterfunc)
void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id)
void vehicles_think(entity this)
void vehicles_regen_resource(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale, Resource resource)
void CSQCVehicleSetup(entity own, int vehicle_id)
vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname, float _pichlimit_min, float _pichlimit_max, float _rotlimit_min, float _rotlimit_max, float _aimspeed, float dt)
void vehicles_frame(entity this, entity actor)
entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
const float vehicle_shield
If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehicle,...
const float vehicle_ammo1
If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehicle,...
const float SVC_SETVIEWANGLES
const float vehicle_health
const float vehicle_energy
If ent is player this is 0..100 indicating precentage of health left on vehicle. Vehicle's value is t...
const float SVC_SETVIEWPORT
const int VHEF_EJECT
User pressed exit key.
#define VEHICLE_UPDATE_PLAYER(ply, vehi, fld, vhname)
#define VEHICLE_UPDATE_PLAYER_RESOURCE(ply, vehi, fld, vhname, res)
entity vehicle
Entity to disply the shild effect on damage.
float autocvar_g_vehicles_allow_bots
const float vehicle_ammo2
If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehicle,...
const float vehicle_reload1
If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already st...
const int TELEPORT_NORMAL
void crosshair_trace(entity pl)
#define IS_REAL_CLIENT(v)
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
const int VHF_HASSHIELD
Indicates vehicle.
const int VHF_MULTISLOT
Add random head angles each frame if health < 50%.
const int VHF_HEALTHREGEN
Vehicles shield regenerates.
const int VHF_ENERGYREGEN
Vehicles health regenerates.
const int VHF_SHIELDREGEN
Vehicle has shileding.
float vehicle_altitude(entity this, float amax)
const int MAX_WEAPONSLOTS
entity weaponentities[MAX_WEAPONSLOTS]
bool weaponUseForbidden(entity player)
bool weaponLocked(entity player)