]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/vehicle/bumblebee.qc
Merge branch 'martin-t/units' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicle / bumblebee.qc
index ad376e809b0d86a3804bce1ab2ba1592211a47c8..d3f802791eb578c3d6a6c26a26096f95bbde3cda 100644 (file)
@@ -99,6 +99,7 @@ bool bumblebee_gunner_frame(entity this, float dt)
                _out = autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
                setorigin(this, vehic.origin + v_up * -16 + v_forward * -16 + v_right * -128);
        }
+       this.oldorigin = this.origin; // negate fall damage
 
        crosshair_trace(this);
        vector _ct = trace_endpos;
@@ -236,7 +237,12 @@ void bumblebee_gunner_exit(entity this, int _exitflag)
        player.event_damage   = PlayerDamage;
        player.hud            = HUD_NORMAL;
        player.teleportable       = TELEPORT_NORMAL;
-       PS(player).m_switchweapon = gunner.m_switchweapon;
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+               player.(weaponentity).m_switchweapon = gunner.(weaponentity).m_switchweapon;
+               delete(gunner.(weaponentity));
+       }
        player.vehicle_enter_delay = time + 2;
 
        fixedmakevectors(vehic.angles);
@@ -304,9 +310,15 @@ bool bumblebee_gunner_enter(entity this, entity player)
        player.vehicle_energy   = vehic.vehicle_energy;
        UNSET_ONGROUND(player);
 
-       RemoveGrapplingHook(player);
+       RemoveGrapplingHooks(player);
 
-       gunner.m_switchweapon = PS(player).m_switchweapon;
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+
+               gunner.(weaponentity) = new(temp_wepent);
+               gunner.(weaponentity).m_switchweapon = player.(weaponentity).m_switchweapon;
+       }
        gunner.vehicle_exit = bumblebee_gunner_exit;
        gunner.vehicle_hudmodel.viewmodelforclient = player;
 
@@ -391,7 +403,7 @@ bool bumblebee_pilot_frame(entity this, float dt)
        entity vehic = this.vehicle;
        return = true;
 
-       if(gameover)
+       if(game_stopped)
        {
                vehic.solid = SOLID_NOT;
                vehic.takedamage = DAMAGE_NO;
@@ -427,9 +439,9 @@ bool bumblebee_pilot_frame(entity this, float dt)
 
        // Pitch
        ftmp = 0;
-       if(this.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
+       if(CS(this).movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
                ftmp = 4;
-       else if(this.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
+       else if(CS(this).movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
                ftmp = -8;
 
        newvel.x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x , autocvar_g_vehicle_bumblebee_pitchlimit);
@@ -443,19 +455,19 @@ bool bumblebee_pilot_frame(entity this, float dt)
        makevectors('0 1 0' * vehic.angles.y);
        newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
 
-       if(this.movement.x != 0)
+       if(CS(this).movement.x != 0)
        {
-               if(this.movement.x > 0)
+               if(CS(this).movement.x > 0)
                        newvel += v_forward  * autocvar_g_vehicle_bumblebee_speed_forward;
-               else if(this.movement.x < 0)
+               else if(CS(this).movement.x < 0)
                        newvel -= v_forward  * autocvar_g_vehicle_bumblebee_speed_forward;
        }
 
-       if(this.movement.y != 0)
+       if(CS(this).movement.y != 0)
        {
-               if(this.movement.y < 0)
+               if(CS(this).movement.y < 0)
                        newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
-               else if(this.movement.y > 0)
+               else if(CS(this).movement.y > 0)
                        newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
                ftmp = newvel * v_right;
                ftmp *= dt * 0.1;
@@ -474,7 +486,7 @@ bool bumblebee_pilot_frame(entity this, float dt)
                newvel +=  v_up * autocvar_g_vehicle_bumblebee_speed_up;
 
        vehic.velocity  += newvel * dt;
-       this.velocity = this.movement  = vehic.velocity;
+       this.velocity = CS(this).movement  = vehic.velocity;
 
 
        if(autocvar_g_vehicle_bumblebee_healgun_locktime)
@@ -596,6 +608,7 @@ bool bumblebee_pilot_frame(entity this, float dt)
        makevectors(vehic.angles);
        vehic.angles_x *= -1;
        setorigin(this, vehic.origin + v_up * 48 + v_forward * 160);
+       this.oldorigin = this.origin; // negate fall damage
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 }
@@ -645,7 +658,7 @@ void bumblebee_exit(entity this, int eject)
        else
                spot = this.origin + v_up * 128 - v_forward * 300;
 
-       spot = vehicles_findgoodexit(this, spot);
+       spot = vehicles_findgoodexit(this, this.owner, spot);
 
        // Hide beam
        if(this.gun3.enemy || !wasfreed(this.gun3.enemy))