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 @@
if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
dayz_actionInProgress = true;
private ["_object","_proceed","_rndattemps","_limit","_dismantleToo","_ownerID","_objectID","_objectUID","_playerID","_claimedBy","_tools","_exit","_end","_onLadder","_isWater","_isOk","_counter","_text","_dis","_sfx","_animState","_started","_finished","_isMedic"];
private ["_object","_proceed","_rndattemps","_limit","_dismantleToo","_ownerID","_objectID","_objectUID","_playerID","_claimedBy","_tools","_exit","_end","_onLadder","_isWater","_isOk","_counter","_text","_dis","_sfx","_finished"];
_object = _this;
_proceed = false;
@@ -67,43 +67,14 @@ while {_isOk} do {
if (_claimedBy != _playerID) exitWith { format[localize "str_player_beinglooted",_text] call dayz_rollingMessages; };
//Run animation
player playActionNow "Medic";
//Run SFX
_dis=20;
_sfx = "repair";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
// Working-Factor for chopping wood.
["Working",0,[100,15,10,0]] call dayz_NutritionSystem;
//Setup Vars
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
//run animation loop
while {r_doLoop} do {
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt or (player getVariable["combattimeout",0] >= diag_tickTime)) then {
r_doLoop = false;
_finished = false;
};
uiSleep 0.1;
};
r_doLoop = false;
//Run animation loop
_finished = ["Medic",1,{player getVariable["combattimeout",0] >= diag_tickTime}] call fn_loopAction;
//Interrupt and end
if(!_finished) exitWith {
@@ -112,7 +83,9 @@ while {_isOk} do {
};
//Everything happened as it should
if(_finished) then {
if(_finished) then {
// Working-Factor for chopping wood.
["Working",0,[100,15,10,0]] call dayz_NutritionSystem;
//Add to Counter
_counter = _counter + 1;
//Try to dismantle