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

@@ -3,6 +3,7 @@
[ADDED] Classname C130J_US_EP1_DZ Weapon: 50 Magazine: 400 Backpack: 10 @Fank
[ADDED] Variable DZE_ForceNameTagsInTrader to force name tags in traders. @Skaronator @Fank
[ADDED] Switch seats in all vehicles. @icomrade
[ADDED] Self transfusions (works in vehicles) must be enabled in mission using DZE_SelfTransfuse. @icomrade
[FIXED] Instance already initialized error in server_monitor.sqf @vbawol
[FIXED] Fixed infinite chainsaw fuel when put into vaults/lockboxes. @SilvDev

View File

@@ -390,4 +390,21 @@ class ItemHotwireKit: CA_Magazine {
picture = "\z\addons\dayz_epoch\pictures\equip_hotwire_ca.paa";
descriptionShort = "Used to temporarily unlock and start a vehicle has a chance of failure and is consumed on use.";
weight = 2;
};
class ItemBloodbag: CA_Magazine
{
scope = 2;
count = 1;
type = 256;
displayName = "$STR_EQUIP_NAME_16";
model = "\dayz_equip\models\bloodbag.p3d";
picture = "\dayz_equip\textures\equip_bloodbag_ca.paa";
descriptionShort = "$STR_EQUIP_DESC_16";
class ItemActions {
class use {
text = "Self transfusion";
script = "spawn player_useMeds;";
};
};
};

View File

@@ -10,7 +10,6 @@ _config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
if (!_hasmeditem) exitWith {cutText [format[(localize "str_player_31"),_text,"use"] , "PLAIN DOWN"]};
switch (_item) do {
case "ItemBandage": {
_id = [0,0,0,[player]] execVM "\z\addons\dayz_code\medical\bandage.sqf";
@@ -24,6 +23,9 @@ switch (_item) do {
case "ItemAntibiotic": {
_id = [0,0,0,[player]] execVM "\z\addons\dayz_code\medical\antibiotics.sqf";
};
case "ItemBloodbag": {
_id = [0,0,0,[player]] execVM "\z\addons\dayz_code\medical\self_transfusion.sqf";
};
case "ItemHeatPack": {
player removeMagazine "ItemHeatPack";
dayz_temperatur = (dayz_temperatur + 5) min dayz_temperaturmax;

View File

@@ -5,7 +5,7 @@ _button = _this select 1;
_parent = findDisplay 106;
//if ((time - dayzClickTime) < 1) exitWith {};
if (!DZE_SelfTransfuse && ((gearSlotData _control) == "ItemBloodBag")) exitWith {};
if (_button == 1) then {
//dayzClickTime = time;
_group = _parent displayCtrl 6902;

View File

@@ -436,7 +436,11 @@ dayz_spawnArea = 200; // radius around player where we can spawn loot & Z
dayz_cantseeDist = 150; // distance from which we can spawn a Z in front of any player without ray-tracing and angle checks
dayz_cantseefov = 70; // half player field-of-view. Visible Z won't be spawned in front of any near players
dayz_canDelete = 300; // Z, further than this distance from its "owner", will be deleted
selfTransfusionTime = -300; //time to keep for last self transfusion.
if(isNil "DZE_SelfTransfuse") then {
DZE_SelfTransfuse = false;
};
if(isNil "dayz_maxAnimals") then {
dayz_maxAnimals = 5;
};

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 {

View File

@@ -1153,14 +1153,14 @@
<Czech>Uhasit %1</Czech>
</Key>
<Key ID="str_actions_medical_18">
<Original>You cannot perform another blood transfusion so fast</Original>
<English>You cannot perform another blood transfusion so fast</English>
<German>Sie können so schnell keine weitere Bluttransfusion durchführen</German>
<Russian>Вы не можете переливать кровь так быстро</Russian>
<Spanish>No puedes realizar otra transfución de sangre tan rápido.</Spanish>
<Dutch>Je kunt niet zosnel aaneenvolgend een bloedtransfusie uitvoeren</Dutch>
<French>Vous ne pouvez pas faire d'autre transfusion de sang aussi rapidement</French>
<Czech>Nelze znovu provést krevní transfúzi tak rychle po sobě.</Czech>
<Original>You cannot perform another blood transfusion so fast, wait %1 seconds</Original>
<English>You cannot perform another blood transfusion so fast, wait %1 seconds</English>
<German>Sie können eine weitere Bluttransfusion so schnell nicht durchführen, warten Sie %1 Sekunden.</German>
<Russian>Вы не можете выполнить другую переливание крови так быстро, подождите %1 секунд.</Russian>
<Spanish>No es posible realizar otra transfusión de sangre tan rápido, esperar %1 segundos.</Spanish>
<Dutch>U kunt een bloedtransfusie niet uit te voeren zo snel, wacht %1 seconden.</Dutch>
<French>Vous ne pouvez pas effectuer une autre transfusion sanguine si vite, attendez %1 secondes.</French>
<Czech>Nemůžete provádět další krevní transfuzi tak rychle, počkejte %1 sekund.</Czech>
</Key>
<Key ID="str_action_studybody">
<Original>Study Body</Original>