From: Mario Date: Sat, 18 Jun 2016 22:45:19 +0000 (+1000) Subject: Clean up g_vehicles_enter nearby vehicle checking X-Git-Tag: xonotic-v0.8.2~792 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=46ae86da6fddf3af9dd43fa1e834e19a2bd696b2;p=xonotic%2Fxonotic-data.pk3dir.git Clean up g_vehicles_enter nearby vehicle checking --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 28d9c6c1a..4263bc3b3 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -2155,26 +2155,27 @@ void PlayerPreThink () MUTATOR_CALLHOOK(PlayerPreThink, this); - if(autocvar_g_vehicles_enter) - if(time > this.last_vehiclecheck) - if(IS_PLAYER(this)) - if(!gameover) - if(!STAT(FROZEN, this)) - if(!this.vehicle) - if(!IS_DEAD(this)) + if(autocvar_g_vehicles_enter && (time > this.last_vehiclecheck) && !gameover && !this.vehicle) + if(IS_PLAYER(this) && !STAT(FROZEN, this) && !IS_DEAD(this)) { - entity veh; - for(veh = NULL; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); ) - if(vdist(veh.origin - this.origin, <, autocvar_g_vehicles_enter_radius)) - if(!IS_DEAD(veh)) - if(veh.takedamage != DAMAGE_NO) - if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, this)) - Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER); - else if(!veh.owner) - if(!veh.team || SAME_TEAM(this, veh)) - Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER); - else if(autocvar_g_vehicles_steal) - Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL); + FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, + { + if(!IS_DEAD(it) && it.takedamage != DAMAGE_NO) + if(vdist(it.origin - this.origin, <, autocvar_g_vehicles_enter_radius)) + if((it.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(it.owner, this)) + { + Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER); + } + else if(!it.owner) + { + if(!it.team || SAME_TEAM(this, it)) + Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER); + } + else if(autocvar_g_vehicles_steal) + { + Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL); + } + }); this.last_vehiclecheck = time + 1; }