Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refueling fuel containers #7039

Closed
wants to merge 3 commits into from
Closed

Refueling fuel containers #7039

wants to merge 3 commits into from

Conversation

BaerMitUmlaut
Copy link
Member

When merged this pull request will:

  • Cleanup some of the refuel code
    • Removed unnecessary macro
    • Removed duplicate code
    • More comments
    • Fixed a missing private
  • Add refueling of containers (so you can refuel the fuel cargo of a fuel truck or a jerry can)

@BaerMitUmlaut BaerMitUmlaut added kind/enhancement Release Notes: **IMPROVED:** kind/cleanup Release Notes: **CHANGED:** labels Jun 7, 2019
@@ -1,44 +1,5 @@
#define MACRO_NOZZLE_ACTIONS \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not also be removed? I don't think anyone could have included this file from a built mod as it has config in it, it had to be copied, so it's safe to remove.

@@ -6,6 +6,7 @@
* Arguments:
* 0: Unit <OBJECT>
* 1: Nozzle <OBJECT>
* 2: Refuel container (optional) <BOOL>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 2: Refuel container (optional) <BOOL>
* 2: Refuel container <BOOL> (default: false)

{[_source] call FUNC(getFuel) != 0} &&
{!isNull _sink} &&
{!_isFull} &&
{!(_refuelContainer && {_source == _sink})} && // No endless container ot itself loop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{!(_refuelContainer && {_source == _sink})} && // No endless container ot itself loop
{!(_refuelContainer && {_source == _sink})} && // No endless container of itself loop

*
* Arguments:
* 0: Unit <OBJECT>
* 0: Unit <OBJECT> (optional)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 0: Unit <OBJECT> (optional)
* 0: Unit <OBJECT> (default: objNull - drop on floor)

// Air and sea vehicles have that value properly defined in liters, unlike ground vehicles which is is formula of (range * tested factor) - different fuel consumption system than ground vehicles
if (_maxFuel == 0) then {
_maxFuel = getNumber (_config >> "fuelCapacity");
private _rate = if (isNumber (configFile >> "CfgVehicles" >> typeOf _sink >> QGVAR(flowRate))) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate this if assignment construct, I'd write it as:

private _cfgFlowRate = configFile >> "CfgVehicles" >> typeOf _sink >> QGVAR(flowRate);
private _rate = GVAR(rate); // Default to 1 (jerry cans for example have no flow rate defined)
if (isNumber _cfgFlowRate) then {
    _rate = _rate * getNumber _cfgFlowRate;
};

Also less commands due to config stored in variable.

But up to you.

@BrettMayson
Copy link
Member

Completed in #8981, if I am wrong feel free to re-open

@jonpas jonpas deleted the refuel-containers branch May 16, 2023 09:56
@LinkIsGrim LinkIsGrim removed this from the Ongoing milestone Jul 14, 2023
@AutarkOS
Copy link

AutarkOS commented Oct 7, 2023

Completed in #8981, if I am wrong feel free to re-open

Hi, I'm struggling to work out how this is done in game. I can't attach a nozzle to any fuel container from another. I'm not sure if this just a code capability because I can see that from a console you can set the fuel containers fullness with "ace_refuel_fnc_setFuel"?

Ohh, I see it's in the pre-release now (https://github.com/acemod/ACE3/releases/tag/v3.16.0-RC1). Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Release Notes: **CHANGED:** kind/enhancement Release Notes: **IMPROVED:** status/WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants