From 611fd73bbd9185a9a1ab5b48cba163c916e564b5 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sat, 28 Jan 2017 21:04:26 -0500 Subject: [PATCH] Shorten some isKindOf checks --- SQF/dayz_code/compile/fn_damageHandler.sqf | 6 +++--- SQF/dayz_code/compile/player_death.sqf | 2 +- SQF/dayz_code/system/BIS_Effects/killed.sqf | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SQF/dayz_code/compile/fn_damageHandler.sqf b/SQF/dayz_code/compile/fn_damageHandler.sqf index befbc7607..f9dda53d1 100644 --- a/SQF/dayz_code/compile/fn_damageHandler.sqf +++ b/SQF/dayz_code/compile/fn_damageHandler.sqf @@ -165,7 +165,7 @@ if (_unit == player) then { }; //(vehicle _source != _source) does not work to detect if source unit is in a vehicle in HandleDamage EH - _isVehicle = (_sourceVehicleType isKindOf "LandVehicle" or _sourceVehicleType isKindOf "Air" or _sourceVehicleType isKindOf "Ship"); + _isVehicle = ({_sourceVehicleType isKindOf _x} count ["LandVehicle","Air","Ship"] > 0); //Log to server. Useful for detecting damage and ammo cheats. if (DZE_ServerLogHits && {!_isLocal} && {!_isZombieHit} && {_isMan or _isVehicle} && {diag_ticktime-(_source getVariable["lastloghit",0]) > 2}) then { @@ -206,8 +206,8 @@ if (_hit == "" && _ammo != "Crash") exitWith { 0 }; //Ammo Type Setup _type = switch true do { - case ((_ammo isKindof "Grenade") or (_ammo isKindof "ShellBase") or (_ammo isKindof "TimeBombCore") or (_ammo isKindof "BombCore") or (_ammo isKindof "MissileCore") or (_ammo isKindof "RocketCore") or (_ammo isKindof "FuelExplosion") or (_ammo isKindof "GrenadeBase")): { 1 }; - case ((_ammo isKindof "B_127x107_Ball") or (_ammo isKindof "B_127x99_Ball")): { 2 }; + case ({_ammo isKindOf _x} count ["Grenade","ShellBase","TimeBombCore","BombCore","MissileCore","RocketCore","FuelExplosion","GrenadeBase"] > 0): { 1 }; + case ((_ammo isKindof "B_127x107_Ball") or (_ammo isKindof "B_127x99_Ball")): { 2 }; case (_isZombieHit): { 3 }; case (_ammo == "RunOver"): { 4 }; case (_ammo == "Dragged"): { 5 }; diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index 7a64e5160..7cbc80213 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -54,7 +54,7 @@ if (!isNull _source) then { _sourceWeapon = currentWeapon _source; _sourceWeapon = switch true do { case (_ammo in ["PipeBomb","Mine","MineE"]): {_ammo}; - case (_sourceVehicleType isKindOf "LandVehicle" or _sourceVehicleType isKindOf "Air" or _sourceVehicleType isKindOf "Ship"): {_sourceVehicleType}; + case ({_sourceVehicleType isKindOf _x} count ["LandVehicle","Air","Ship"] > 0): {_sourceVehicleType}; case (_sourceWeapon == "Throw"): {(weaponState _source) select 3}; default {_sourceWeapon}; }; diff --git a/SQF/dayz_code/system/BIS_Effects/killed.sqf b/SQF/dayz_code/system/BIS_Effects/killed.sqf index 044d21682..1b3f9fb3d 100644 --- a/SQF/dayz_code/system/BIS_Effects/killed.sqf +++ b/SQF/dayz_code/system/BIS_Effects/killed.sqf @@ -21,7 +21,7 @@ if (!DZE_NoVehicleExplosions) then { }; }; } else { - _isVeh = (_v iskindof "helicopter" || _v iskindof "plane" || _v iskindof "tank" || _v iskindof "car" || _v iskindof "ship"); + _isVeh = ({_v isKindOf _x} count ["Helicopter","Plane","Tank","Car","Ship"] > 0); if (_isVeh && {player in (crew _v)}) then { ["Eject", _v] call BIS_Effects_globalEvent; };