Actions Done

This commit is contained in:
icomrade
2016-02-29 10:45:53 -05:00
parent a47c3dc137
commit b667d01c1c
27 changed files with 1958 additions and 1094 deletions

View File

@@ -1,29 +1,32 @@
private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_isMedic","_location1","_location2","_abort","_canNameEmpty","_canSizeEmpty","_canTypeEmpty","_canName","_canSize","_configCanEmpty","_configVeh","_capacity","_nameText","_availableCansEmpty"];
private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_isMedic","_location1","_location2","_abort","_canNameEmpty","_canSizeEmpty","_canTypeEmpty","_canName","_canSize","_configCanEmpty","_configVeh","_capacity","_nameText","_availableCansEmpty","_hasHose"];
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_98") , "PLAIN DOWN"] };
DZE_ActionInProgress = true;
player removeAction s_player_siphonfuel;
_hasHose = "equip_hose" in magazines player;
// Use target from addaction
_vehicle = _this select 0;
if (dayz_siphonFuelInProgress) exitWith { cutText [localize "str_siphon_inprogress", "PLAIN DOWN"] };
if (!_hasHose) exitWith {cutText [localize "str_siphon_hose", "PLAIN DOWN"] };
_PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 10]) > 1;
if (_PlayerNear) exitWith {cutText [localize "str_pickup_limit_5", "PLAIN DOWN"];};
dayz_siphonFuelInProgress = true;
_vehicle = _this select 3;
_abort = false;
// Static vehicle fuel information
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
_capacity = getNumber(_configVeh >> "fuelCapacity");
_nameText = getText(_configVeh >> "displayName");
_isMan = _vehicle isKindOf "Man";
_isAnimal = _vehicle isKindOf "Animal";
_isZombie = _vehicle isKindOf "zZombie_base";
_availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
// _availableCans = ["ItemJerrycan","ItemFuelBarrel"];
if (_isMan or _isAnimal or _isZombie) exitWith { cutText [localize "str_siphon_notvehicle", "PLAIN DOWN"] };
// Loop to find containers that can could hold fuel && fill them
// Loop to find containers that can could hold fuel and fill them
{
_configCanEmpty = configFile >> "CfgMagazines" >> _x;
//diag_log format["Looking for: %1", _x];
if(_x in _availableCansEmpty) then {
//diag_log format["gas fuelQuantity config : %1", _x];
if(_x in DayZ_fuelCansEmpty) then {
// Get Empty can size
_canNameEmpty = _x;
_canSizeEmpty = getNumber(_configCanEmpty >> "fuelQuantity");
@@ -34,28 +37,25 @@ _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
_canSize = getNumber(configFile >> "cfgMagazines" >> _canName >> "fuelQuantity");
// is empty
if(_canSizeEmpty == 0) then {
//diag_log format["is empty fuelQuantity : %1", _x];
if(_canSizeEmpty == 0) then {
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
// calculate new fuel
_newFuel = (_newFuel / _capacity);
if (_capacity == 0) then {
_newFuel = 0;
} else {
_newFuel = (_newFuel / _capacity);
};
if (_newFuel > 0) then {
cutText [format[(localize "str_epoch_player_133"),_canTypeEmpty], "PLAIN DOWN"];
cutText [format [localize "str_siphon_preparing",_canTypeEmpty], "PLAIN DOWN"];
_finished = false;
// alert zombies
[player,20,true,(getPosATL player)] spawn player_alertZombies;
_finished = false;
[player,20,true,(getPosATL player)] call player_alertZombies;
if(!dayz_isSwimming) then {
[1,1] call dayz_HungerThirst;
// force animation
player playActionNow "Medic";
@@ -70,14 +70,14 @@ _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
if (_isMedic) then {
_started = true;
};
if (_started && !_isMedic) then {
if (_started and !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
uiSleep 0.1;
sleep 0.1;
};
r_doLoop = false;
@@ -88,11 +88,10 @@ _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
player playActionNow "stop";
};
};
} else {
// Alternate method in water make sure player stays in one spot for 6 seconds
_location1 = getPosATL player;
uiSleep 6;
sleep 6;
_location2 = getPosATL player;
if(_location1 distance _location2 < 3) then {
_finished = true;
@@ -100,19 +99,19 @@ _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
};
if (_finished) then {
// Get vehicle fuel levels again
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
// calculate minimum needed fuel
_newFuel = (_newFuel / _capacity);
if (_capacity == 0) then {
_newFuel = 0;
} else {
_newFuel = (_newFuel / _capacity);
};
if (_newFuel > 0) then {
if(([player,_canNameEmpty] call BIS_fnc_invRemove) == 1) then {
/* PVS/PVC - Skaronator */
if (local _vehicle) then {
[_vehicle,_newFuel] call local_setFuel;
} else {
@@ -122,37 +121,37 @@ _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
// Play sound
[player,"refuel",0,false] call dayz_zombieSpeak;
// Add filled can
player addMagazine _canName;
cutText [format[(localize "str_epoch_player_171"),_nameText,_canSize], "PLAIN DOWN"];
// Added Nutrition-Factor for work
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
cutText [format [localize "str_siphon_drained",_nameText,_canSize], "PLAIN DOWN"];
call fnc_usec_medic_removeActions;
r_action = false;
uiSleep 1;
sleep 1;
} else {
_abort = true;
};
};
} else {
cutText [format[(localize "str_epoch_player_172"),_nameText], "PLAIN DOWN"];
cutText [format [localize "str_siphon_notenough",_nameText], "PLAIN DOWN"];
_abort = true;
};
};
} else {
cutText [(localize "str_epoch_player_35") , "PLAIN DOWN"];
cutText [localize "str_siphon_canceled", "PLAIN DOWN"];
_abort = true;
};
};
} else {
cutText [format[(localize "str_epoch_player_172"),_nameText], "PLAIN DOWN"];
cutText [format [localize "str_siphon_notenough",_nameText], "PLAIN DOWN"];
_abort = true;
};
};
};
};
};
// exit if abort flag was set
if(_abort) exitWith {};
} forEach magazines player;
} count magazines player;
DZE_ActionInProgress = false;
dayz_siphonFuelInProgress = false;