]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/vehicle/bumblebee.qc
Merge branch 'master' into terencehill/hud_shake_fix
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicle / bumblebee.qc
index daa2865d406e18b3bbbf3f17c6ad71aae1ec1ad0..401483735ca409394d38a72173430a55262f8430 100644 (file)
@@ -135,7 +135,7 @@ bool bumblebee_gunner_frame(entity this)
        if(autocvar_g_vehicle_bumblebee_cannon_lock)
        {
                if(gun.lock_time < time)
-                       gun.enemy = world;
+                       gun.enemy = NULL;
 
                if(trace_ent)
                        if(trace_ent.movetype)
@@ -235,8 +235,8 @@ vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity p
 
 void bumblebee_gunner_exit(entity this, int _exitflag)
 {
-       entity player = this;
-       entity gunner = player.vehicle;
+       entity player = ((this.owner.gun1 == this) ? this.owner.gunner1 : this.owner.gunner2);
+       entity gunner = this;
        entity vehic = gunner.owner;
 
        if(IS_REAL_CLIENT(player))
@@ -269,8 +269,8 @@ void bumblebee_gunner_exit(entity this, int _exitflag)
 
        fixedmakevectors(vehic.angles);
 
-       if(player == vehic.gunner1) { vehic.gunner1 = world; }
-       if(player == vehic.gunner2) { vehic.gunner2 = world; v_right *= -1; }
+       if(player == vehic.gunner1) { vehic.gunner1 = NULL; }
+       if(player == vehic.gunner2) { vehic.gunner2 = NULL; v_right *= -1; }
 
        vector spot = real_origin(gunner);
        spot = spot + v_up * 128 + v_forward * 300 + v_right * 150;
@@ -286,13 +286,13 @@ void bumblebee_gunner_exit(entity this, int _exitflag)
 
        MUTATOR_CALLHOOK(VehicleExit, player, gunner);
 
-       player.vehicle = world;
+       player.vehicle = NULL;
 }
 
 bool bumblebee_gunner_enter(entity this, entity player)
 {
        entity vehic = this;
-       entity gunner = world;
+       entity gunner = NULL;
 
        if(!vehic.gunner1 && !vehic.gunner2 && ((time >= vehic.gun1.phase) + (time >= vehic.gun2.phase)) == 2)
        {
@@ -373,7 +373,7 @@ void bumblebee_touch(entity this)
 {
        if(autocvar_g_vehicles_enter) { return; }
 
-       if(this.gunner1 != world && this.gunner2 != world)
+       if(this.gunner1 != NULL && this.gunner2 != NULL)
        {
                vehicles_touch(this);
                return;
@@ -505,7 +505,7 @@ bool bumblebee_pilot_frame(entity this)
        if(autocvar_g_vehicle_bumblebee_healgun_locktime)
        {
                if(vehic.tur_head.lock_time < time || IS_DEAD(vehic.tur_head.enemy) || STAT(FROZEN, vehic.tur_head.enemy))
-                       vehic.tur_head.enemy = world;
+                       vehic.tur_head.enemy = NULL;
 
                if(trace_ent)
                if(trace_ent.movetype)
@@ -604,7 +604,7 @@ bool bumblebee_pilot_frame(entity this)
                if(vehic.gun3.enemy)
                        remove(vehic.gun3.enemy);
 
-               vehic.gun3.enemy = world;
+               vehic.gun3.enemy = NULL;
        }
        */
 
@@ -630,16 +630,16 @@ void bumblebee_land(entity this)
        float hgt;
 
        hgt = raptor_altitude(this, 512);
-       self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
-       self.angles_x *= 0.95;
-       self.angles_z *= 0.95;
+       this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
+       this.angles_x *= 0.95;
+       this.angles_z *= 0.95;
 
        if(hgt < 16)
-               setthink(self, vehicles_think);
+               setthink(this, vehicles_think);
 
-       self.nextthink = time;
+       this.nextthink = time;
 
-       CSQCMODEL_AUTOUPDATE(self);
+       CSQCMODEL_AUTOUPDATE(this);
 }
 
 void bumblebee_exit(entity this, int eject)
@@ -681,38 +681,38 @@ void bumblebee_exit(entity this, int eject)
        setorigin(this.owner, spot);
 
        antilag_clear(this.owner, CS(this.owner));
-       this.owner = world;
+       this.owner = NULL;
 }
 
 void bumblebee_blowup(entity this)
 {
-       RadiusDamage(self, self.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage,
+       RadiusDamage(this, this.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage,
                                 autocvar_g_vehicle_bumblebee_blowup_edgedamage,
-                                autocvar_g_vehicle_bumblebee_blowup_radius, self, world,
+                                autocvar_g_vehicle_bumblebee_blowup_radius, this, NULL,
                                 autocvar_g_vehicle_bumblebee_blowup_forceintensity,
-                                DEATH_VH_BUMB_DEATH.m_id, world);
+                                DEATH_VH_BUMB_DEATH.m_id, NULL);
 
-       sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-       Send_Effect(EFFECT_EXPLOSION_BIG, (self.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1);
+       sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+       Send_Effect(EFFECT_EXPLOSION_BIG, (this.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1);
 
-       if(self.owner.deadflag == DEAD_DYING)
-               self.owner.deadflag = DEAD_DEAD;
+       if(this.owner.deadflag == DEAD_DYING)
+               this.owner.deadflag = DEAD_DEAD;
 
-       remove(self);
+       remove(this);
 }
 
 void bumblebee_diethink(entity this)
 {
-       if(time >= self.wait)
-               setthink(self, bumblebee_blowup);
+       if(time >= this.wait)
+               setthink(this, bumblebee_blowup);
 
        if(random() < 0.1)
        {
-               sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
-               Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
+               sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+               Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
        }
 
-       self.nextthink = time + 0.1;
+       this.nextthink = time + 0.1;
 }
 
 spawnfunc(vehicle_bumblebee)
@@ -744,7 +744,7 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
         if(instance.gunner1)
         {
                entity e = instance.gunner1;
-               instance.gun1.vehicle_exit(e, VHEF_EJECT);
+               instance.gun1.vehicle_exit(instance.gun1, VHEF_EJECT);
                entity oldother = other;
                other = e;
                instance.phase = 0;
@@ -756,7 +756,7 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
         if(instance.gunner2)
         {
                entity e = instance.gunner2;
-               instance.gun2.vehicle_exit(e, VHEF_EJECT);
+               instance.gun2.vehicle_exit(instance.gun2, VHEF_EJECT);
                entity oldother = other;
                other = e;
                instance.phase = 0;
@@ -775,10 +775,10 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
                instance.gun3.enemy.effects |= EF_NODRAW;
 
        if(instance.gunner1)
-               instance.gun1.vehicle_exit(instance.gunner1, VHEF_EJECT);
+               instance.gun1.vehicle_exit(instance.gun1, VHEF_EJECT);
 
        if(instance.gunner2)
-               instance.gun2.vehicle_exit(instance.gunner2, VHEF_EJECT);
+               instance.gun2.vehicle_exit(instance.gun2, VHEF_EJECT);
 
        instance.vehicle_exit(instance, VHEF_EJECT);
 
@@ -876,7 +876,7 @@ METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
         instance.scale = 1.5;
 
         // Raygun beam
-        if(instance.gun3.enemy == world)
+        if(instance.gun3.enemy == NULL)
         {
             instance.gun3.enemy = spawn();
             Net_LinkEntity(instance.gun3.enemy, true, 0, bumble_raygun_send);