Add medic anim function with proper interrupt

Closes #1386

Vanilla commits
applied:
f99a3deced
731b957e8e

Removed
two unused files and a few variables made redundant by actionInProgress
This commit is contained in:
ebayShopper
2017-06-06 15:24:59 -04:00
parent 36b67affee
commit 48858b2e6c
61 changed files with 507 additions and 1341 deletions

View File

@@ -1,7 +1,7 @@
/*
[_obj] spawn player_packVault;
*/
private ["_obj","_ownerID","_objectID","_objectUID","_alreadyPacking","_location1","_location2","_packedClass","_text","_playerNear"];
private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_15" call dayz_rollingMessages;};
dayz_actionInProgress = true;
@@ -13,6 +13,7 @@ _text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
// Silently exit if object no longer exists
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
_playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;};
@@ -29,10 +30,6 @@ if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = fal
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith { dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;};
_alreadyPacking = _obj getVariable["packing",0];
if (_alreadyPacking == 1) exitWith {dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_120",_text] call dayz_rollingMessages;};
_obj setVariable["packing",1];
format[localize "str_epoch_player_121",_text] call dayz_rollingMessages;
uiSleep 1;
_location1 = getPosATL player;
@@ -41,18 +38,18 @@ _location2 = getPosATL player;
if(_location1 distance _location2 > 0.1) exitWith {
format[localize "str_epoch_player_122",_text] call dayz_rollingMessages;
_obj setVariable["packing",0];
s_player_packvault = -1;
dayz_actionInProgress = false;
};
if (!isNull _obj && alive _obj) then {
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
player playActionNow "Medic";
[player,"tentpack",0,false] call dayz_zombieSpeak;
uiSleep 3;
disableUserInput true; // Make sure player can not modify gear while it is being added
_finished = ["Medic",1] call fn_loopAction;
if (isNull _obj or !_finished) exitWith {};
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
(findDisplay 106) closeDisplay 0; // Close gear
dze_waiting = nil;
@@ -62,7 +59,6 @@ if (!isNull _obj && alive _obj) then {
publicVariableServer "PVDZE_handleSafeGear";
//wait for response from server to verify pack was logged and gear added before proceeding
waitUntil {!isNil "dze_waiting"};
disableUserInput false; // Gear is done being added now
format[localize "str_epoch_player_123",_text] call dayz_rollingMessages;
};