Move vehicle check to the checkpoint_passed function (slight cleanup)
authorMario <mario@smbclan.net>
Sat, 11 May 2019 07:30:22 +0000 (17:30 +1000)
committerMario <mario@smbclan.net>
Sat, 11 May 2019 07:30:22 +0000 (17:30 +1000)
qcsrc/server/race.qc

index 775053e..b324183 100644 (file)
@@ -567,6 +567,9 @@ void race_ClearTime(entity e)
 
 void checkpoint_passed(entity this, entity player)
 {
+       if(IS_VEHICLE(player) && player.owner)
+               player = player.owner;
+
        if(player.personal && autocvar_g_allow_checkpoints)
                return; // practice mode!
 
@@ -716,8 +719,6 @@ void checkpoint_passed(entity this, entity player)
 void checkpoint_touch(entity this, entity toucher)
 {
        EXACTTRIGGER_TOUCH(this, toucher);
-       if(IS_VEHICLE(toucher) && toucher.owner)
-               toucher = toucher.owner;
        checkpoint_passed(this, toucher);
 }
 
@@ -726,8 +727,6 @@ void checkpoint_use(entity this, entity actor, entity trigger)
        if(trigger.classname == "info_player_deathmatch") // a spawn, a spawn
                return;
 
-       if(IS_VEHICLE(actor) && actor.owner)
-               actor = actor.owner;
        checkpoint_passed(this, actor);
 }