From 9927d48f4fa2c421a226eafd02a26300aab7a2f8 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 18 Jun 2017 09:03:55 +1000 Subject: [PATCH] Add a vehicle hook when setting colors, so vehicles with modules that aren't directly attached can be properly coloured --- qcsrc/common/vehicles/sv_vehicles.qc | 3 +++ qcsrc/common/vehicles/vehicle.qh | 2 ++ 2 files changed, 5 insertions(+) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 659b3c148..1848b63b7 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -449,6 +449,9 @@ void vehicles_reset_colors(entity this) this.avelocity = '0 0 0'; this.velocity = '0 0 0'; this.effects = eff; + + Vehicle info = Vehicles_from(this.vehicleid); + info.vr_setcolors(info, this); } void vehicles_clearreturn(entity veh) diff --git a/qcsrc/common/vehicles/vehicle.qh b/qcsrc/common/vehicles/vehicle.qh index 4e3b7b872..5b30b845e 100644 --- a/qcsrc/common/vehicles/vehicle.qh +++ b/qcsrc/common/vehicles/vehicle.qh @@ -51,6 +51,8 @@ CLASS(Vehicle, Object) METHOD(Vehicle, vr_spawn, void(Vehicle this, entity instance)) { } /** (SERVER) called when a vehicle hits something */ METHOD(Vehicle, vr_impact, void(Vehicle this, entity instance)) { } + /** (SERVER) called when a vehicle's colors are being reset, so modules can be updated */ + METHOD(Vehicle, vr_setcolors, void(Vehicle this, entity instance)) { } /** (CLIENT) logic to run every frame */ METHOD(Vehicle, vr_hud, void(Vehicle this)) { } /** (CLIENT) logic to run every frame */ -- 2.39.2