38 entity axh = e.(AuxiliaryXhair[this.
cnt]);
39 return axh.owner == this.
owner;
51 entity axh = own.(AuxiliaryXhair[axh_id]);
53 if (axh ==
NULL || wasfreed(axh))
55 axh =
new(auxiliary_xhair);
63 if (loc != axh.axh_prevorigin)
69 if (clr != axh.axh_prevcolors)
75 own.(AuxiliaryXhair[axh_id]) = axh;
88 if (vehicle_id == 0 || vehicle_id ==
HUD_NORMAL)
89 for (
int i = 0; i <
MAX_AXH; ++i)
91 entity axh = own.(AuxiliaryXhair[i]);
92 own.(AuxiliaryXhair[i]) =
NULL;
94 if (axh.owner == own && axh !=
NULL && !wasfreed(axh))
168 if (inflictor.owner ==
this.owner)
223 float _dmg,
float _radi,
float _force,
float _size,
224 int _deahtype,
float _projtype,
float _health,
225 bool _cull,
bool _clianim,
entity _owner)
231 setorigin(proj, _org);
233 proj.shot_dmg = _dmg;
234 proj.shot_radius = _radi;
235 proj.shot_force = _force;
236 proj.projectiledeathtype = _deahtype;
242 proj.bot_dodge =
true;
243 proj.bot_dodgerating = _dmg;
244 proj.velocity = _vel;
248 proj.realowner = _owner;
250 proj.nextthink =
time + 30;
261 if (_mzlsound != SND_Null)
264 if (_mzlfx != EFFECT_Null)
265 Send_Effect(_mzlfx, proj.origin, proj.velocity, 1);
267 setsize(proj,
'-1 -1 -1' * _size,
'1 1 1' * _size);
278 Send_Effect(EFFECT_EXPLOSION_SMALL, this.
wp00.origin +
'0 0 64',
'0 0 0', 1);
298 entity _gib =
new(vehicle_gib);
299 _setmodel(_gib, _template.model);
301 setorigin(_gib,
org);
302 _gib.velocity = _vel;
305 _gib.colormod =
'-0.5 -0.5 -0.5';
307 _gib.avelocity = _rot;
320 _gib.cnt =
time + _maxtime;
322 _gib.nextthink =
time + _maxtime - 1;
331 bool(
entity,
float) _framefunc,
337 _slot.PlayerPhysplug = _framefunc;
338 _slot.vehicle_exit = _exitfunc;
339 _slot.vehicle_enter = _enterfunc;
340 STAT(HUD, _slot) = _hud;
344 _slot.vehicle_hudmodel.viewmodelforclient = _slot;
347 setmodel(_slot.vehicle_hudmodel, _hud_model);
348 setmodel(_slot.vehicle_viewport, MDL_Null);
350 setattachment(_slot.vehicle_hudmodel, _slot,
"");
351 setattachment(_slot.vehicle_viewport, _slot.vehicle_hudmodel,
"");
357 float _pichlimit_min,
float _pichlimit_max,
358 float _rotlimit_min,
float _rotlimit_max,
float _aimspeed,
float dt)
364 float ftmp = _aimspeed * dt;
365 vtmp.y =
bound(-ftmp, vtmp.y, ftmp);
366 vtmp.x =
bound(-ftmp, vtmp.x, ftmp);
367 _turrret.angles.y =
bound(_rotlimit_min, _turrret.angles.y + vtmp.y, _rotlimit_max);
368 _turrret.angles.x =
bound(_pichlimit_min, _turrret.angles.x + vtmp.x, _pichlimit_max);
374 const vector cmod =
'0 0 0';
377 cmap = 1024 + (this.
team - 1) * 17;
379 cmap = player.colormap;
432 setthink(it, SUB_Remove);
433 it.nextthink = time + 0.1;
434 IL_REMOVE(g_vehicle_returners, it);
436 if (it.waypointsprite_attached)
437 WaypointSprite_Kill(it.waypointsprite_attached);
470 ent.nextthink = ent.cnt;
475 ent.nextthink =
time + 1;
478 ent.team = this.
wp00.team;
479 ent.wp00 = this.
wp00;
480 setorigin(ent, this.
wp00.pos1);
482 ent.nextthink =
time + 5;
489 entity wp =
WaypointSprite_Spawn(WP_Vehicle, 0, 0, ent,
'0 0 64',
NULL, 0, ent,
waypointsprite_attached,
true, RADARICON_Vehicle);
490 wp.wp_extra = ent.wp00.vehicleid;
492 if (ent.waypointsprite_attached)
505 entity ret =
new(vehicle_return);
513 ret.cnt =
time + veh.respawntime;
514 ret.nextthink =
min(
time + veh.respawntime,
time + veh.respawntime - 5);
517 ret.nextthink =
min(
time + veh.respawntime,
time + veh.respawntime - 1);
519 setorigin(ret, veh.pos1 +
'0 0 96');
549void vehicles_regen(
entity this,
float timer, .
float regen_field,
float field_max,
float rpause,
float regen,
float delta_time,
float _healthscale)
551 if (this.(regen_field) < field_max
557 this.(regen_field) =
min(this.(regen_field) + regen * delta_time, field_max);
560 this.
owner.(regen_field) = (this.(regen_field) / field_max) * 100;
566 float resource_amount =
GetResource(
this, resource);
568 if (resource_amount < field_max
574 SetResource(
this, resource,
min(resource_amount + regen * delta_time, field_max));
597 ? this.
owner.vehicle_health
637 this.
enemy = attacker;
710 float true_limit = (limit !=
RES_LIMIT_NONE) ? limit : targ.max_health;
717 targ.owner.vehicle_health = (
GetResource(targ, RES_HEALTH) / targ.max_health) * 100;
777 entity player = vehic.owner;
781 LOG_TRACE(
"^1vehicles_exit already running! this is not good...");
789 vehic.vehicle_exit(vehic, eject);
816 player.vehicle =
NULL;
817 player.view_ofs =
STAT(PL_VIEW_OFS, player);
823 player.(weaponentity).
m_switchweapon = vehic.(weaponentity).m_switchweapon;
824 delete(vehic.(weaponentity));
826 player.last_vehiclecheck =
time + 3;
827 player.vehicle_enter_delay =
time + 2;
828 setsize(player,
STAT(PL_MIN, player),
STAT(PL_MAX, player));
839 vehic.avelocity =
'0 0 0';
841 vehic.tur_head.nodrawtoclient =
NULL;
850 vehic.team = vehic.tur_head.team;
854 vehic.old_vehicle_flags = 0;
857 vehic.vehicle_hudmodel.viewmodelforclient = vehic;
858 vehic.phase =
time + 1;
860 vehic.vehicle_exit(vehic, eject);
869 player.oldorigin = player.origin;
908 if (!autocvar_g_vehicles_enter)
919 if (f && f(
this,
imp))
924 case IMP_weapon_drop.impulse:
925 stuffcmd(
this,
"\ntoggle cl_eventchase_vehicle\nset _vehicles_shownchasemessage 1\n");
940 || pl.vehicle_enter_delay >=
time
948 if (autocvar_g_vehicles_enter
962 if (autocvar_g_vehicles_steal)
968 veh.vehicle_shield = 0;
969 veh.old_vehicle_flags = veh.vehicle_flags;
972 if (autocvar_g_vehicles_steal_show_waypoint)
974 entity wp =
WaypointSprite_Spawn(WP_VehicleIntruder, 0, 0, pl,
'0 0 68',
NULL, veh.team, veh,
wps_intruder,
true, RADARICON_DANGER);
983 veh.vehicle_ammo1 = 0;
984 veh.vehicle_ammo2 = 0;
985 veh.vehicle_reload1 = 0;
986 veh.vehicle_reload2 = 0;
987 veh.vehicle_energy = 0;
995 veh.vehicle_hudmodel.viewmodelforclient = pl;
998 pl.view_ofs =
STAT(PL_VIEW_OFS, pl);
999 setsize(pl,
STAT(PL_MIN, pl),
STAT(PL_MAX, pl));
1005 pl.angles = veh.angles;
1008 pl.disableclientprediction = 1;
1010 pl.teleportable =
false;
1013 pl.view_ofs =
'0 0 0';
1014 veh.colormap = pl.colormap;
1016 veh.tur_head.colormap = pl.colormap;
1020 veh.(weaponentity) =
new(temp_wepent);
1021 veh.(weaponentity).
m_switchweapon = pl.(weaponentity).m_switchweapon;
1023 STAT(HUD, pl) = veh.vehicleid;
1024 pl.PlayerPhysplug = veh.PlayerPhysplug;
1026 pl.vehicle_ammo1 = veh.vehicle_ammo1;
1027 pl.vehicle_ammo2 = veh.vehicle_ammo2;
1028 pl.vehicle_reload1 = veh.vehicle_reload1;
1029 pl.vehicle_reload2 = veh.vehicle_reload2;
1030 pl.vehicle_energy = veh.vehicle_energy;
1085 STAT(VEHICLESTAT_W2MODE, this.
owner) =
STAT(VEHICLESTAT_W2MODE,
this);
1142 setorigin(
this, this.
pos1);
1154 if (it.(weaponentity).hook.aiment ==
this)
1161 info.vr_spawn(info,
this);
1183 LOG_DEBUG(
"^1WARNING: ^7Vehicle with invalid .targetname");
1203 if (this.
team && (!
teamplay || !autocvar_g_vehicles_teams))
1206 if (this.
mdl ==
"" || !this.
mdl)
1207 _setmodel(
this, info.
model);
1209 _setmodel(
this, this.
mdl);
1226 this.PlayerPhysplug = info.PlayerPhysplug;
1250 setattachment(this.
tur_head,
this, info.tag_head);
1256 setattachment(this.
tur_head,
this,
"");
1267 setorigin(
this, this.
origin);
void antilag_clear(entity e, entity store)
IntrusiveList g_bot_targets
IntrusiveList g_bot_dodge
#define MUTATOR_CALLHOOK(id,...)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
virtual void vr_gunner_enter()
(SERVER) called when a player enters this vehicle while occupied
string hud_model
cockpit model
string head_model
full name of tur_head model
vector m_mins
vehicle hitbox size
string model
full name of model
virtual void vr_precache()
(BOTH) precaches models/sounds used by this vehicle
virtual void vr_impact()
(SERVER) called when a vehicle hits something
virtual void vr_think()
(SERVER) logic to run every frame
virtual void vr_enter()
(SERVER) called when a player enters this vehicle
virtual void vr_setup()
(BOTH) setup vehicle data
virtual void vr_death()
(SERVER) called when vehicle dies
vector m_maxs
vehicle hitbox size
virtual void vr_setcolors()
(SERVER) called when a vehicle's colors are being reset, so modules can be updated
const int IT_USING_JETPACK
#define setmodel(this, m)
vector real_origin(entity ent)
const vector PL_MIN_CONST
const vector PL_MAX_CONST
const float SOLID_SLIDEBOX
const float EF_FULLBRIGHT
float DPCONTENTS_PLAYERCLIP
float trace_dphitq3surfaceflags
const float EF_NODEPTHTEST
const float EF_SELECTABLE
float Q3SURFACEFLAG_NOIMPACT
const int EF_TELEPORT_BIT
#define CSQCMODEL_AUTOUPDATE(e)
#define CSQCMODEL_AUTOINIT(e)
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
IntrusiveList g_damagedbycontents
#define DEATH_ISWEAPON(t, w)
#define DEATH_WEAPONOF(t)
void SUB_Remove(entity this)
Remove entity.
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
#define FOREACH_ENTITY_ENT(fld, match, body)
#define WriteHeader(to, id)
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_FLYMISSILE
#define UNSET_ONGROUND(s)
const int MOVETYPE_NOCLIP
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
void Kill_Notification(NOTIF broadcast, entity client, MSG net_type, CPID net_cpid)
bool autocvar_g_fullbrightplayers
bool autocvar_g_playerclip_collisions
bool autocvar_g_nodepthtestplayers
void RemoveHook(entity this)
void RemoveGrapplingHooks(entity pl)
void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
#define PROJECTILE_TOUCH(e, t)
IntrusiveList g_projectiles
#define PROJECTILE_MAKETRIGGER(e)
const int CH_TRIGGER_SINGLE
#define sound(e, c, s, v, a)
void play2(entity e, string filename)
float spamsound(entity e, int chan, Sound samp, float vol, float _atten)
use this one if you might be causing spam (e.g.
bool sound_allowed(int to, entity e)
ClientState CS(Client this)
bool StatusEffects_active(StatusEffect this, entity actor)
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_enter(entity pl, entity veh)
void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
void vehicles_showwp_goaway(entity this)
void vehicles_reset_colors(entity this, entity player)
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
void vehicles_setreturn(entity veh)
void vehicles_touch(entity this, entity toucher)
entity vehicles_projectile(entity this, entity _mzlfx, Sound _mzlsound, vector _org, vector _vel, float _dmg, float _radi, float _force, float _size, int _deahtype, float _projtype, float _health, bool _cull, bool _clianim, entity _owner)
void vehicles_exit(entity vehic, bool eject)
void vehicle_use(entity this, entity actor, entity trigger)
void vehicles_regen(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
void vehicles_reset(entity this)
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_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
bool AuxiliaryXhair_customize(entity this, entity client)
bool vehicle_impulse(entity this, int imp)
void vehicles_projectile_explode(entity this, entity toucher)
bool SendAuxiliaryXhair(entity this, entity to, int sf)
bool vehicles_heal(entity targ, entity inflictor, float amount, float limit)
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 vehicles_painframe(entity this)
void vehicles_gib_explode(entity this)
void vehicles_spawn(entity this)
void CSQCVehicleSetup(entity own, int vehicle_id)
void vehicles_return(entity this)
bool vehicles_crushable(entity e)
void vehicles_projectile_explode_think(entity this)
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_gib_touch(entity this, entity toucher)
void vehicles_clearreturn(entity veh)
void vehicles_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void vehicles_showwp(entity this)
void vehicles_projectile_explode_use(entity this, entity actor, entity trigger)
void vehicles_frame(entity this, entity actor)
void vehicles_gib_think(entity this)
entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
void vehicles_locktarget(entity this, float incr, float decr, float _lock_time)
const float vehicle_shield
If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehicle,...
const float SVC_SETVIEWANGLES
float autocvar_g_vehicles_delayspawn_jitter
float autocvar_g_vehicles_vaporizer_damagerate
const float SVC_SETVIEWPORT
const int VHEF_EJECT
User pressed exit key 3 times fast (not implemented) or vehicle is dying.
bool autocvar_g_vehicles_delayspawn
float vehicles_exit_running
const int VHEF_RELEASE
Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (n...
float autocvar_g_vehicles_weapon_damagerate
entity vehicle_controller
float autocvar_g_vehicles_crush_force
float autocvar_g_vehicles_crush_minspeed
float autocvar_g_vehicles_allow_bots
float autocvar_g_vehicles_machinegun_damagerate
float autocvar_g_vehicles_tag_damagerate
int autocvar_g_vehicles_exit_attempts
float autocvar_g_vehicles_thinkrate
float autocvar_g_vehicles_rifle_damagerate
IntrusiveList g_vehicle_returners
float autocvar_g_vehicles_vortex_damagerate
entity vehicle_shieldent
Entity to disply the shild effect on damage.
float autocvar_g_vehicles_crush_dmg
vector Team_ColorRGB(int teamid)
const int TELEPORT_NORMAL
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
#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_PLAYERSLOT
This ent is a player slot on a multi-person vehicle.
const int VHF_HASSHIELD
Vehicle has shileding.
const int VHF_MULTISLOT
Vehicle has multiple player slots.
const int VHF_DMGSHAKE
Add random velocity each frame if health < 50%.
const int VHF_DMGHEADROLL
Add random head angles each frame if health < 50%.
const int VHF_ISVEHICLE
Indicates vehicle.
const int VHF_SHIELDREGEN
Vehicles shield regenerates.
const int VHF_DEATHEJECT
Vehicle ejects pilot upon fatal damage.
const int VHF_DMGROLL
Add random angles each frame if health < 50%.
void WaypointSprite_Kill(entity wp)
void WaypointSprite_Ping(entity e)
entity WaypointSprite_Spawn(entity spr, float _lifetime, float maxdistance, entity ref, vector ofs, entity showto, float t, entity own,.entity ownfield, float hideable, entity icon)
entity WaypointSprite_getviewentity(entity e)
void WaypointSprite_UpdateBuildFinished(entity e, float f)
void WaypointSprite_UpdateRule(entity e, float t, float r)
const int SPRITERULE_DEFAULT
entity waypointsprite_attached
const int MAX_WEAPONSLOTS
entity weaponentities[MAX_WEAPONSLOTS]
bool weaponLocked(entity player)
float default_player_alpha