From: Mario Date: Sat, 17 Jun 2017 23:26:25 +0000 (+1000) Subject: Reset vehicle colors when entering, so all components are updated. Also give vehicles... X-Git-Tag: xonotic-v0.8.5~2727 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bcb96b9e9c76f9731c2f7a51cfc1e8f236c57455;p=xonotic%2Fxonotic-data.pk3dir.git 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 --- 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); }