From: Mario Date: Sat, 17 Jun 2017 23:03:55 +0000 (+1000) Subject: Add a vehicle hook when setting colors, so vehicles with modules that aren't directly... X-Git-Tag: xonotic-v0.8.5~2730 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9927d48f4fa2c421a226eafd02a26300aab7a2f8;p=xonotic%2Fxonotic-data.pk3dir.git Add a vehicle hook when setting colors, so vehicles with modules that aren't directly attached can be properly coloured --- 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 */