#include "raptor.qh"
+#if defined(SVQC)
+ #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
+#endif
+
+#ifdef GAMEQC
+
#ifdef SVQC
bool autocvar_g_vehicle_raptor = true;
setorigin(this, vehic.origin + '0 0 32');
this.oldorigin = this.origin; // negate fall damage
- this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
+ STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
vector vf, ad;
// Target lock & predict
vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
- autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
+ autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed, dt);
vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
- autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
+ autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed, dt);
/*
ad = ad * 0.5;
Weapon wep1 = WEP_RAPTOR;
.entity weaponentity = weaponentities[0];
- if(!forbidWeaponUse(this))
+ if(!weaponLocked(this) && !weaponUseForbidden(this))
if(PHYS_INPUT_BUTTON_ATCK(this))
if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
{
vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true);
if(vehic.vehicle_flags & VHF_HEALTHREGEN)
- vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false);
+ vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false, RES_HEALTH);
if(vehic.vehicle_flags & VHF_ENERGYREGEN)
vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt, false);
Weapon wep2a = WEP_RAPTOR_BOMB;
- if(!forbidWeaponUse(this))
- if(vehic.vehicle_weapon2mode == RSM_BOMB)
+ if(!weaponLocked(this) && !weaponUseForbidden(this))
+ if(STAT(VEHICLESTAT_W2MODE, vehic) == RSM_BOMB)
{
if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
if(PHYS_INPUT_BUTTON_ATCK2(this))
bool incoming = false;
IL_EACH(g_projectiles, it.enemy == vehic,
{
- if(MISSILE_IS_TRACKING(it))
+ if(it.missile_flags & MIF_GUIDED_TRACKING)
if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
{
incoming = true;
if(incoming)
{
msg_entity = this;
- soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
+ soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE, 0);
}
vehic.bomb1.cnt = time + 1;
}
- VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
+ VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH);
VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
if(vehic.vehicle_flags & VHF_HASSHIELD)
VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
// Takeoff sequense
if(vehic.frame < 25)
{
- vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / PHYS_INPUT_FRAMETIME);
+ vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / dt);
vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
else
this.PlayerPhysplug = raptor_frame;
- this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
+ STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
if(vehic.vehicle_flags & VHF_SHIELDREGEN)
vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true);
if(vehic.vehicle_flags & VHF_HEALTHREGEN)
- vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false);
+ vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false, RES_HEALTH);
if(vehic.vehicle_flags & VHF_ENERGYREGEN)
vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt, false);
this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
- VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
+ VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH);
VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
if(vehic.vehicle_flags & VHF_HASSHIELD)
VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
{
this.deadflag = DEAD_DEAD;
this.vehicle_exit(this, VHEF_NORMAL);
- RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL);
+ RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, DMG_NOWEP, NULL);
this.alpha = -1;
set_movetype(this, MOVETYPE_NONE);
switch(_imp)
{
case IMP_weapon_group_1.impulse:
- this.vehicle.vehicle_weapon2mode = RSM_BOMB;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_BOMB;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_group_2.impulse:
- this.vehicle.vehicle_weapon2mode = RSM_FLARE;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_FLARE;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_next_byid.impulse:
case IMP_weapon_next_bypriority.impulse:
case IMP_weapon_next_bygroup.impulse:
- this.vehicle.vehicle_weapon2mode += 1;
- if(this.vehicle.vehicle_weapon2mode > RSM_LAST)
- this.vehicle.vehicle_weapon2mode = RSM_FIRST;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) += 1;
+ if(STAT(VEHICLESTAT_W2MODE, this.vehicle) > RSM_LAST)
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_FIRST;
CSQCVehicleSetup(this, 0);
return true;
case IMP_weapon_prev_byid.impulse:
case IMP_weapon_prev_bypriority.impulse:
case IMP_weapon_prev_bygroup.impulse:
- this.vehicle.vehicle_weapon2mode -= 1;
- if(this.vehicle.vehicle_weapon2mode < RSM_FIRST)
- this.vehicle.vehicle_weapon2mode = RSM_LAST;
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) -= 1;
+ if(STAT(VEHICLESTAT_W2MODE, this.vehicle) < RSM_FIRST)
+ STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_LAST;
CSQCVehicleSetup(this, 0);
return true;
}
METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
{
- instance.vehicle_weapon2mode = RSM_BOMB;
+ STAT(VEHICLESTAT_W2MODE, instance) = RSM_BOMB;
instance.owner.PlayerPhysplug = raptor_takeoff;
set_movetype(instance, MOVETYPE_BOUNCEMISSILE);
instance.solid = SOLID_SLIDEBOX;
- instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
+ instance.owner.vehicle_health = (GetResource(instance, RES_HEALTH) / autocvar_g_vehicle_raptor_health) * 100;
instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
instance.velocity = '0 0 1'; // nudge upwards so takeoff sequence can work
instance.tur_head.exteriormodeltoclient = instance.owner;
}
METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
{
- instance.health = 0;
+ SetResourceExplicit(instance, RES_HEALTH, 0);
instance.event_damage = func_null;
instance.solid = SOLID_CORPSE;
instance.takedamage = DAMAGE_NO;
}
instance.frame = 0;
- instance.vehicle_health = autocvar_g_vehicle_raptor_health;
+ SetResourceExplicit(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health);
instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
set_movetype(instance, MOVETYPE_TOSS);
instance.solid = SOLID_SLIDEBOX;
instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
instance.damageforcescale = 0.25;
- instance.vehicle_health = autocvar_g_vehicle_raptor_health;
+ SetResourceExplicit(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health);
instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
}
METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
instance.vehicle_exit = raptor_exit;
instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
- instance.vehicle_health = autocvar_g_vehicle_raptor_health;
+ SetResourceExplicit(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health);
instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
- instance.max_health = instance.vehicle_health;
+ instance.max_health = GetResource(instance, RES_HEALTH);
if(!autocvar_g_vehicle_raptor_swim)
instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
if(!dropmark)
{
- dropmark = spawn();
+ dropmark = new(raptor_dropmark);
dropmark.owner = player;
dropmark.gravity = 1;
dropmark.dphitcontentsmask = DPCONTENTS_SOLID;
}
#endif
+
+#endif