-
Notifications
You must be signed in to change notification settings - Fork 738
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
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,6 +6,7 @@ | |||||
* Arguments: | ||||||
* 0: Unit <OBJECT> | ||||||
* 1: Nozzle <OBJECT> | ||||||
* 2: Refuel container (optional) <BOOL> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
* | ||||||
* Return Value: | ||||||
* Can turn on <BOOL> | ||||||
|
@@ -16,15 +17,34 @@ | |||||
* Public: No | ||||||
*/ | ||||||
|
||||||
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; | ||||||
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_refuelContainer", false, [false]]]; | ||||||
|
||||||
if (isNull _unit || | ||||||
{isNull _nozzle} || | ||||||
{!(_unit isKindOf "CAManBase")} || | ||||||
{!local _unit} || | ||||||
{(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; | ||||||
|
||||||
private _source = _nozzle getVariable [QGVAR(source), objNull]; | ||||||
private _sink = _nozzle getVariable [QGVAR(sink), objNull]; | ||||||
private _isContainer = !(isNil {_sink getVariable QGVAR(currentFuelCargo)}) | ||||||
|| {isNumber (configFile >> "CfgVehicles" >> typeOf _sink >> QGVAR(fuelCargo))}; | ||||||
|
||||||
private _isFull = if (_refuelContainer) then { | ||||||
private _currentFuel = [_sink] call FUNC(getFuel); | ||||||
private _capacity = _sink getVariable [ | ||||||
QGVAR(capacity), | ||||||
getNumber (configFile >> "CfgVehicles" >> typeOf _sink >> QGVAR(fuelCargo)) | ||||||
]; | ||||||
|
||||||
(_currentFuel == REFUEL_INFINITE_FUEL) || {_capacity == REFUEL_INFINITE_FUEL} || {_currentFuel == _capacity} | ||||||
} else { | ||||||
fuel _sink == 1 | ||||||
}; | ||||||
|
||||||
!(_nozzle getVariable [QGVAR(isRefueling), false]) && | ||||||
{[_nozzle getVariable QGVAR(source)] call FUNC(getFuel) != 0} && | ||||||
{!isNull (_nozzle getVariable [QGVAR(sink), objNull])} && | ||||||
{(fuel (_nozzle getVariable QGVAR(sink))) < 1} | ||||||
{[_source] call FUNC(getFuel) != 0} && | ||||||
{!isNull _sink} && | ||||||
{!_isFull} && | ||||||
{!(_refuelContainer && {_source == _sink})} && // No endless container ot itself loop | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{!_refuelContainer || _isContainer} // Container refueling only if it actually is one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,10 +1,10 @@ | ||||||
#include "script_component.hpp" | ||||||
/* | ||||||
* Author: GitHawk | ||||||
* Disconnect a fuel nozzle. | ||||||
* Disconnect a fuel nozzle and make unit pick it up. | ||||||
* | ||||||
* Arguments: | ||||||
* 0: Unit <OBJECT> | ||||||
* 0: Unit <OBJECT> (optional) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
* 1: Nozzle <OBJECT> | ||||||
* | ||||||
* Return Value: | ||||||
|
@@ -27,4 +27,6 @@ _nozzle setVariable [QGVAR(sink), nil, true]; | |||||
_nozzle setVariable [QGVAR(isConnected), false, true]; | ||||||
[objNull, _nozzle, true] call FUNC(dropNozzle); | ||||||
|
||||||
[_unit, _nozzle] call FUNC(takeNozzle); | ||||||
if (!isNull _unit) then { | ||||||
[_unit, _nozzle] call FUNC(takeNozzle); | ||||||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.