Remove medic animation from lock and unlock safe

Closes #1942 in combination with 48858b2

The "packing" variable was made redundant by dayz_actionInProgress
because it was only set locally.

DisableUserInput is unnecessary now because server_handleSafeGear is
called unscheduled. Getting the cargo, creating the new safe and
deleting the old one should complete in the same frame with no window
for players to remove gear:

https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_server/compile/server_handleSafeGear.sqf#L51-L67

The "claimed" check is also no longer needed because
server_handleSafeGear is called unscheduled and exits if the object is
null, so two players attempting to unlock at the same time will not
work.
This commit is contained in:
ebayShopper
2017-06-06 18:53:44 -04:00
parent 48858b2e6c
commit 72df07bdf2
6 changed files with 24 additions and 94 deletions

View File

@@ -10,6 +10,8 @@
[UPDATED] A new hidden version of the gear menu is now used for force saves so players do not see the dialog flash on screen. [UPDATED] A new hidden version of the gear menu is now used for force saves so players do not see the dialog flash on screen.
[UPDATED] Anyone can now lock a modular door without knowing the combination or having any special access. #1944 @ndavalos [UPDATED] Anyone can now lock a modular door without knowing the combination or having any special access. #1944 @ndavalos
[UPDATED] Newest version of DayZero enterable buildings, which fixes #1601 - provided by Tansien and Zac https://zombies.nu/ [UPDATED] Newest version of DayZero enterable buildings, which fixes #1601 - provided by Tansien and Zac https://zombies.nu/
[UPDATED] Locking and unlocking safes no longer plays the medic animation. #1942 @SmokeyBR
[UPDATED] Locking and unlocking safes now uses call instead of spawn on the server. This fixes the user input lock and safes appearing to disappear momentarily when server FPS is low.
[FIXED] Kamaz refuel trucks no longer allow automatic refueling. #1855 @coresync2k @dreamforceinc [FIXED] Kamaz refuel trucks no longer allow automatic refueling. #1855 @coresync2k @dreamforceinc
[FIXED] Trees at POIs can be chopped down now. Other trees spawned with createVehicle can be added to dayz_treeTypes in variables.sqf to allow chopping them down. [FIXED] Trees at POIs can be chopped down now. Other trees spawned with createVehicle can be added to dayz_treeTypes in variables.sqf to allow chopping them down.

View File

@@ -1,10 +1,11 @@
/* /*
DayZ Lock Safe DayZ Lock Safe
Usage: [_obj] spawn player_unlockVault; Usage: _obj spawn player_lockVault;
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
*/ */
private ["_obj","_ownerID","_alreadyPacking","_text","_playerNear","_ComboMatch","_objType"]; private ["_obj","_ownerID","_text","_playerNear","_ComboMatch","_objType"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_10" call dayz_rollingMessages;};
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true; dayz_actionInProgress = true;
player removeAction s_player_lockvault; player removeAction s_player_lockvault;
@@ -18,11 +19,8 @@ _text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
// Silently exit if object no longer exists // Silently exit if object no longer exists
if (isNull _obj) exitWith { dayz_actionInProgress = false; }; if (isNull _obj) exitWith { dayz_actionInProgress = false; };
player playActionNow "Medic";
uiSleep 1;
[player,"tentpack",0,false] call dayz_zombieSpeak;
uiSleep 5;
// 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; _playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_11" call dayz_rollingMessages;}; if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_11" call dayz_rollingMessages;};
@@ -32,12 +30,7 @@ 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; };
_alreadyPacking = _obj getVariable["packing",0];
if (_alreadyPacking == 1) exitWith {dayz_actionInProgress = false; s_player_lockvault = -1; format[localize "str_epoch_player_116",_text] call dayz_rollingMessages;};
_obj setVariable["packing",1];
if (!isNull _obj) then { if (!isNull _obj) then {
disableUserInput true; // Make sure player can not modify gear while it is being saved
(findDisplay 106) closeDisplay 0; // Close gear (findDisplay 106) closeDisplay 0; // Close gear
dze_waiting = nil; dze_waiting = nil;
@@ -47,7 +40,6 @@ if (!isNull _obj) then {
publicVariableServer "PVDZE_handleSafeGear"; publicVariableServer "PVDZE_handleSafeGear";
//wait for response from server to verify safe was logged and saved before proceeding //wait for response from server to verify safe was logged and saved before proceeding
waitUntil {!isNil "dze_waiting"}; waitUntil {!isNil "dze_waiting"};
disableUserInput false; // Safe is done saving now
format[localize "str_epoch_player_117",_text] call dayz_rollingMessages; format[localize "str_epoch_player_117",_text] call dayz_rollingMessages;
}; };

View File

@@ -3,7 +3,7 @@
*/ */
private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished"]; private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_15" call dayz_rollingMessages;}; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true; dayz_actionInProgress = true;
_obj = _this; _obj = _this;
@@ -13,7 +13,7 @@ _text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
// Silently exit if object no longer exists // Silently exit if object no longer exists
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; }; if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
// Server_handleSafeGear runs unscheduled and exits if object is null, so more secure check is not needed // 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; _playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;}; if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;};

