Add optional self transfuse

Right click on blood bag, if enable it will show the self transfuse
button.
Currently replenishes all blood.
May be used once every 5 minutes.
This commit is contained in:
icomrade
2014-03-19 18:03:11 -04:00
parent 1d9e361ef4
commit 22bfba6573
9 changed files with 94 additions and 17 deletions

View File

@@ -0,0 +1,55 @@
private ["_started","_finished","_animState","_isMedic","_num_removed","_unit","_lastused"];
if (!DZE_SelfTransfuse) exitWith {};
_unit = player;
_lastused = selfTransfusionTime;
if ((round(time - _lastused)) <= 300) exitWith {cutText [format[(localize "str_actions_medical_18"),(300 - (round(time - _lastused)))] , "PLAIN DOWN"]};
call fnc_usec_medic_removeActions;
r_action = false;
if (vehicle player == player) then {
player playActionNow "Medic";
};
[1,1] call dayz_HungerThirst;
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
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) then {
r_doLoop = false;
};
if (vehicle player != player) then {
sleep 6;
r_doLoop = false;
_finished = true;
};
sleep 0.1;
};
r_doLoop = false;
if (_finished) then {
selfTransfusionTime = time;
_unit setVariable["USEC_lowBlood",false,true];
_num_removed = ([player,"ItemBloodbag"] call BIS_fnc_invRemove);
if(_num_removed == 1) then {
if (vehicle player != player) then {
(findDisplay 106) closeDisplay 0;
};
[_unit] call player_medTransfuse;
};
} else {
r_interrupt = false;
player switchMove "";
player playActionNow "stop";
};