Add waitUntil in lockVault and unlockVault

Wait for response from server to verify safe was saved and logged before
proceeding with deleting safe object.

Tested and confirmed this solves #1413. Most likely helps with #1503
too.
This commit is contained in:
ebaydayz
2016-02-21 21:31:09 -05:00
parent 81d5976031
commit 9311ac4479
4 changed files with 26 additions and 13 deletions

View File

@@ -902,19 +902,27 @@ server_spawnCleanAnimals = {
};
server_logUnlockLockEvent = {
private["_player", "_obj", "_objectID", "_objectUID", "_statusText", "_PUID", "_status"];
private["_player", "_obj", "_objectID", "_objectUID", "_statusText", "_PUID", "_status", "_clientID", "_type"];
_player = _this select 0;
_obj = _this select 1;
_status = _this select 2;
if (!isNull(_obj)) then {
_type = typeOf _obj;
if (isNull _player) then {diag_log "ERROR: server_logUnlockLockEvent called with Null player object";};
_clientID = owner _player;
_PUID = [_player] call FNC_GetPlayerUID;
_statusText = if (_status) then {"LOCKED"} else {"UNLOCKED"};
if (!isNull _obj) then {
_objectID = _obj getVariable["ObjectID", "0"];
_objectUID = _obj getVariable["ObjectUID", "0"];
_statusText = "UNLOCKED";
if (_status) then {
[_obj, "gear"] call server_updateObject;
_statusText = "LOCKED";
};
_PUID = [_player] call FNC_GetPlayerUID;
diag_log format["SAFE %5: ID:%1 UID:%2 BY %3(%4)", _objectID, _objectUID, (name _player), _PUID, _statusText];
if (_status) then {[_obj, "gear"] call server_updateObject;};
diag_log format["%6 %5: ID:%1 UID:%2 BY %3(%4)",_objectID,_objectUID,name _player,_PUID,_statusText,_type];
dze_waiting = "success";
_clientID publicVariableClient "dze_waiting";
} else {
diag_log format["ERROR: %4 BY %1(%2) IS NULL AND COULD NOT BE %3 (THIS SHOULD NOT HAPPEN)",name _player,_PUID,_statusText,_type];
dze_waiting = "fail";
_clientID publicVariableClient "dze_waiting";
};
};