View File

@@ -1,11 +1,11 @@
/* /*
DayZ Lock Safe DayZ Lock Safe
Usage: [_obj] spawn player_unlockVault; Usage: _obj spawn player_unlockVault;
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
*/ */
private ["_obj","_ownerID","_alreadyPacking","_playerNear","_claimedBy","_text","_objType","_ComboMatch"]; private ["_obj","_ownerID","_playerNear","_text","_objType","_ComboMatch"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_21" call dayz_rollingMessages;}; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true; dayz_actionInProgress = true;
{player removeAction _x} count s_player_combi; {player removeAction _x} count s_player_combi;
@@ -20,70 +20,38 @@ if !(_objType in DZE_LockedStorage) exitWith {
dayz_actionInProgress = false; 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; _playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_20" call dayz_rollingMessages;}; if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_20" call dayz_rollingMessages;};
// Silently exit if object no longer exists || alive // Silently exit if object no longer exists
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; }; if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
_unlockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "unlockedClass"); _unlockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "unlockedClass");
_text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName"); _text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
_alreadyPacking = _obj getVariable["packing",0];
_claimedBy = _obj getVariable["claimed","0"];
_ownerID = _obj getVariable["CharacterID","0"]; _ownerID = _obj getVariable["CharacterID","0"];
_ComboMatch = (_ownerID == dayz_combination); _ComboMatch = (_ownerID == dayz_combination);
if (DZE_permanentPlot) then {_ownerID = _obj getVariable["ownerPUID","0"];}; if (DZE_permanentPlot) then {_ownerID = _obj getVariable["ownerPUID","0"];};
if (_alreadyPacking == 1) exitWith {dayz_actionInProgress = false; format[localize "str_epoch_player_124",_text] call dayz_rollingMessages;};
if (_ComboMatch || (_ownerID == dayz_playerUID)) then { if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
// Check if any players are nearby if not allow player to claim item. (findDisplay 106) closeDisplay 0; // Close gear
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1; dze_waiting = nil;
// Only allow if not already claimed. [_unlockedClass,objNull] call fn_waitForObject;
if (_claimedBy == "0" || !_playerNear) then {
// Since item was not claimed proceed with claiming it.
_obj setVariable["claimed",dayz_playerUID,true];
};
_claimedBy = _obj getVariable["claimed","0"];
if (_claimedBy == dayz_playerUID) then { PVDZE_handleSafeGear = [player,_obj,0];
if (!isNull _obj && alive _obj) then { publicVariableServer "PVDZE_handleSafeGear";
_obj setVariable["packing",1]; //wait for response from server to verify safe was logged before proceeding
waitUntil {!isNil "dze_waiting"};
disableUserInput true; // Make sure player can not modify gear while it is filling
(findDisplay 106) closeDisplay 0; // Close gear format[localize "STR_BLD_UNLOCKED",_text] call dayz_rollingMessages;
dze_waiting = nil;
[_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"};
disableUserInput false; // Safe is done filling now
player playActionNow "Medic";
uiSleep 1;
[player,"tentpack",0,false] call dayz_zombieSpeak;
uiSleep 5;
format[localize "STR_BLD_UNLOCKED",_text] call dayz_rollingMessages;
};
} else {
dayz_actionInProgress = false;
format[localize "str_player_beinglooted",_text] call dayz_rollingMessages;
};
} else { } else {
PVDZE_handleSafeGear = [player,_obj,3,dayz_combination]; PVDZE_handleSafeGear = [player,_obj,3,dayz_combination];
publicVariableServer "PVDZE_handleSafeGear"; publicVariableServer "PVDZE_handleSafeGear";
player playActionNow "Medic";
uiSleep 1;
[player,"repair",0,false] call dayz_zombieSpeak; [player,"repair",0,false] call dayz_zombieSpeak;
[player,25,true,(getPosATL player)] spawn player_alertZombies; [player,25,true,(getPosATL player)] spawn player_alertZombies;
uiSleep 5;
format[localize "STR_BLD_WRONG_COMBO",_text] call dayz_rollingMessages; format[localize "STR_BLD_WRONG_COMBO",_text] call dayz_rollingMessages;
}; };
s_player_unlockvault = -1; s_player_unlockvault = -1;

View File

