From 0e8248146ce84baa99d07d1436cfa88e05dfd948 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 19 Jun 2016 10:10:52 +1000 Subject: [PATCH] Don't run think on idle vehicles every server frame --- qcsrc/common/vehicles/sv_vehicles.qc | 2 +- qcsrc/common/vehicles/sv_vehicles.qh | 1 + qcsrc/common/vehicles/vehicle/raptor.qc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 6eca93643..9ef5e4604 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1011,7 +1011,7 @@ void vehicles_enter(entity pl, entity veh) void vehicles_think(entity this) { - this.nextthink = time; + this.nextthink = time + autocvar_g_vehicles_thinkrate; if(this.owner) this.owner.vehicle_weapon2mode = this.vehicle_weapon2mode; diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index eded4f90b..e593922fc 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -17,6 +17,7 @@ bool autocvar_g_vehicles_delayspawn = true; float autocvar_g_vehicles_delayspawn_jitter = 10; float autocvar_g_vehicles_allow_bots; int autocvar_g_vehicles_exit_attempts = 25; +float autocvar_g_vehicles_thinkrate = 0.1; AUTOCVAR(g_vehicles_teams, bool, true, "allow team specific vehicles"); float autocvar_g_vehicles_teleportable; diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index fe381d3c6..59510c78f 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -178,7 +178,7 @@ bool raptor_frame(entity this) vehic.sound_nexttime = time + 7.955812; //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM ); sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM); - vehic.wait = ftmp; + vehic.wait = 0; } /* else if(fabs(ftmp - vehic.wait) > 0.2) -- 2.39.2