mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-04 15:22:53 +03:00
Sync near player checks
Checking if the player is the closest is not always the best idea, this fixes a few dupes and syncs the distance for all player checks
This commit is contained in:
@@ -17,37 +17,36 @@ _objType = typeOf _obj;
|
||||
_lockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "lockedClass");
|
||||
_text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
|
||||
|
||||
// Silently exit if object no longer exists
|
||||
if (isNull _obj) exitWith { dayz_actionInProgress = false; };
|
||||
if (isNull _obj) exitWith {dayz_actionInProgress = false;};
|
||||
|
||||
// Server_handleSafeGear is called unscheduled and exits if the object is null, so two players locking at the same time will not work
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_11" call dayz_rollingMessages;};
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_ComboMatch = (_ownerID == dayz_combination);
|
||||
if (DZE_permanentPlot) then {_ownerID = _obj getVariable["ownerPUID","0"];};
|
||||
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith {dayz_actionInProgress = false; s_player_lockvault = -1; format[localize "str_epoch_player_115",_text] call dayz_rollingMessages; };
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith {dayz_actionInProgress = false; s_player_lockvault = -1; format[localize "str_epoch_player_115",_text] call dayz_rollingMessages;};
|
||||
|
||||
if (!isNull _obj) then {
|
||||
(findDisplay 106) closeDisplay 0; // Close gear
|
||||
dze_waiting = nil;
|
||||
|
||||
|
||||
[_lockedClass,objNull] call fn_waitForObject;
|
||||
|
||||
|
||||
if (_lockedClass == "LockboxStorageLocked") then {
|
||||
[player,"lockboxclose",0,false] call dayz_zombieSpeak;
|
||||
} else {
|
||||
[player,"safeclose",0,false] call dayz_zombieSpeak;
|
||||
};
|
||||
|
||||
|
||||
PVDZE_handleSafeGear = [player,_obj,1];
|
||||
publicVariableServer "PVDZE_handleSafeGear";
|
||||
//wait for response from server to verify safe was logged and saved before proceeding
|
||||
waitUntil {!isNil "dze_waiting"};
|
||||
publicVariableServer "PVDZE_handleSafeGear";
|
||||
|
||||
waitUntil {!isNil "dze_waiting"}; // wait for response from server to verify safe was logged and saved before proceeding
|
||||
|
||||
format[localize "str_epoch_player_117",_text] call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
s_player_lockvault = -1;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
/*
|
||||
[_obj] call player_packTent;
|
||||
[_obj] call player_packTent;
|
||||
*/
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_alreadyPacking","_backpacks","_bag","_campItems","_dir","_holder","_magazines","_obj","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished","_posPlayer","_text"];
|
||||
private ["_alreadyPacking","_backpacks","_bag","_campItems","_dir","_holder","_magazines","_obj","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished","_posPlayer","_text","_typeOf"];
|
||||
|
||||
_obj = _this;
|
||||
_typeOf = typeOf _obj;
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||
|
||||
if (DZE_permanentPlot) then {
|
||||
_ownerID = _obj getVariable["ownerPUID","0"];
|
||||
};
|
||||
|
||||
// Make sure no other players are nearby
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase",10]) > 1;
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
|
||||
_packobj = getText (configFile >> "CfgVehicles" >> typeOf _obj >> "pack");
|
||||
_packobj = getText (configFile >> "CfgVehicles" >> _typeOf >> "pack");
|
||||
|
||||
player removeAction s_player_packtent;
|
||||
s_player_packtent = -1;
|
||||
@@ -27,7 +29,7 @@ s_player_packtentinfected = -1;
|
||||
|
||||
_campItems = ["IC_DomeTent","IC_Tent"];
|
||||
|
||||
if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems) then {
|
||||
if (_ownerID in [dayz_characterID,dayz_playerUID] || {_typeOf in _campItems}) then {
|
||||
_alreadyPacking = _obj getVariable["packing",0];
|
||||
if (_alreadyPacking == 1) exitWith {localize "str_player_beingpacked" call dayz_rollingMessages;};
|
||||
|
||||
@@ -38,7 +40,7 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems)
|
||||
[player,"tentpack",0,false,20] call dayz_zombieSpeak;
|
||||
[player,20,true,getPosATL player] call player_alertZombies;
|
||||
|
||||
_text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
|
||||
_text = getText (configFile >> "CfgVehicles" >> _typeOf >> "displayName");
|
||||
format[localize "str_epoch_player_121",_text] call dayz_rollingMessages;
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
@@ -48,11 +50,8 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems)
|
||||
_posPlayer = getPosATL player;
|
||||
_pos set [2,_posPlayer select 2];
|
||||
|
||||
if (_pos select 2 < 0) then {
|
||||
_pos set [2,0];
|
||||
};
|
||||
if (_pos select 2 < 0) then {_pos set [2,0];};
|
||||
|
||||
//place tent (local)
|
||||
_bag = _packobj createVehicle [0,0,0];
|
||||
_bag setDir _dir;
|
||||
_bag setPosATL _pos;
|
||||
@@ -76,4 +75,5 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems)
|
||||
} else {
|
||||
localize "str_fail_tent_pack" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
@@ -2,21 +2,20 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call day
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
/*
|
||||
[_obj] spawn player_packVault;
|
||||
[_obj] spawn player_packVault;
|
||||
*/
|
||||
|
||||
private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished","_ComboMatch"];
|
||||
private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished","_ComboMatch","_typeOf"];
|
||||
|
||||
_obj = _this;
|
||||
_packedClass = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "packedClass");
|
||||
_text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
|
||||
_typeOf = typeOf _obj;
|
||||
_packedClass = getText (configFile >> "CfgVehicles" >> _typeOf >> "packedClass");
|
||||
_text = getText (configFile >> "CfgVehicles" >> _typeOf >> "displayName");
|
||||
|
||||
// Silently exit if object no longer exists
|
||||
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
|
||||
|
||||
// Server_handleSafeGear is called unscheduled and exits if the object is null, so two players packing at the same time will not work
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;};
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
@@ -29,7 +28,7 @@ s_player_packvault = 1;
|
||||
|
||||
if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_118",_text] call dayz_rollingMessages;};
|
||||
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith { dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;};
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith {dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;};
|
||||
|
||||
format[localize "str_epoch_player_121",_text] call dayz_rollingMessages;
|
||||
uiSleep 1;
|
||||
@@ -37,17 +36,17 @@ _location1 = getPosATL player;
|
||||
uiSleep 5;
|
||||
_location2 = getPosATL player;
|
||||
|
||||
if(_location1 distance _location2 > 0.1) exitWith {
|
||||
if (_location1 distance _location2 > 0.1) exitWith {
|
||||
format[localize "str_epoch_player_122",_text] call dayz_rollingMessages;
|
||||
s_player_packvault = -1;
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
if (!isNull _obj && alive _obj) then {
|
||||
if (!isNull _obj && {alive _obj}) then {
|
||||
[player,"tentpack",0,false] call dayz_zombieSpeak;
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (isNull _obj or !_finished) exitWith {};
|
||||
if (isNull _obj || !_finished) exitWith {};
|
||||
|
||||
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
|
||||
|
||||
@@ -58,10 +57,11 @@ if (!isNull _obj && alive _obj) then {
|
||||
|
||||
PVDZE_handleSafeGear = [player,_obj,2];
|
||||
publicVariableServer "PVDZE_handleSafeGear";
|
||||
//wait for response from server to verify pack was logged and gear added before proceeding
|
||||
waitUntil {!isNil "dze_waiting"};
|
||||
|
||||
waitUntil {!isNil "dze_waiting"}; // wait for response from server to verify pack was logged and gear added before proceeding
|
||||
|
||||
format[localize "str_epoch_player_123",_text] call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
s_player_packvault = -1;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
@@ -20,9 +20,8 @@ if !(_objType in DZE_LockedStorage) exitWith {
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
// Server_handleSafeGear is called unscheduled and exits if the object is null, so two players unlocking at the same time will not work
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_20" call dayz_rollingMessages;};
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
|
||||
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
|
||||
|
||||
@@ -52,8 +51,8 @@ if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
|
||||
|
||||
PVDZE_handleSafeGear = [player,_obj,0];
|
||||
publicVariableServer "PVDZE_handleSafeGear";
|
||||
//wait for response from server to verify safe was logged before proceeding
|
||||
waitUntil {!isNil "dze_waiting"};
|
||||
|
||||
waitUntil {!isNil "dze_waiting"}; // wait for response from server to verify safe was logged before proceeding
|
||||
|
||||
format[localize "STR_BLD_UNLOCKED",_text] call dayz_rollingMessages;
|
||||
} else {
|
||||
@@ -71,5 +70,6 @@ if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
|
||||
|
||||
format [localize "str_epoch_player_19",round(dayz_lastCodeFail - diag_tickTime)] call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
s_player_unlockvault = -1;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
Reference in New Issue
Block a user