Condense variables and remove unneeded _isPZombie checks

We're already checking for _isPZombie here:
https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_code/compile/fn_selfActions.sqf#L223
so we don't need to check it again with the trader or the attach to
heli.

Condensed the distance check to a variable
This commit is contained in:
oiad
2018-01-06 17:37:06 +13:00
parent 564e3da5c2
commit b791deeea8

View File

@@ -13,7 +13,7 @@ private ["_canPickLight","_text","_unlock","_lock","_totalKeys","_temp_keys","_t
"_isModular","_isModularDoor","_isHouse","_isGateOperational","_isGateLockable","_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",
"_allowed","_hasAccess","_uid","_myCharID","_isLocked"];
"_allowed","_hasAccess","_uid","_myCharID","_isLocked","_isDistance"];
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
@@ -23,7 +23,6 @@ _currentWeapon = currentWeapon player;
_magazinesPlayer = magazines player;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
//_canDrink = count nearestObjects [getPosATL player, ["Land_pumpa","Land_water_tank"], 2] > 0;
_uid = getPlayerUID player;
_nearLight = nearestObject [player,"LitObject"];
_canPickLight = false;
@@ -31,6 +30,7 @@ _myCharID = player getVariable ["CharacterID","0"];
_vehicleOwnerID = _vehicle getVariable ["CharacterID","0"];
_hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
_isPZombie = player isKindOf "PZombie_VB";
_isDistance = (player distance _cursorTarget < 3);
_dogHandle = player getVariable ["dogID",0];
if (!isNull _nearLight) then {
@@ -199,7 +199,7 @@ if (_isPZombie) then {
if (s_player_pzombiesvision < 0) 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 {
if (!isNull _cursorTarget && _isDistance) then {
_isZombie = _cursorTarget isKindOf "zZombie_base";
_isHarvested = _cursorTarget getVariable["meatHarvested",false];
_isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
@@ -667,7 +667,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
};
_attached = _cursorTarget getVariable["attached",false];
if (_found && {_allowTow} && {!_isLocked} && {!_isPZombie} && {typeName _attached != "OBJECT"}) then {
if (_found && {_allowTow} && {!_isLocked} && {typeName _attached != "OBJECT"}) then {
if (s_player_heli_lift < 0) then {
s_player_heli_lift = player addAction [localize "STR_EPOCH_ACTIONS_ATTACHTOHELI", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true];
};
@@ -735,7 +735,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
};
//Allow owner to unlock vault
if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then {
if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {_isDistance} && {!keypadCancel}) then {
if (s_player_unlockvault < 0) then {
if (_typeOfCursorTarget in DZE_LockedStorage) then {
if (_characterID == dayz_combination || _ownerID == _uid) then {
@@ -760,7 +760,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
};
//Allow owner to pack vault
if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then {
if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_characterID != "0"} && {_isDistance} && {!keypadCancel}) then {
if (s_player_lockvault < 0) then {
if (_characterID == dayz_combination || _ownerID == _uid) then {
s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true];
@@ -920,7 +920,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
*/
// All Traders
if (_isMan && {!(isPlayer _cursorTarget)} && {_typeOfCursorTarget in serverTraders} && {!_isPZombie}) then {
if (_isMan && {!(isPlayer _cursorTarget)} && {_typeOfCursorTarget in serverTraders}) then {
if (s_player_parts_crtl < 0) then {
_humanity = player getVariable ["humanity",0];
_traderMenu = call compile format["menu_%1;",_typeOfCursorTarget];