X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fvehicles%2Fsv_vehicles.qc;h=491962b67a5f74d14f193375de0cc4c49c7022e9;hp=cd62f0746b69f6b2dc892f42a1938807cf566d07;hb=87bec07409c336c956a798556064c6819ad40a4d;hpb=ba479caf23cd515c9741eb6595dad2044a1fa826 diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index cd62f0746..491962b67 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -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; @@ -900,7 +905,7 @@ bool vehicle_impulse(entity this, int imp) void vehicles_enter(entity pl, entity veh) { - // Remove this when bots know how to use vehicles + // Remove this when bots know how to use vehicles if((IS_BOT_CLIENT(pl) && !autocvar_g_vehicles_allow_bots)) return; @@ -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(VehicleInit, this)) + if(MUTATOR_CALLHOOK(VehicleInit, this)) return false; return true;