_data = _vehicle getVariable ["Trunk",[]];
if ((count _data) isEqualTo 0) then {_vehicle setVariable ["Trunk",[[],0],true]; _data = [];} else {_data = (_data select 0);};
{
if ((_x select 0) isEqualTo getText (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "item_refuel")) exitWith {
_maxValue = (_x select 1);
};
} forEach _data;
_vehCargo = getItemCargo _vehicle;
for "_i" from 0 to ((count _vehCargo) - 1) do {
_currentItem =...
_data = _vehicle getVariable ["Trunk",[]];
if ((count _data) isEqualTo 0) then {_vehicle setVariable ["Trunk",[[],0],true]; _data = [];} else {_data = (_data select 0);};
{
if ((_x select 0) isEqualTo getText (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "item_refuel")) exitWith {
_maxValue = (_x select 1);
};
} forEach _data;
_vehCargo = getItemCargo _vehicle;
for "_i" from 0 to ((count _vehCargo) - 1) do {
_currentItem = (_vehCargo select 0) select _i;
if (_currentItem isEqualTo (getText (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "item_refuel"))) then {
_maxValue = (_vehCargo select 1) select _i;
};
};
_data = _vehicle getVariable ["Trunk",[]];
if ((count _data) isEqualTo 0) then {_vehicle setVariable ["Trunk",[[],0],true]; _data = [];} else {_data = (_data select 0);};
{
if ((_x select 0) isEqualTo getText (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "item_refuel")) exitWith {
_range = (_x select 1);
};
} forEach _data;
_vehCargo = getItemCargo _vehicle;
for "_i" from 0 to ((count _vehCargo) - 1) do {
_currentItem = (_vehCargo select 0) select _i;
if (_currentItem isEqualTo (getText (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "item_refuel"))) then {
_range = (_vehCargo select 1) select _i;
};
};
_data = _vehicle getVariable ["Trunk",[]];
if ((count _data) isEqualTo 0) then {_vehicle setVariable ["Trunk",[[],0],true]; _data = [];} else {_data = (_data select 0);};
{
if ((_x select 0) isEqualTo (getText (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "item_refuel"))) exitWith {
_range = ((_x select 1) * (getNumber (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "liters_per_item_refuel_station")));
};
} forEach _data;
_vehCargo = getItemCargo _vehicle;
for "_i" from 0 to ((count _vehCargo) - 1) do {
_currentItem = (_vehCargo select 0) select _i;
if (_currentItem isEqualTo (getText (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "item_refuel"))) then {
_range = ((_vehCargo select 1) select _i) * (getNumber (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _configName >> "liters_per_item_refuel_station"));
};
};
_data = _vehicle getVariable ["Trunk",[]];
if ((count _data) isEqualTo 0) then {_veh setVariable ["Trunk",[[],0],true]; _data = [];} else {_data = (_data select 0);};
{
if ((_x select 0) isEqualTo _itemVar) exitWith {
_fuelNow = (_x select 1);
};
} forEach _data;
_vehCargo = getItemCargo _vehicle;
for "_i" from 0 to ((count _vehCargo) - 1) do {
_currentItem = (_vehCargo select 0) select _i;
if (_currentItem isEqualTo _itemVar) then {
_fuelNow = (_vehCargo select 1) select _i;
};
};
_index = [_itemVar,((_vehicle getVariable "Trunk") select 0)] call TON_fnc_index;
_data = (_vehicle getVariable "Trunk") select 0;
_old = _vehicle getVariable "Trunk";
_itemsToRemove = (_fueltoput / getNumber (missionConfigFile >> "Max_Settings_FuelStations" >> "fuel_types" >> _fuelType >> "liters_per_item_refuel_station"));
_weight = ([_itemVar] call life_fnc_itemWeight) * _itemsToRemove;
if (_fuelNow == _itemsToRemove) then {
_data deleteAt _index;
} else {
_data set [_index,[_itemVar,(_fuelNow - _itemsToRemove)]];
};
_vehicle setVariable ["Trunk",[_data,(_old select 1) - _weight],true];
for "_i" from 1 to _itemsToRemove do {
_vehicle removeItem _itemVar;
};