@@ -101,7 +101,7 @@ if (isServer) then {
"PVDZE_plr_TradeMenu" addPublicVariableEventHandler {(_this select 1) spawn server_traders}; "PVDZE_plr_TradeMenu" addPublicVariableEventHandler {(_this select 1) spawn server_traders};
}; };
"PVDZE_plr_DeathB" addPublicVariableEventHandler {(_this select 1) spawn server_deaths}; "PVDZE_plr_DeathB" addPublicVariableEventHandler {(_this select 1) spawn server_deaths};
"PVDZE_handleSafeGear" addPublicVariableEventHandler {(_this select 1) spawn server_handleSafeGear}; "PVDZE_handleSafeGear" addPublicVariableEventHandler {(_this select 1) call server_handleSafeGear};
if (dayz_groupSystem) then { if (dayz_groupSystem) then {
"PVDZ_Server_UpdateGroup" addPublicVariableEventHandler {(_this select 1) spawn server_updateGroup}; "PVDZ_Server_UpdateGroup" addPublicVariableEventHandler {(_this select 1) spawn server_updateGroup};
}; };

View File

@@ -11380,14 +11380,6 @@
<French>Vous avez été écrasé entre deux objets.</French> <French>Vous avez été écrasé entre deux objets.</French>
<Czech>Byl jste naražen mezi dva objekty.</Czech> <Czech>Byl jste naražen mezi dva objekty.</Czech>
</Key> </Key>
<Key ID="STR_EPOCH_PLAYER_10">
<English>Lock is already in progress.</English>
<German>Abschließen bereits im Gange.</German>
<Russian>Уже закрывается.</Russian>
<Dutch>Wordt al op slot gezet.</Dutch>
<French>Le verrouillage est déjà en cours.</French>
<Czech>Zamykání již probíhá.</Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_11"> <Key ID="STR_EPOCH_PLAYER_11">
<English>You cannot lock while another player is nearby.</English> <English>You cannot lock while another player is nearby.</English>
<German>Abschließen nicht möglich, während ein anderer Spieler in der Nähe ist.</German> <German>Abschließen nicht möglich, während ein anderer Spieler in der Nähe ist.</German>
@@ -11404,14 +11396,6 @@
<French>Impossible d'interrompre dans un marché!</French> <French>Impossible d'interrompre dans un marché!</French>
<Czech>Nelze se odpojit, když jste v trader area!</Czech> <Czech>Nelze se odpojit, když jste v trader area!</Czech>
</Key> </Key>
<Key ID="STR_EPOCH_PLAYER_15">
<English>That is already being packed.</English>
<German>Das ist schon gepackt.</German>
<Russian>Это уже упаковано.</Russian>
<Dutch>Dit wordt al reeds ingepakt.</Dutch>
<French>C'est déjà en cours d'empaquetage.</French>
<Czech>Toto již bylo zabaleno.</Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_16"> <Key ID="STR_EPOCH_PLAYER_16">
<English>You cannot pack while another player is nearby.</English> <English>You cannot pack while another player is nearby.</English>
<German>Packen nicht möglich, während ein anderer Spieler in der Nähe ist.</German> <German>Packen nicht möglich, während ein anderer Spieler in der Nähe ist.</German>
@@ -11885,14 +11869,6 @@
<French>Vous ne pouvez pas verrouiller %1, vous n'en connaissez pas la combinaison.</French> <French>Vous ne pouvez pas verrouiller %1, vous n'en connaissez pas la combinaison.</French>
<Czech>Nemůžete zamknout %1, neznáte správnou kombinaci.</Czech> <Czech>Nemůžete zamknout %1, neznáte správnou kombinaci.</Czech>
</Key> </Key>
<Key ID="STR_EPOCH_PLAYER_116">
<English>%1 is already being locked.</English>
<German>Diese(r) %1 wird bereits abgeschlossen.</German>
<Russian>%1 уже закрыт.</Russian>
<Dutch>Deze %1 wordt al op slot gezet.</Dutch>
<French>%1 est déjà verrouillé.</French>
<Czech>%1 již probíhá.</Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_117"> <Key ID="STR_EPOCH_PLAYER_117">
<English>Your %1 has been locked</English> <English>Your %1 has been locked</English>
<German>Dein %1 wurde abgeschlossen.</German> <German>Dein %1 wurde abgeschlossen.</German>
@@ -11941,14 +11917,6 @@
<French>Votre %1 a été emballé(e).</French> <French>Votre %1 a été emballé(e).</French>
<Czech>Vaše %1 bylo/y zabalen/y/o.</Czech> <Czech>Vaše %1 bylo/y zabalen/y/o.</Czech>
</Key> </Key>
<Key ID="STR_EPOCH_PLAYER_124">
<English>That %1 is already being unlocked.</English>
<German>%1 wird bereits aufgeschlossen.</German>
<Russian>%1 уже открыт.</Russian>
<Dutch>Deze %1 wordt alreeds van slot gehaald.</Dutch>
<French>%1 est déjà en cours de déverrouillage.</French>
<Czech>%1 se již odemyká.</Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_131"> <Key ID="STR_EPOCH_PLAYER_131">
<English>Filling up %1, move to cancel.</English> <English>Filling up %1, move to cancel.</English>
<German>Betanken von %1, bewege dich um den Vorgang abzubrechen.</German> <German>Betanken von %1, bewege dich um den Vorgang abzubrechen.</German>