mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Add medic anim function with proper interrupt
Closes #1386 Vanilla commits applied:f99a3deced731b957e8eRemoved two unused files and a few variables made redundant by actionInProgress
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
private ["_qty","_dis","_sfx","_started","_finished","_animState","_isRefuel","_qty20","_qty5","_qty210","_magazines","_cursorTarget","_fuelAmount","_fuelNeeded"];
|
||||
private ["_qty","_dis","_sfx","_finished","_qty20","_qty5","_qty210","_magazines","_cursorTarget","_fuelAmount","_fuelNeeded"];
|
||||
|
||||
player removeAction s_player_fillfuel;
|
||||
//s_player_fillfuel = -1;
|
||||
@@ -29,70 +29,51 @@ if (_fuelAmount < _fuelNeeded) then {format[localize "str_fill_notenough",typeOf
|
||||
if (_fuelAmount < 5 or (_fuelAmount < 20 && _qty5 == 0) or (_fuelAmount < 210 && (_qty5 == 0 && _qty20 == 0))) exitWith {dayz_actionInProgress = false;};
|
||||
|
||||
if (_qty > 0) then {
|
||||
player playActionNow "Medic";
|
||||
|
||||
_dis=5;
|
||||
_sfx = "refuel";
|
||||
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (!_finished) exitWith {};
|
||||
|
||||
// Added Nutrition-Factor for work
|
||||
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
|
||||
|
||||
r_doLoop = true;
|
||||
_started = false;
|
||||
_finished = false;
|
||||
while {r_doLoop} do {
|
||||
_animState = animationState player;
|
||||
_isRefuel = ["medic",_animState] call fnc_inString;
|
||||
if (_isRefuel) then {
|
||||
_started = true;
|
||||
|
||||
for "_x" from 1 to _qty5 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 5) then {
|
||||
_fuelAmount = _fuelAmount - 5;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemFuelcanEmpty";
|
||||
player addMagazine "ItemFuelcan";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
if (_started and !_isRefuel) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
uiSleep 0.1;
|
||||
};
|
||||
|
||||
r_doLoop = false;
|
||||
|
||||
if (_finished) then {
|
||||
for "_x" from 1 to _qty5 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 5) then {
|
||||
_fuelAmount = _fuelAmount - 5;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemFuelcanEmpty";
|
||||
player addMagazine "ItemFuelcan";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
for "_x" from 1 to _qty20 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 20) then {
|
||||
_fuelAmount = _fuelAmount - 20;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemJerrycanEmpty";
|
||||
player addMagazine "ItemJerrycan";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
for "_x" from 1 to _qty20 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 20) then {
|
||||
_fuelAmount = _fuelAmount - 20;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemJerrycanEmpty";
|
||||
player addMagazine "ItemJerrycan";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
};
|
||||
for "_x" from 1 to _qty210 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 210) then {
|
||||
_fuelAmount = _fuelAmount - 210;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemFuelBarrelEmpty";
|
||||
player addMagazine "ItemFuelBarrel";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
};
|
||||
for "_x" from 1 to _qty210 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 210) then {
|
||||
_fuelAmount = _fuelAmount - 210;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemFuelBarrelEmpty";
|
||||
player addMagazine "ItemFuelBarrel";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user