]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reset vehicles when match is resetting, also make sure player exits vehicle when...
authorMario <mario@smbclan.net>
Tue, 12 Jul 2016 12:33:13 +0000 (22:33 +1000)
committerMario <mario@smbclan.net>
Tue, 12 Jul 2016 12:33:13 +0000 (22:33 +1000)
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/server/cl_client.qc

index efec3d52b85948e52de661668971f7765018067f..fc2a06241310e21b495049d51996fe901ef4dafa 100644 (file)
@@ -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;
index 912086389082e2eb9c0eb44feaf9f23bbc703047..957742be5741efe62f4c3172ee036822e4527cf0 100644 (file)
@@ -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);