From ea389b59eaa8074816e7f5b121d3eeada4f9644b Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Wed, 23 Nov 2016 14:43:59 -0500 Subject: [PATCH] Remove unneeded isKindOf "Man" checks "Man" includes animals and zombies: https://community.bistudio.com/wiki/ArmA_2:_CfgVehicles#Man_Class_Vehicles --- SQF/dayz_code/Configs/CfgVehicles/Skins.hpp | 4 +-- SQF/dayz_code/compile/fn_damageActions.sqf | 13 ++++----- SQF/dayz_code/compile/fn_gearMenuChecks.sqf | 2 +- SQF/dayz_code/compile/fn_selfActions.sqf | 27 ++++++++----------- .../compile/player_weaponFiredNear.sqf | 2 +- SQF/dayz_code/compile/ui_gear_sound.sqf | 2 +- .../compile/server_playerSetup.sqf | 2 +- 7 files changed, 22 insertions(+), 30 deletions(-) diff --git a/SQF/dayz_code/Configs/CfgVehicles/Skins.hpp b/SQF/dayz_code/Configs/CfgVehicles/Skins.hpp index 503e3dfb6..fda043260 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Skins.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Skins.hpp @@ -1,6 +1,6 @@ -class Man; -class CAManBase: Man //Covers all custom Epoch skins +class Man; //includes animals and zombies +class CAManBase: Man //includes all skins except animals { class TalkTopics; class HitPoints diff --git a/SQF/dayz_code/compile/fn_damageActions.sqf b/SQF/dayz_code/compile/fn_damageActions.sqf index 3d77a63f3..b734ea096 100644 --- a/SQF/dayz_code/compile/fn_damageActions.sqf +++ b/SQF/dayz_code/compile/fn_damageActions.sqf @@ -211,14 +211,11 @@ if (isPlayer cursorTarget) then { _action = _unit addAction [localize "str_actions_medical_give_antibiotics", "\z\addons\dayz_code\medical\antibiotics.sqf",[_unit], 0, true, true]; r_player_actions set [count r_player_actions, _action]; }; - if (_unit isKindOf "Man") then { - // should only fire if cursor target is man and not vehicle - _isFriendly = [player, _unit] call FNC_check_access; - if !(_isFriendly select 1) then { - r_action = true; - _action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true]; - r_player_actions set [count r_player_actions,_action]; - }; + _isFriendly = [player, _unit] call FNC_check_access; + if !(_isFriendly select 1) then { + r_action = true; + _action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true]; + r_player_actions set [count r_player_actions,_action]; }; if (r_action) then { r_action_targets set [(count r_action_targets), _unit]; diff --git a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf index ddb1ed8e8..acbee271c 100644 --- a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf +++ b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf @@ -31,7 +31,7 @@ if ((vehicle player) == player) then { if (DZE_BackpackAntiTheft) then { _friendlies = player getVariable ["friendlies",[]]; _rID = if (DZE_permanentPlot) then { getPlayerUID _cTarget } else { _cTarget getVariable ["CharacterID","0"] }; - if ((!canbuild or isInTraderCity) && {_cTarget isKindOf "Man"} && {alive _cTarget} && {isPlayer _cTarget} && {!(_rID in _friendlies)} && {(player distance _cTarget) < 12}) then { + if ((!canbuild or isInTraderCity) && {alive _cTarget} && {isPlayer _cTarget} && {!(_rID in _friendlies)} && {(player distance _cTarget) < 12}) then { localize "STR_EPOCH_PLAYER_316" call dayz_rollingMessages; _display closeDisplay 2; }; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 5b7cd791c..77ea0385a 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -6,11 +6,11 @@ scriptName "Functions\misc\fn_selfActions.sqf"; ************************************************************/ if (dayz_actionInProgress) exitWith {}; private ["_canPickLight","_text","_dir","_canDoThis","_w2m","_bb","_waterHoles","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names", -"_hasKey","_oldOwner","_hasAttached","_isAnimal","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild", +"_hasKey","_oldOwner","_hasAttached","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild", "_player_lockUnlock_crtl","_displayName","_hasIgnators","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached", "_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget", "_isVehicle","_isBicycle","_isDestructable","_isGenerator","_ownerID","_isVehicletype","_hasBarrel","_hasFuel20","_hasFuel5","_hasEmptyFuelCan", -"_itemsPlayer","_hasToolbox","_hasbottleitem","_isAlive","_isPlant","_istypeTent","_upgradeItems","_isCampSite","_isDisallowRefuel","_isDog", +"_itemsPlayer","_hasToolbox","_hasbottleitem","_isAlive","_isPlant","_istypeTent","_upgradeItems","_isDisallowRefuel","_isDog", "_isModular","_isModularDoor","_isHouse","_isGate","_isFence","_isLockableGate","_isUnlocked","_isOpen","_isClosed","_ownerArray","_ownerBuildLock", "_ownerPID","_speed","_dog","_vehicle","_inVehicle","_cursorTarget","_primaryWeapon","_currentWeapon","_magazinesPlayer","_onLadder","_canDo", "_nearLight","_vehicleOwnerID","_hasHotwireKit","_isPZombie","_dogHandle","_allowedDistance","_id","_upgrade","_weaponsPlayer","_hasCrowbar", @@ -211,12 +211,10 @@ if (_isPZombie) then { s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"]; }; if (!isNull _cursorTarget && (player distance _cursorTarget < 3)) then { - _isAnimal = _cursorTarget isKindOf "Animal"; _isZombie = _cursorTarget isKindOf "zZombie_base"; _isHarvested = _cursorTarget getVariable["meatHarvested",false]; - _isMan = _cursorTarget isKindOf "Man"; - // Pzombie Gut human corpse or animal - if (!alive _cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then { + _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies + if (!alive _cursorTarget && _isMan && !_isZombie && !_isHarvested) then { if (s_player_pzombiesfeed < 0) then { s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",_cursorTarget, 3, true, false]; }; @@ -238,9 +236,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur _typeOfCursorTarget = typeOf _cursorTarget; _isVehicle = _cursorTarget isKindOf "AllVehicles"; _isBicycle = _cursorTarget isKindOf "Bicycle"; - _isMan = _cursorTarget isKindOf "Man"; - _isAnimal = _cursorTarget isKindOf "Animal"; - _isZombie = _cursorTarget isKindOf "zZombie_base"; + _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies _isDestructable = _cursorTarget isKindOf "BuiltItems"; _isGenerator = _cursorTarget isKindOf "Generator_DZ"; //_isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"]; //Checked in player_flipvehicle @@ -259,7 +255,6 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur _isPlant = _typeOfCursorTarget in Dayz_plants; _istypeTent = (_cursorTarget isKindOf "TentStorage_base") or (_cursorTarget isKindOf "IC_Tent"); _upgradeItems = ["TentStorage","TentStorage0","TentStorage1","TentStorage2","TentStorage3","StashSmall","StashSmall1","StashSmall2","StashSmall3","StashSmall4","StashMedium","StashMedium1","StashMedium2","StashMedium3","DomeTentStorage","DomeTentStorage0","DomeTentStorage1","DomeTentStorage2","DomeTentStorage3","DomeTentStorage4"]; - _isCampSite = _cursorTarget isKindOf "IC_Fireplace1"; _characterID = _cursorTarget getVariable ["CharacterID","0"]; if (DZE_permanentPlot) then { @@ -290,7 +285,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; //flip vehicle - if (_isVehicle && {!_isAnimal} && {!_isMan} && {!(canMove _cursorTarget)} && {_isAlive} && {player distance _cursorTarget >= 2} && {(count (crew _cursorTarget))== 0} && {((vectorUp _cursorTarget) select 2) < 0.5}) then { + if (_isVehicle && {!_isMan} && {!(canMove _cursorTarget)} && {_isAlive} && {player distance _cursorTarget >= 2} && {(count (crew _cursorTarget))== 0} && {((vectorUp _cursorTarget) select 2) < 0.5}) then { if (s_player_flipveh < 0) then { s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true]; }; @@ -311,7 +306,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if (damage _cursorTarget < 1) then { //Allow player to fill vehicle 210L - if (_hasBarrel && {!_isZombie} && {!_isAnimal} && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then { + if (_hasBarrel && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then { if (s_player_fillfuel210 < 0) then { s_player_fillfuel210 = player addAction [format[localize "str_actions_medical_10",_text,"210"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelBarrel",_cursorTarget], 0, true, true, "", "'ItemFuelBarrel' in magazines player"]; }; @@ -321,7 +316,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; //Allow player to fill vehicle 20L - if (_hasFuel20 && {!_isZombie} && {!_isAnimal} && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then { + if (_hasFuel20 && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then { if (s_player_fillfuel20 < 0) then { s_player_fillfuel20 = player addAction [format[localize "str_actions_medical_10",_text,"20"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemJerrycan",_cursorTarget], 0, true, true, "", "'ItemJerrycan' in magazines player"]; }; @@ -331,7 +326,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; //Allow player to fill vehicle 5L - if (_hasFuel5 && {!_isZombie} && {!_isAnimal} && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then { + if (_hasFuel5 && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then { if (s_player_fillfuel5 < 0) then { s_player_fillfuel5 = player addAction [format[localize "str_actions_medical_10",_text,"5"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelcan",_cursorTarget], 0, true, true, "", "'ItemFuelcan' in magazines player"]; }; @@ -345,7 +340,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur Epoch generator fill action is below. */ //Allow player to siphon vehicles - if (_hasEmptyFuelCan && {!_isZombie} && {!_isAnimal} && {!_isMan} && {_isVehicle} && {!_isBicycle} && {!a_player_jerryfilling} && {fuel _cursorTarget > 0}) then { + if (_hasEmptyFuelCan && {!_isMan} && {_isVehicle} && {!_isBicycle} && {!a_player_jerryfilling} && {fuel _cursorTarget > 0}) then { if (s_player_siphonfuel < 0) then { s_player_siphonfuel = player addAction [format[localize "str_siphon_start"], "\z\addons\dayz_code\actions\siphonFuel.sqf",_cursorTarget, 0, true, true]; }; @@ -734,7 +729,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; // gear access on surrendered player - if (_isMan && {_isAlive} && {!_isZombie} && {!_isAnimal} && {_cursorTarget getVariable ["DZE_Surrendered",false]}) then { + if (isPlayer _cursorTarget && {_isAlive} && {_cursorTarget getVariable ["DZE_Surrendered",false]}) then { if (s_player_SurrenderedGear < 0) then { s_player_SurrenderedGear = player addAction [localize "STR_UI_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true]; }; diff --git a/SQF/dayz_code/compile/player_weaponFiredNear.sqf b/SQF/dayz_code/compile/player_weaponFiredNear.sqf index b9ad01699..4f641564a 100644 --- a/SQF/dayz_code/compile/player_weaponFiredNear.sqf +++ b/SQF/dayz_code/compile/player_weaponFiredNear.sqf @@ -13,7 +13,7 @@ private ["_handled"]; _arc = 60; _isBallistic = (getNumber (configfile >> "CfgAmmo" >> _ammo >> "whistleOnFire") > 0); _dmgDistance = getNumber (configfile >> "CfgAmmo" >> _ammo >> "whistleDist"); - _isRocket = ((_ammo isKindOf "RocketBase") && (_firer isKindOf "Man")); + _isRocket = ((_ammo isKindOf "RocketBase") && (_firer isKindOf "CAManBase")); _isPlayer = (_unit == player); _inVehicle = (vehicle _unit != _unit); //_evType = ""; diff --git a/SQF/dayz_code/compile/ui_gear_sound.sqf b/SQF/dayz_code/compile/ui_gear_sound.sqf index 3f67659f3..7fe176ffe 100644 --- a/SQF/dayz_code/compile/ui_gear_sound.sqf +++ b/SQF/dayz_code/compile/ui_gear_sound.sqf @@ -5,7 +5,7 @@ if( (!isNull cursorTarget) && (player distance cursorTarget < 5) && (vehicle pla _cTarget=cursorTarget; _type = switch true do { case (_cTarget isKindOf "Bag_Base_EP1"):{"open_backpack"}; //backpacks on ground - case ( (_cTarget isKindOf "Man") && (alive _cTarget) && !(isNull unitBackpack _cTarget) ):{"open_backpack"}; //Person with backpack + case ( (_cTarget isKindOf "CAManBase") && (alive _cTarget) && !(isNull unitBackpack _cTarget) ):{"open_backpack"}; //Person with backpack default {"open_inventory"}; //unknown, play cloth sounds //case (_cTarget isKindOf "Land_A_tent"):{"open_inventory"}; //Tents //case (_cTarget isKindOf "StashSmall"):{"open_stash_sm"}; //dirt pile stash diff --git a/SQF/dayz_server/compile/server_playerSetup.sqf b/SQF/dayz_server/compile/server_playerSetup.sqf index db05a060d..2a98bb0c3 100644 --- a/SQF/dayz_server/compile/server_playerSetup.sqf +++ b/SQF/dayz_server/compile/server_playerSetup.sqf @@ -198,7 +198,7 @@ if (_randomSpot) then { && {(_position distance _mkr < spawnArea)}) then { // !ouside the disk _position set [2, 0]; if (((ATLtoASL _position) select 2 > 2.5) //! player's feet too wet - && {({alive _x} count (_position nearEntities ["Man",150]) == 0)}) then { // !too close from other players/zombies + && {({alive _x} count (_position nearEntities ["CAManBase",150]) == 0)}) then { // !too close from other players/zombies _pos = +(_position); _isIsland = false; //Can be set to true during the Check // we check over a 809-meter cross line, with an effective interlaced step of 5 meters