Direct menu to cursortarget or player

Please test the living hell out of this.
This commit is contained in:
icomrade
2016-10-07 13:46:53 -04:00
parent 5b158b398a
commit b25b7636a7
2 changed files with 43 additions and 26 deletions

View File

@@ -8,37 +8,53 @@ if ((vehicle player) == player) then {
_dis = if (_cTarget isKindOf "USEC_ch53_E" || _cTarget isKindOf "MV22") then {25} else {12}; _dis = if (_cTarget isKindOf "USEC_ch53_E" || _cTarget isKindOf "MV22") then {25} else {12};
_exit = false; _exit = false;
if (locked _cTarget && {(_cTarget isKindOf "LandVehicle") or {_cTarget isKindOf "Air"} or {_cTarget isKindOf "Ship"}} && {(player distance _cTarget) <= _dis}) then { if (!DZE_GearCheckBypass) then {
_exit = true; if (locked _cTarget && {(_cTarget isKindOf "LandVehicle") or {_cTarget isKindOf "Air"} or {_cTarget isKindOf "Ship"}} && {(player distance _cTarget) <= _dis}) then {
} else { _exit = true;
_nearestObjects = (position player) nearEntities [["Air", "Car", "Motorcycle", "Tank", "Ship"], 26]; } else {
if (count _nearestObjects >= 1) then { _nearestObjects = (position player) nearEntities [["Air", "Car", "Motorcycle", "Tank", "Ship"], 26];
{ if (count _nearestObjects >= 1) then {
_vehType = TypeOf _x; {
_dis = getNumber (configFile >> "CfgVehicles" >> _vehType >> "supplyRadius"); _vehType = TypeOf _x;
if (_dis < 2) then {_dis = _dis * 4;} else {_dis = _dis * 3;}; //There seems to be significant inaccuracy of the supplyRadius config definition that is worse when the value is smaller _dis = getNumber (configFile >> "CfgVehicles" >> _vehType >> "supplyRadius");
_dis = _dis min 12; if (_dis < 2) then {_dis = _dis * 4;} else {_dis = _dis * 3;}; //There seems to be significant inaccuracy of the supplyRadius config definition that is worse when the value is smaller
_gearSelection = getText (configFile >> "CfgVehicles" >> _vehType >> "memoryPointSupply"); _dis = _dis min 12;
_supplyPositionWorld = _x modelToWorld (_x selectionPosition _gearSelection); _gearSelection = getText (configFile >> "CfgVehicles" >> _vehType >> "memoryPointSupply");
if (_x isKindOf "USEC_ch53_E" || _x isKindOf "MV22") then {_dis = 25;}; _supplyPositionWorld = _x modelToWorld (_x selectionPosition _gearSelection);
if (locked _x && {(_supplyPositionWorld distance player) <= _dis}) then { if (_x isKindOf "USEC_ch53_E" || _x isKindOf "MV22") then {_dis = 25;};
_exit = true; if (locked _x && {(_supplyPositionWorld distance player) <= _dis}) then {
}; _exit = true;
} forEach _nearestObjects; };
} forEach _nearestObjects;
};
};
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 {
localize "STR_EPOCH_PLAYER_316" call dayz_rollingMessages;
_display closeDisplay 1;
};
}; };
}; };
if (_exit) then { if (_exit) then {
_lastSave = dayz_lastSave;
_startTime = diag_tickTime;
localize "str_epoch_player_7" call dayz_rollingMessages; localize "str_epoch_player_7" call dayz_rollingMessages;
_display closeDisplay 1; _display closeDisplay 1;
}; _ctType = typeOf _cTarget;
//direct gear to cursorTarget
if (DZE_BackpackAntiTheft) then { [_lastSave, _startTime, _ctType, _cTarget] spawn {
_friendlies = player getVariable ["friendlies",[]]; waitUntil {((_this select 0) != dayz_lastSave) || {diag_tickTime >= ((_this select 1) + 1)}}; //waiting is required otherwise player_forceSave will reset DZE_GearCheckBypass
_rID = if (DZE_permanentPlot) then { getPlayerUID _cTarget } else { _cTarget getVariable ["CharacterID","0"] }; DZE_GearCheckBypass = true;
if ((!canbuild or isInTraderCity) && {_cTarget isKindOf "Man"} && {alive _cTarget} && {isPlayer _cTarget} && {!(_rID in _friendlies)} && {(player distance _cTarget) < 12}) then { if ((((_this select 2) in DZE_isNewStorage) || {(_this select 2) == "LockboxStorage"} || {(_this select 2) isKindOf "Land_A_tent"} || {(_this select 2) isKindOf "WeaponHolder"} || {((!alive (_this select 3)) && {(_this select 2) isKindOf "Man"})}) && {!(locked (_this select 3))}) then {
localize "STR_EPOCH_PLAYER_316" call dayz_rollingMessages; Player action ["GEAR", (_this select 3)];
_display closeDisplay 1; } else {
createGearDialog [player, "RscDisplayGear"];
};
}; };
} else {
DZE_GearCheckBypass = false; //exit will always be false the when the above code opens a new gear menu, this will reset the variable
}; };
}; };

View File

@@ -544,6 +544,7 @@ DZE_tradeObject = DZE_tradeVehicle + ["trade_backpacks"];
if (isNil "DZE_plotOwnershipExclusions") then { if (isNil "DZE_plotOwnershipExclusions") then {
DZE_plotTakeOwnershipItems = DayZ_SafeObjects - (DZE_LockableStorage + ["Plastic_Pole_EP1_DZ","DZ_storage_base"]); DZE_plotTakeOwnershipItems = DayZ_SafeObjects - (DZE_LockableStorage + ["Plastic_Pole_EP1_DZ","DZ_storage_base"]);
}; };
DZE_GearCheckBypass = false;
isInTraderCity = false; isInTraderCity = false;
inTraderCity = "Unknown Trader"; inTraderCity = "Unknown Trader";
PlayerDeaths = []; PlayerDeaths = [];