Shorten some isKindOf checks

This commit is contained in:
ebaydayz
2017-01-28 21:04:26 -05:00
parent 9270050bc6
commit 611fd73bbd
3 changed files with 5 additions and 5 deletions

View File

@@ -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 };

View File

@@ -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};
};

View File

@@ -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;
};