From bcb96b9e9c76f9731c2f7a51cfc1e8f236c57455 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 18 Jun 2017 09:26:25 +1000 Subject: [PATCH] Reset vehicle colors when entering, so all components are updated. Also give vehicles_reset_colors a player parameter, so colormap can be updated properly too in non-teamplay modes --- qcsrc/common/vehicles/sv_vehicles.qc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 94f2f4f42..1057d1806 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -403,12 +403,14 @@ vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string return vtag; } -void vehicles_reset_colors(entity this) +void vehicles_reset_colors(entity this, entity player) { int eff = 0, cmap; const vector cmod = '0 0 0'; if(this.team && teamplay) cmap = 1024 + (this.team - 1) * 17; + else if(player) + cmap = player.colormap; else cmap = 1024; if(autocvar_g_nodepthtestplayers) @@ -575,7 +577,7 @@ void vehicle_use(entity this, entity actor, entity trigger) else { vehicles_setreturn(this); - vehicles_reset_colors(this); + vehicles_reset_colors(this, actor); } } } @@ -868,7 +870,7 @@ void vehicles_exit(entity vehic, bool eject) vehic.vehicle_exit(vehic, eject); vehicles_setreturn(vehic); - vehicles_reset_colors(vehic); + vehicles_reset_colors(vehic, NULL); vehic.owner = NULL; CSQCMODEL_AUTOINIT(vehic); @@ -1034,6 +1036,8 @@ void vehicles_enter(entity pl, entity veh) veh.team = pl.team; veh.flags -= FL_NOTARGET; + vehicles_reset_colors(veh, pl); + if (IS_REAL_CLIENT(pl)) { Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_VEHICLE_ENTER); @@ -1151,7 +1155,7 @@ void vehicles_spawn(entity this) Vehicle info = Vehicles_from(this.vehicleid); info.vr_spawn(info, this); - vehicles_reset_colors(this); + vehicles_reset_colors(this, NULL); CSQCMODEL_AUTOINIT(this); } -- 2.39.2