From 930f9cf19c383240fd9e881822a85e8de2709e4b Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 12 Jul 2016 22:33:13 +1000 Subject: [PATCH] Reset vehicles when match is resetting, also make sure player exits vehicle when re-spawning --- qcsrc/common/vehicles/sv_vehicles.qc | 12 ++++++++++++ qcsrc/server/cl_client.qc | 2 ++ 2 files changed, 14 insertions(+) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index efec3d52b..fc2a06241 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1025,6 +1025,17 @@ void vehicles_think(entity this) CSQCMODEL_AUTOUPDATE(this); } +void vehicles_reset(entity this) +{ + if(this.owner) + vehicles_exit(this, VHEF_RELEASE); + + vehicles_clearreturn(this); + + if(this.active != ACTIVE_NOT) + vehicles_spawn(this); +} + // initialization void vehicles_spawn(entity this) { @@ -1036,6 +1047,7 @@ void vehicles_spawn(entity this) this.owner = NULL; settouch(this, vehicles_touch); this.event_damage = vehicles_damage; + this.reset = vehicles_reset; this.iscreature = true; this.teleportable = false; // no teleporting for vehicles, too buggy this.damagedbycontents = true; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 912086389..957742be5 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -462,6 +462,8 @@ void PutClientInServer(entity this) if (IS_OBSERVER(this)) { PutObserverInServer(this); } else if (IS_PLAYER(this)) { + if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE); + PlayerState_attach(this); accuracy_resend(this); -- 2.39.2