Add penalties for wrong safe/lockbox code

As per
6f072982c3 (diff-2b5340930b14ce1ae29d38ebc575c75a)
This commit is contained in:
oiad
2018-05-26 21:42:50 +12:00
parent efc57840d2
commit c3cbca144e
6 changed files with 39 additions and 21 deletions

View File

@@ -6,15 +6,14 @@
*/
private ["_display","_displayCombo","_displayEye","_doorMethod","_hasAccess","_notNearestPlayer","_obj","_objectCharacterID"];
if (!isNil "DZE_DYN_UnlockDoorInprogress") exitWith {localize "str_epoch_player_21" call dayz_rollingMessages;};
DZE_DYN_UnlockDoorInprogress = true;
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_21" call dayz_rollingMessages;};
dayz_actionInProgress = true;
_doorMethod = "";
_displayCombo = findDisplay 41144;
_displayEye = findDisplay 61144;
if(!isNull _displayEye) then {_display = _displayEye; _doorMethod = "Eye";};
if(!isNull _displayCombo) then {_display = _displayCombo; _doorMethod = "Combo";};
if (!isNull _displayEye) then {_display = _displayEye; _doorMethod = "Eye";};
if (!isNull _displayCombo) then {_display = _displayCombo; _doorMethod = "Combo";};
if (!isNull dayz_selectedDoor) then {
_obj = dayz_selectedDoor;
@@ -41,7 +40,8 @@ if (!isNull dayz_selectedDoor) then {
};
if (isNil "dayz_UnlockTime") then {dayz_UnlockTime = 5;};
if (DZE_doorManagementHarderPenalty && {(diag_tickTime - dayz_lastCodeFail) > 120}) then {dayz_UnlockTime = 5;};
if (DZE_doorManagementHarderPenalty && {((diag_tickTime - dayz_lastCodeFail) + dayz_unlockTime / 2) > 120}) then {dayz_UnlockTime = 5;};
if (DZE_Lock_Door == _objectCharacterID) then {
[player,"combo_unlock",0,false] call dayz_zombieSpeak;
@@ -60,13 +60,13 @@ if (!isNull dayz_selectedDoor) then {
};
dayz_UnlockTime = 5;
dayz_lastCodeFail = 0;
PVDZE_handleSafeGear = [player,_obj,5,if (_doorMethod == "EYE") then {"EYESCAN"} else {DZE_Lock_Door}];
publicVariableServer "PVDZE_handleSafeGear";
} else {
PVDZE_handleSafeGear = [player,_obj,6,if (_doorMethod == "EYE") then {"EYESCAN"} else {DZE_Lock_Door}];
publicVariableServer "PVDZE_handleSafeGear";
DZE_Lock_Door = "";
[player,"combo_locked",0,false] call dayz_zombieSpeak;
[player,20,true,(getPosATL player)] spawn player_alertZombies;
@@ -90,4 +90,4 @@ if (!isNull dayz_selectedDoor) then {
} else {
_display closeDisplay 2;
};
DZE_DYN_UnlockDoorInprogress = nil;
dayz_actionInProgress = false;

View File

@@ -24,7 +24,6 @@ if !(_objType in DZE_LockedStorage) exitWith {
_playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_20" call dayz_rollingMessages;};
// Silently exit if object no longer exists
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
_unlockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "unlockedClass");
@@ -34,25 +33,37 @@ _ownerID = _obj getVariable["CharacterID","0"];
_ComboMatch = (_ownerID == dayz_combination);
if (DZE_permanentPlot) then {_ownerID = _obj getVariable["ownerPUID","0"];};
if (isNil "dayz_UnlockTime") then {dayz_UnlockTime = 5;};
if (DZE_lockablesHarderPenalty && {((diag_tickTime - dayz_lastCodeFail) + dayz_unlockTime / 2) > 120}) then {dayz_UnlockTime = 5;};
if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
(findDisplay 106) closeDisplay 0; // Close gear
(findDisplay 106) closeDisplay 0;
dze_waiting = nil;
dayz_UnlockTime = 5;
dayz_lastCodeFail = 0;
[_unlockedClass,objNull] call fn_waitForObject;
PVDZE_handleSafeGear = [player,_obj,0];
publicVariableServer "PVDZE_handleSafeGear";
//wait for response from server to verify safe was logged before proceeding
waitUntil {!isNil "dze_waiting"};
format[localize "STR_BLD_UNLOCKED",_text] call dayz_rollingMessages;
} else {
PVDZE_handleSafeGear = [player,_obj,3,dayz_combination];
publicVariableServer "PVDZE_handleSafeGear";
[player,"repair",0,false] call dayz_zombieSpeak;
[player,25,true,(getPosATL player)] spawn player_alertZombies;
format[localize "STR_BLD_WRONG_COMBO",_text] call dayz_rollingMessages;
if (DZE_lockablesHarderPenalty) then {
dayz_lastCodeFail = (diag_tickTime + dayz_UnlockTime);
dayz_UnlockTime = dayz_UnlockTime * 2;
} else {
dayz_lastCodeFail = (diag_tickTime + dayz_UnlockTime);
};
format [localize "str_epoch_player_19",round(dayz_lastCodeFail - diag_tickTime)] call dayz_rollingMessages;
};
s_player_unlockvault = -1;
dayz_actionInProgress = false;