mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-25 19:26:08 +03:00
Add files via upload
These files are either new or have extensive edits.
This commit is contained in:
@@ -1,153 +1,61 @@
|
||||
private ["_unit","_blood","_lowBlood","_injured","_inPain","_animState","_started","_finished","_timer","_i","_isMedic","_duration","_rhVal","_bloodBagArrayNeeded","_BBneeded","_bbselect","_bloodBagNeeded","_badBag","_wholeBag","_bagFound","_bagToRemove","_forceClose","_bloodType","_rh","_bloodBagArray","_bbarray_length","_bloodBagWholeNeeded","_haswholebag","_r","_transfusionInfection"];
|
||||
private ["_msg","_unit","_bagUsed","_duration","_rhVal","_badBag","_bloodType","_bloodBagWholeNeeded","_wholeBag","_transfusionInfection","_finished","_bloodAmount"];
|
||||
|
||||
// Check to see if enough time has passed since the last self-transfusion.
|
||||
if (time - dayz_lastSelfTransfusion <= DZE_selfTransfuse_Values select 2) exitWith {localize "str_actions_medical_18" call dayz_rollingMessages;};
|
||||
|
||||
// bleed.sqf
|
||||
_unit = _this select 0;
|
||||
_bagUsed = _this select 1;
|
||||
|
||||
_blood = _unit getVariable ["USEC_BloodQty", 0];
|
||||
_lowBlood = _unit getVariable ["USEC_lowBlood", false];
|
||||
_injured = _unit getVariable ["USEC_injured", false];
|
||||
_inPain = _unit getVariable ["USEC_inPain", false];
|
||||
if (time - dayz_lastSelfTransfusion <= DZE_selfTransfuse_Values select 2) exitWith {localize "str_actions_medical_18" call dayz_rollingMessages;};
|
||||
|
||||
call gear_ui_init;
|
||||
closeDialog 0;
|
||||
|
||||
_bloodType = _unit getVariable ["blood_type", false];
|
||||
_rh = _unit getVariable ["rh_factor", false];
|
||||
|
||||
_badBag = false;
|
||||
_wholeBag = false;
|
||||
_bagFound = false;
|
||||
_BBneeded = false;
|
||||
_forceClose = false;
|
||||
_transfusionInfection = if (DZE_selfTransfuse_Values select 1 <= 0) then {false} else {((random 100) < (DZE_selfTransfuse_Values select 1))};
|
||||
|
||||
|
||||
if (_blood <= 4000) then {
|
||||
_duration = 3;
|
||||
} else {
|
||||
_duration = 2;
|
||||
};
|
||||
|
||||
_bloodBagArray = ["wholeBloodBagANEG","wholeBloodBagAPOS","wholeBloodBagBNEG","wholeBloodBagBPOS","wholeBloodBagABNEG","wholeBloodBagABPOS","wholeBloodBagONEG","wholeBloodBagOPOS"];
|
||||
|
||||
if (_rh) then {_rhVal = "POS";} else {_rhVal = "NEG";};
|
||||
|
||||
|
||||
//No subs for whole blood :(
|
||||
_bloodBagWholeNeeded = "wholeBloodBag" + _bloodType + _rhVal;
|
||||
_haswholebag = _bloodBagWholeNeeded in magazines player;
|
||||
|
||||
if (_haswholebag) then {
|
||||
_wholeBag = true;
|
||||
} else {
|
||||
_badBag = true;
|
||||
};
|
||||
|
||||
if (dayz_classicBloodBagSystem) then {_wholeBag = true; _badBag = false;};
|
||||
|
||||
call fnc_usec_medic_removeActions;
|
||||
r_action = false;
|
||||
|
||||
if (vehicle player == player) then {
|
||||
//not in a vehicle
|
||||
player playActionNow "Medic";
|
||||
};
|
||||
|
||||
r_interrupt = false;
|
||||
_animState = animationState player;
|
||||
r_doLoop = true;
|
||||
_started = false;
|
||||
_msg = "";
|
||||
_finished = false;
|
||||
_timer = diag_tickTime;
|
||||
_i = 0;
|
||||
_r = 0;
|
||||
_transfusionInfection = if (DZE_selfTransfuse_Values select 1 <= 0) then {false} else {((random 100) < (DZE_selfTransfuse_Values select 1))};
|
||||
_duration = if ((_unit getVariable ["USEC_BloodQty", 0]) <= 4000) then {3} else {2};
|
||||
|
||||
while {r_doLoop and (_i < 12)} do {
|
||||
_animState = animationState player;
|
||||
_isMedic = ["medic",_animState] call fnc_inString;
|
||||
|
||||
if (((vehicle player != player) || _isMedic) and !_started) then {
|
||||
closeDialog 0;
|
||||
diag_log format ["TRANSFUSION: starting blood transfusion (%1 > %2)", name player, name _unit];
|
||||
if (_badBag) then {
|
||||
for "_r" from 0 to 15 do {
|
||||
_bagToRemove = _bagUsed;
|
||||
if (_bagToRemove in magazines player) exitWith { //TODO: add separate action menu options so the removed bag isn't random
|
||||
_bagFound = true;
|
||||
if (_r >= 8) then {
|
||||
_wholeBag = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if (_wholeBag) then {_bagToRemove = _bloodBagWholeNeeded; };
|
||||
if (dayz_classicBloodBagSystem) then { _bagToRemove = _bagUsed; };
|
||||
if (_bagToRemove in magazines player) then { _bagFound = true; };
|
||||
};
|
||||
if (!_bagFound) then {_forceClose = true;} else { player removeMagazine _bagToRemove;};
|
||||
localize "str_actions_medical_transfusion_start" call dayz_rollingMessages;
|
||||
_started = true;
|
||||
};
|
||||
|
||||
if (_started) then {
|
||||
if ((diag_tickTime - _timer) >= 1) then {
|
||||
_timer = diag_tickTime;
|
||||
_i = _i + 3;
|
||||
if (!_badBag) then {
|
||||
if (!_forceClose) then {
|
||||
if (!_wholeBag) then {
|
||||
_randomamount = round(random 60);
|
||||
r_player_blood = r_player_blood + 100 + _randomamount;
|
||||
} else {
|
||||
_randomamount = round(random 200);
|
||||
r_player_blood = (r_player_blood + ((DZE_selfTransfuse_Values select 0)/4)) min r_player_bloodTotal;
|
||||
};
|
||||
|
||||
//PVDZ_send = [_unit,"Transfuse",[_unit,player,1000]];
|
||||
//publicVariableServer "PVDZ_send";
|
||||
};
|
||||
} else {
|
||||
if (!_forceClose and (_i >= 12)) then {
|
||||
[_unit, _duration] call fnc_usec_damageUnconscious;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (vehicle player == player) then {
|
||||
if (!_isMedic) then {
|
||||
player playActionNow "Medic";
|
||||
};
|
||||
} else {
|
||||
uisleep 4;
|
||||
};
|
||||
};
|
||||
|
||||
_blood = _unit getVariable ["USEC_BloodQty", 0];
|
||||
|
||||
if (((_blood >= r_player_bloodTotal) and !_badBag and _bagFound) or (_i == 12)) then {
|
||||
diag_log format ["TRANSFUSION: completed blood transfusion successfully (_i = %1)", _i];
|
||||
dayz_lastSelfTransfusion = time;
|
||||
if (_transfusionInfection) then {r_player_infected = true; player setVariable["USEC_infected",true,true];};
|
||||
localize "str_actions_medical_transfusion_successful" call dayz_rollingMessages;
|
||||
r_doLoop = false;
|
||||
};
|
||||
|
||||
if (r_interrupt or _forceClose) then {
|
||||
diag_log format ["TRANSFUSION: transfusion was interrupted (r_interrupt: %1 | distance: %2 | _i = %3)", r_interrupt, player distance _unit, _i];
|
||||
localize "str_actions_medical_transfusion_interrupted" call dayz_rollingMessages;
|
||||
r_doLoop = false;
|
||||
};
|
||||
|
||||
uiSleep 0.1;
|
||||
if (!dayz_classicBloodBagSystem) then {
|
||||
// A player can only self blood bag with a whole typed bag or the classic ItemBloodbag.
|
||||
// If not using dayz_classicBloodBagSystem then the player needs to know his/her blood type or use wholeBloodBagONEG.
|
||||
_bloodType = _unit getVariable ["blood_type", ""];
|
||||
_rhVal = if (_unit getVariable ["rh_factor", false]) then {"POS"} else {"NEG"};
|
||||
_bloodBagWholeNeeded = "wholeBloodBag" + _bloodType + _rhVal;
|
||||
_wholeBag = _bagUsed in ["wholeBloodBagONEG",_bloodBagWholeNeeded];
|
||||
if (!_wholeBag) then {_badBag = true;};
|
||||
};
|
||||
|
||||
r_doLoop = false;
|
||||
_bloodAmount = if (!_wholeBag) then {(DZE_selfTransfuse_Values select 0)} else {4000};
|
||||
|
||||
if (r_interrupt) then {
|
||||
r_interrupt = false;
|
||||
if (vehicle player == player) then {
|
||||
player switchMove "";
|
||||
player playActionNow "stop";
|
||||
localize "str_actions_medical_transfusion_start" call dayz_rollingMessages;
|
||||
_unit removeMagazine _bagUsed;
|
||||
|
||||
// Players can self blood bag in a vehicle so we use this simple method.
|
||||
if (vehicle player == player) then {
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
} else {
|
||||
uiSleep 3;
|
||||
_finished = true;
|
||||
};
|
||||
|
||||
if (!_finished) then {
|
||||
_unit addMagazine _bagUsed;
|
||||
_msg = "str_actions_medical_transfusion_interrupted";
|
||||
} else {
|
||||
if (!_badBag) then {
|
||||
r_player_blood = (r_player_blood + _bloodAmount) min r_player_bloodTotal;
|
||||
_msg = "str_actions_medical_transfusion_successful";
|
||||
} else {
|
||||
// Player gets knocked unconscious and receives no blood if wrong type is used.
|
||||
[_unit, _duration] call fnc_usec_damageUnconscious;
|
||||
_msg = "str_actions_medical_transfusion_fail";
|
||||
};
|
||||
dayz_lastSelfTransfusion = time;
|
||||
if (_transfusionInfection) then {
|
||||
r_player_infected = true;
|
||||
player setVariable["USEC_infected",true,true];
|
||||
};
|
||||
};
|
||||
|
||||
localize _msg call dayz_rollingMessages;
|
||||
Reference in New Issue
Block a user