40 entity axh = e.(AuxiliaryXhair[this.
cnt]);
41 return axh.owner == this.
owner;
53 entity axh = own.(AuxiliaryXhair[axh_id]);
55 if(axh ==
NULL || wasfreed(axh))
57 axh =
new(auxiliary_xhair);
65 if(loc != axh.axh_prevorigin)
71 if(clr != axh.axh_prevcolors)
77 own.(AuxiliaryXhair[axh_id]) = axh;
90 if(vehicle_id == 0 || vehicle_id ==
HUD_NORMAL)
92 for(
int i = 0; i <
MAX_AXH; ++i)
94 entity axh = own.(AuxiliaryXhair[i]);
95 own.(AuxiliaryXhair[i]) =
NULL;
97 if(axh.owner == own && axh !=
NULL && !wasfreed(axh))
180 if(inflictor.owner ==
this.owner)
208 RadiusDamage (
this, this.
realowner, this.shot_dmg, 0, this.shot_radius,
this,
NULL, this.shot_force, this.
projectiledeathtype,
DMG_NOWEP,
toucher);
225 float _dmg,
float _radi,
float _force,
float _size,
226 int _deahtype,
float _projtype,
float _health,
227 bool _cull,
bool _clianim,
entity _owner)
233 setorigin(proj, _org);
235 proj.shot_dmg = _dmg;
236 proj.shot_radius = _radi;
237 proj.shot_force = _force;
238 proj.projectiledeathtype = _deahtype;
244 proj.bot_dodge =
true;
245 proj.bot_dodgerating = _dmg;
246 proj.velocity = _vel;
250 proj.realowner = _owner;
252 proj.nextthink =
time + 30;
263 if(_mzlsound != SND_Null)
266 if(_mzlfx != EFFECT_Null)
267 Send_Effect(_mzlfx, proj.origin, proj.velocity, 1);
269 setsize (proj,
'-1 -1 -1' * _size,
'1 1 1' * _size);
280 Send_Effect(EFFECT_EXPLOSION_SMALL, this.
wp00.origin +
'0 0 64',
'0 0 0', 1);
300 entity _gib =
new(vehicle_gib);
301 _setmodel(_gib, _template.model);
303 setorigin(_gib,
org);
304 _gib.velocity = _vel;
307 _gib.colormod =
'-0.5 -0.5 -0.5';
309 _gib.avelocity = _rot;
322 _gib.cnt =
time + _maxtime;
324 _gib.nextthink =
time + _maxtime - 1;
334 bool(
entity,
float) _framefunc,
340 _slot.PlayerPhysplug = _framefunc;
341 _slot.vehicle_exit = _exitfunc;
342 _slot.vehicle_enter = _enterfunc;
343 STAT(HUD, _slot) = _hud;
347 _slot.vehicle_hudmodel.viewmodelforclient = _slot;
350 setmodel(_slot.vehicle_hudmodel, _hud_model);
351 setmodel(_slot.vehicle_viewport, MDL_Null);
353 setattachment(_slot.vehicle_hudmodel, _slot,
"");
354 setattachment(_slot.vehicle_viewport, _slot.vehicle_hudmodel,
"");
360 float _pichlimit_min,
float _pichlimit_max,
361 float _rotlimit_min,
float _rotlimit_max,
float _aimspeed,
float dt)
369 ftmp = _aimspeed * dt;
370 vtmp_y =
bound(-ftmp, vtmp_y, ftmp);
371 vtmp_x =
bound(-ftmp, vtmp_x, ftmp);
372 _turrret.angles_y =
bound(_rotlimit_min, _turrret.angles_y + vtmp_y, _rotlimit_max);
373 _turrret.angles_x =
bound(_pichlimit_min, _turrret.angles_x + vtmp_x, _pichlimit_max);
380 const vector cmod =
'0 0 0';
382 cmap = 1024 + (this.
team - 1) * 17;
384 cmap = player.colormap;
436 setthink(it, SUB_Remove);
437 it.nextthink = time + 0.1;
438 IL_REMOVE(g_vehicle_returners, it);
440 if(it.waypointsprite_attached)
441 WaypointSprite_Kill(it.waypointsprite_attached);
474 ent.nextthink = ent.cnt;
479 ent.nextthink =
time + 1;
482 ent.team = this.
wp00.team;
483 ent.wp00 = this.
wp00;
484 setorigin(ent, this.
wp00.pos1);
486 ent.nextthink =
time + 5;
495 entity wp =
WaypointSprite_Spawn(WP_Vehicle, 0, 0, ent,
'0 0 64',
NULL, 0, ent,
waypointsprite_attached,
true, RADARICON_Vehicle);
496 wp.wp_extra = ent.wp00.vehicleid;
498 if(ent.waypointsprite_attached)
511 entity ret =
new(vehicle_return);
519 ret.cnt =
time + veh.respawntime;
520 ret.nextthink =
min(
time + veh.respawntime,
time + veh.respawntime - 5);
524 ret.nextthink =
min(
time + veh.respawntime,
time + veh.respawntime - 1);
527 setorigin(ret, veh.pos1 +
'0 0 96');
557void vehicles_regen(
entity this,
float timer, .
float regen_field,
float field_max,
float rpause,
float regen,
float delta_time,
float _healthscale)
559 if(this.(regen_field) < field_max)
565 this.(regen_field) =
min(this.(regen_field) + regen * delta_time, field_max);
568 this.
owner.(regen_field) = (this.(regen_field) / field_max) * 100;
574 float resource_amount =
GetResource(
this, resource);
576 if(resource_amount < field_max)
580 regen = regen * (resource_amount / this.
max_health);
582 SetResource(
this, resource,
min(resource_amount + regen * delta_time, field_max));
651 this.
enemy = attacker;
725 float true_limit = ((limit !=
RES_LIMIT_NONE) ? limit : targ.max_health);
731 targ.owner.vehicle_health = (
GetResource(targ, RES_HEALTH) / targ.max_health) * 100;
756 float take =
min(_speedfac * wc, _maxpain);
790 entity player = vehic.owner;
794 LOG_TRACE(
"^1vehicles_exit already running! this is not good...");
802 vehic.vehicle_exit(vehic, eject);
829 player.vehicle =
NULL;
830 player.view_ofs =
STAT(PL_VIEW_OFS, player);
836 player.(weaponentity).
m_switchweapon = vehic.(weaponentity).m_switchweapon;
837 delete(vehic.(weaponentity));
839 player.last_vehiclecheck =
time + 3;
840 player.vehicle_enter_delay =
time + 2;
841 setsize(player,
STAT(PL_MIN, player),
STAT(PL_MAX, player));
852 vehic.avelocity =
'0 0 0';
854 vehic.tur_head.nodrawtoclient =
NULL;
863 vehic.team = vehic.tur_head.team;
867 vehic.old_vehicle_flags = 0;
870 vehic.vehicle_hudmodel.viewmodelforclient = vehic;
871 vehic.phase =
time + 1;
873 vehic.vehicle_exit(vehic, eject);
882 player.oldorigin = player.origin;
896 if((this.origin_z + this.maxs_z) > (
toucher.origin_z))
914 if(autocvar_g_vehicles_enter)
923 if (!v)
return false;
926 if (f && f(
this,
imp))
return true;
929 case IMP_weapon_drop.impulse:
931 stuffcmd(
this,
"\ntoggle cl_eventchase_vehicle\nset _vehicles_shownchasemessage 1\n");
946 || (veh.phase >=
time)
947 || (pl.vehicle_enter_delay >=
time)
955 if(autocvar_g_vehicles_enter)
970 if(autocvar_g_vehicles_steal)
976 veh.vehicle_shield = 0;
977 veh.old_vehicle_flags = veh.vehicle_flags;
980 if (autocvar_g_vehicles_steal_show_waypoint) {
981 entity wp =
WaypointSprite_Spawn(WP_VehicleIntruder, 0, 0, pl,
'0 0 68',
NULL, veh.team, veh,
wps_intruder,
true, RADARICON_DANGER);
989 veh.vehicle_ammo1 = 0;
990 veh.vehicle_ammo2 = 0;
991 veh.vehicle_reload1 = 0;
992 veh.vehicle_reload2 = 0;
993 veh.vehicle_energy = 0;
1001 veh.vehicle_hudmodel.viewmodelforclient = pl;
1004 pl.view_ofs =
STAT(PL_VIEW_OFS, pl);
1005 setsize(pl,
STAT(PL_MIN, pl),
STAT(PL_MAX, pl));
1011 pl.angles = veh.angles;
1014 pl.disableclientprediction = 1;
1016 pl.teleportable =
false;
1019 pl.view_ofs =
'0 0 0';
1020 veh.colormap = pl.colormap;
1022 veh.tur_head.colormap = pl.colormap;
1026 veh.(weaponentity) =
new(temp_wepent);
1027 veh.(weaponentity).
m_switchweapon = pl.(weaponentity).m_switchweapon;
1029 STAT(HUD, pl) = veh.vehicleid;
1030 pl.PlayerPhysplug = veh.PlayerPhysplug;
1032 pl.vehicle_ammo1 = veh.vehicle_ammo1;
1033 pl.vehicle_ammo2 = veh.vehicle_ammo2;
1034 pl.vehicle_reload1 = veh.vehicle_reload1;
1035 pl.vehicle_reload2 = veh.vehicle_reload2;
1036 pl.vehicle_energy = veh.vehicle_energy;
1091 STAT(VEHICLESTAT_W2MODE, this.
owner) =
STAT(VEHICLESTAT_W2MODE,
this);
1148 setorigin(
this, this.
pos1);
1160 if(it.(weaponentity).hook.aiment ==
this)
1167 info.vr_spawn(info,
this);
1190 LOG_DEBUG(
"^1WARNING: ^7Vehicle with invalid .targetname");
1209 if(this.
team && (!
teamplay || !autocvar_g_vehicles_teams))
1212 if(this.
mdl ==
"" || !this.
mdl)
1213 _setmodel(
this, info.
model);
1215 _setmodel(
this, this.
mdl);
1232 this.PlayerPhysplug = info.PlayerPhysplug;
1256 setattachment(this.
tur_head,
this, info.tag_head);
1262 setattachment(this.
tur_head,
this,
"");
1273 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 energy 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.
bool autocvar_g_vehicles_delayspawn
float vehicles_exit_running
Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (n...
const int VHEF_RELEASE
User pressed exit key 3 times fast (not implemented) or vehicle is dying.
float autocvar_g_vehicles_weapon_damagerate
entity vehicle_controller
float autocvar_g_vehicles_crush_force
float autocvar_g_vehicles_crush_minspeed
entity vehicle
Entity to disply the shild effect on damage.
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
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
Vehicle has multiple player slots.
const int VHF_HASSHIELD
Indicates vehicle.
const int VHF_MULTISLOT
Add random head angles each frame if health < 50%.
const int VHF_DMGSHAKE
Vehicle is airborn.
const int VHF_DMGHEADROLL
Add random angles each frame if health < 50%.
const int VHF_SHIELDREGEN
Vehicle has shileding.
const int VHF_DEATHEJECT
Vehicles energy regenerates.
const int VHF_DMGROLL
Add random velocity 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