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,6 +1,6 @@
private ["_vehicle","_started","_finished","_animState","_isMedic","_soundObject"];
private ["_vehicle","_finished","_soundObject"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_99" call dayz_rollingMessages;};
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
player removeAction s_player_fillgen;
@@ -9,56 +9,24 @@ s_player_fillgen = 1;
// Use target from addaction
_vehicle = _this select 3;
player playActionNow "Medic";
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
localize "str_epoch_player_100" call dayz_rollingMessages;
[player,50,true,(getPosATL player)] spawn player_alertZombies;
while {r_doLoop} do {
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if (_isMedic) then {
_started = true;
};
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
uiSleep 0.1;
};
r_doLoop = false;
_finished = ["Medic",1] call fn_loopAction;
if(!_finished) then {
r_interrupt = false;
if (vehicle player == player) then {
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
if (!_finished) then {
localize "str_epoch_player_26" call dayz_rollingMessages;
};
} else {
// find sound and delete
_soundObject = _vehicle getVariable "GeneratorSound";
if (_finished) then {
deleteVehicle _soundObject;
// find sound && delete
_soundObject = _vehicle getVariable "GeneratorSound";
deleteVehicle _soundObject;
// Stop generator
_vehicle setVariable ["GeneratorRunning", false,true];
// Stop generator
_vehicle setVariable ["GeneratorRunning",false,true];
localize "str_epoch_player_101" call dayz_rollingMessages;
localize "str_epoch_player_101" call dayz_rollingMessages;
};
dayz_actionInProgress = false;