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

@@ -1,16 +1,14 @@
// animHealed.sqf
private ["_array","_unit","_medic","_display","_control","_rndInfection","_TransfusionInfection"];
private ["_array","_unit","_display","_control","_rndInfection","_TransfusionInfection"];
disableserialization;
_array = _this; //_this select 0;
_unit = _array select 0;
_medic = _array select 1;
_unit = _this select 0;
_rndInfection = (random 15);
_TransfusionInfection = (_rndInfection < 1);
if (_unit == player) then {
r_player_blood = r_player_bloodTotal;
r_player_lowblood = false;
r_player_lowblood = false;
10 fadeSound 1;
"dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5;
"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1], [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5;

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";
};

View File

@@ -4,7 +4,7 @@ _unit = (_this select 3) select 0;
//_lowBlood = _unit getVariable ["USEC_lowBlood", false];
//_injured = _unit getVariable ["USEC_injured", false];
//_inPain = _unit getVariable ["USEC_inPain", false];
_lastused = _unit getVariable ["LastTransfusion", time];
//_lastused = _unit getVariable ["LastTransfusion", time];
// if (_lastused - time < 60) exitwith {cutText [format[(localize "str_actions_medical_18"),_text] , "PLAIN DOWN"]};
@@ -41,7 +41,7 @@ while {r_doLoop} do {
r_doLoop = false;
if (_finished) then {
_unit setVariable["LastTransfusion",time,true];
//_unit setVariable["LastTransfusion",time,true]; //reserve for self transfusion
_unit setVariable["USEC_lowBlood",false,true];
_num_removed = ([player,"ItemBloodbag"] call BIS_fnc_invRemove);
if(_num_removed == 1) then {