]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/sv_vehicles.qc
Merge branch 'master' into Mario/wepent_experimental
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / sv_vehicles.qc
index 60a8ee07760fbe897e58cd58fab2e22904337728..491962b67a5f74d14f193375de0cc4c49c7022e9 100644 (file)
@@ -806,7 +806,12 @@ void vehicles_exit(entity vehic, bool eject)
                player.view_ofs         = STAT(PL_VIEW_OFS, NULL);
                player.event_damage     = PlayerDamage;
                player.hud                              = HUD_NORMAL;
-               PS(player).m_switchweapon = vehic.m_switchweapon;
+               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++ slot)
+               {
+                       .entity weaponentity = weaponentities[slot];
+                       player.(weaponentity).m_switchweapon = vehic.(weaponentity).m_switchweapon;
+                       delete(vehic.(weaponentity)); // no longer needed
+               }
                player.last_vehiclecheck = time + 3;
                player.vehicle_enter_delay = time + 2;
 
@@ -942,7 +947,7 @@ void vehicles_enter(entity pl, entity veh)
        }
        else return;
 
-       RemoveGrapplingHook(pl);
+       RemoveGrapplingHooks(pl);
 
        veh.vehicle_ammo1 = 0;
        veh.vehicle_ammo2 = 0;
@@ -976,7 +981,12 @@ void vehicles_enter(entity pl, entity veh)
        veh.colormap            = pl.colormap;
        if(veh.tur_head)
                veh.tur_head.colormap = pl.colormap;
-       veh.m_switchweapon = PS(pl).m_switchweapon;
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+               veh.(weaponentity) = new(temp_wepent);
+               veh.(weaponentity).m_switchweapon = pl.(weaponentity).m_switchweapon;
+       }
        pl.hud = veh.vehicleid;
        pl.PlayerPhysplug = veh.PlayerPhysplug;
 
@@ -1099,7 +1109,15 @@ void vehicles_spawn(entity this)
        if(this.vehicle_controller)
                this.team = this.vehicle_controller.team;
 
-       FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == this, RemoveGrapplingHook(it));
+       FOREACH_CLIENT(IS_PLAYER(it),
+       {
+               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+           {
+               .entity weaponentity = weaponentities[slot];
+               if(it.(weaponentity).hook.aiment == this)
+                       RemoveHook(it.(weaponentity).hook);
+           }
+       });
 
        vehicles_reset_colors(this);
 
@@ -1167,6 +1185,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        this.iscreature                         = true;
        this.teleportable                       = false; // no teleporting for vehicles, too buggy
        this.damagedbycontents          = true;
+       IL_PUSH(g_damagedbycontents, this);
        this.vehicleid                          = info.vehicleid;
        this.PlayerPhysplug                     = info.PlayerPhysplug;
        this.event_damage                       = func_null;
@@ -1224,7 +1243,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        else
                this.nextthink = time + game_starttime;
 
-       if(MUTATOR_CALLHOOK(VehicleSpawn, this))
+       if(MUTATOR_CALLHOOK(VehicleInit, this))
                return false;
 
        return true;