[Release] BDC's Enhanced Jerry/Fuel Can Filling (pwnzor0z 1.7.7.1)

BDC

Well-Known Member
Hey zed heads, this addon I wrote was one of the first I did a couple of weeks back. I've been making slight tweaks here and there since and I think it's finally ready for public consumption. I didn't like the way the original jerry can/fuel can filling code was done (as it lacked some realism in my opinion) so I re-wrote it. It replaces the jerry_fill.sqf file located in \z\addons\dayz_code\actions. This replaces the generic "fill jerrycan" option that pops up when you're on top of or next to a fuel tank object.

This script is meant for filling 20L and 5L cans when at fuel tanks. I've also added code to make it recognize gas pumps at stations as well (and hopefully I've included all of them).

There is a potential for three different types of scroll options (actions) that can occur depending upon the amount and type of can(s) the player has. All three options will point to the same script file which gathers the player's inventory and goes from there. The script handles the filling times differently between the two types of cans (which are configurable for admins), shows when each can has been filled, and how long the entire process will take (which can also be interrupted).

The script is called from a modification done to fn_selfActions.sqf.

On to the installation!

Step 1) Modify fn_selfActions.sqf

Note: For those that may not be familiar with this process, the fn_selfActions.sqf script file is packed in the dayz_code.pbo (within its \compile folder) file that is located in \dayzinstallfolder\@dayz\addons\ folder. The dayz_code.pbo file must be unpacked and the two files compiles.sqf and fn_selfActions.sqf placed in \dayzinstallfolder\MPMissions\dayz_1.Chernarus and the fixes subfolder of that folder, respectively with compiles.sqf having been modified to point to the new fn_selfActions.sqf script file.

On or around line 120 of an unmodified fn_selfActions.sqf script file, there is a commented out line that starts a section for filling the jerrycan. The section in code looks like this:

Code:
//Allow player to fill Fuel can
    if((_hasFuelE20 or _hasFuelE5) and _isFuel and _canDo and !a_player_jerryfilling) then {
        if (s_player_fillfuel < 0) then {
            s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
        };
    } else {
        player removeAction s_player_fillfuel;
        s_player_fillfuel = -1;
    };

Completely delete and replace that entire section with this instead:

Code:
//Allow player to fill Fuel can at fuel tank
    if((_hasFuelE20 or _hasFuelE5) and (_isFuel or _isGasPump) and _canDo and !a_player_jerryfilling) then {
        if (s_player_fillfuel < 0) then {
            if (_MultipleCans) then {
              s_player_fillfuel = player addAction [("<t color=""#FF7000"">" + ("Fill ALL empty 20L and 5L fuel cans") + "</t>"), "fixes\player_jerryfuelcanfill.sqf",[], 1, false, true, "", ""];
            } else {
              if (_hasFuelE20) then {
                s_player_fillfuel = player addAction [("<t color=""#FF7000"">" + ("Fill empty 20L jerry can") + "</t>"), "fixes\player_jerryfuelcanfill.sqf",[], 1, false, true, "", ""];
              } else {
                s_player_fillfuel = player addAction [("<t color=""#FF7000"">" + ("Fill empty 5L fuel can") + "</t>"), "fixes\player_jerryfuelcanfill.sqf",[], 1, false, true, "", ""];
              };
            };
        };
    } else {
        player removeAction s_player_fillfuel;
        s_player_fillfuel = -1;
    };

Up towards the earlier parts of the file, around line 85 or so, there exists a section:

Code:
if (_hasFuelE20 or _hasFuelE5) then {
        _isFuel = (cursorTarget isKindOf "Land_Ind_TankSmall") or (cursorTarget isKindOf "Land_fuel_tank_big") or (cursorTarget isKindOf "Land_fuel_tank_stairs") or (cursorTarget isKindOf "Land_wagon_tanker");
    };

Replace that section with this:

Code:
if (_hasFuelE20 or _hasFuelE5) then {
        _isFuel = (cursorTarget isKindOf "Land_Ind_TankSmall") or (cursorTarget isKindOf "Land_fuel_tank_big") or (cursorTarget isKindOf "Land_fuel_tank_stairs") or (cursorTarget isKindOf "Land_wagon_tanker");
        _isGasPump = (cursorTarget isKindOf "Land_A_Fuelstation_Feed") or (cursorTarget isKindOf "Land_Ind_Fuelstation_Feed_EP1") or (cursorTarget isKindOf "Land_Fuelstation_Feed_PMC");
    };

Further up still in the same file, around line 69, there exists this line:

Code:
_isFuel = false;

Directly below it, add this:

Code:
_isGasPump = false;
_MultipleCans = false;
if (((_Qty20 > 1) or (_Qty5 > 1)) or ((_Qty20 == 1) and (_Qty5 == 1))) then {
_MultipleCans = true;
};

Save the file and close it out. We're done here.

Step 2) Download player_jerryfuelcanfill.sqf and install

You can download the file directly off Mediafire from here -> http://www.mediafire.com/?4uofyt4l8cjgigi

Once acquired, place it in the \dayzinstallfolder\MPMissions\dayz_1.Chernarus\fixes folder. If there's a problem downloading the file, I will post the complete file in CODE section in a post directly below for easy, manual re-creation of the file.

That should be it. I've posted up a "help" thread over in the Scripting/Addons help section if anyone needs anything. It is located here:

http://opendayz.net/threads/bdcs-script-addon-help-thread.13295/

This should be pretty straight-forward and hopefully I didn't miss anything.

B
 
Back
Top