mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-11 10:42:58 +03:00
Added WIP Limited fuel in Refuel points.
Vanilla development commits:707a591765c453cdedd2Set to double vanilla default value since Epoch has a lot more large vehicles with 1000+ fuel capacity.
This commit is contained in:
@@ -1,20 +1,34 @@
|
||||
if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_34" call dayz_rollingMessages;};
|
||||
DZE_ActionInProgress = true;
|
||||
private ["_qty","_dis","_sfx","_started","_finished","_animState","_isRefuel","_fuelcans","_qty20","_qty5","_qty40"];
|
||||
private ["_qty","_dis","_sfx","_started","_finished","_animState","_isRefuel","_fuelcans","_qty20","_qty5","_qty40","_magazines","_cursorTarget","_fuelAmount"];
|
||||
|
||||
player removeAction s_player_fillfuel;
|
||||
//s_player_fillfuel = -1;
|
||||
_cursorTarget = _this select 3;
|
||||
_magazines = magazines player;
|
||||
|
||||
//Limit Fuel in tankers
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (isNil "_fuelAmount") then {
|
||||
_fuelAmount = floor(Random dayz_randomMaxFuelAmount);
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
};
|
||||
|
||||
if (_fuelAmount < 5) exitWith { format[localize "str_fill_notenough",typeOf _cursorTarget,_fuelAmount] call dayz_rollingMessages; };
|
||||
|
||||
diag_log format["Fill Jerry, %1 - %2",_cursorTarget,_fuelAmount];
|
||||
|
||||
_fuelcans = ["ItemFuelcanEmpty","ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
|
||||
|
||||
_qty = 0;
|
||||
_qty = {_x in _fuelcans} count magazines player;
|
||||
_qty = {_x in _fuelcans} count _magazines;
|
||||
|
||||
_qty20 = {_x == "ItemJerrycanEmpty"} count magazines player;
|
||||
_qty5 = {_x == "ItemFuelcanEmpty"} count magazines player;
|
||||
_qty40 = {_x == "ItemFuelBarrelEmpty"} count magazines player;
|
||||
_qty20 = {_x == "ItemJerrycanEmpty"} count _magazines;
|
||||
_qty5 = {_x == "ItemFuelcanEmpty"} count _magazines;
|
||||
_qty40 = {_x == "ItemFuelBarrelEmpty"} count _magazines;
|
||||
|
||||
if (("ItemJerrycanEmpty" in magazines player) or ("ItemFuelcanEmpty" in magazines player) or ("ItemFuelBarrelEmpty" in magazines player)) then {
|
||||
if (("ItemJerrycanEmpty" in _magazines) or ("ItemFuelcanEmpty" in _magazines) or ("ItemFuelBarrelEmpty" in _magazines)) then {
|
||||
player playActionNow "Medic";
|
||||
|
||||
_dis=5;
|
||||
@@ -45,20 +59,46 @@ if (("ItemJerrycanEmpty" in magazines player) or ("ItemFuelcanEmpty" in magazine
|
||||
|
||||
if (_finished) then {
|
||||
for "_x" from 1 to _qty20 do {
|
||||
player removeMagazine "ItemJerrycanEmpty";
|
||||
player addMagazine "ItemJerrycan";
|
||||
_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 _qty5 do {
|
||||
player removeMagazine "ItemFuelcanEmpty";
|
||||
player addMagazine "ItemFuelcan";
|
||||
_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 _qty40 do {
|
||||
player removeMagazine "ItemFuelBarrelEmpty";
|
||||
player addMagazine "ItemFuelBarrel";
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 40) then {
|
||||
_fuelAmount = _fuelAmount - 40;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemFuelBarrelEmpty";
|
||||
player addMagazine "ItemFuelBarrel";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
format[localize "str_player_09",_qty] call dayz_rollingMessages;
|
||||
//format[localize "str_player_09",_qty] call dayz_rollingMessages;
|
||||
format[localize "str_fill_success",_qty,typeOf _cursorTarget,_fuelAmount] call dayz_rollingMessages;
|
||||
//diag_log format[localize "str_fill_success",_qty,typeOf _cursorTarget,_fuelAmount];
|
||||
} else {
|
||||
localize "str_player_10" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user