-
Notifications
You must be signed in to change notification settings - Fork 737
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
Fix refuel PFH not exiting on nozzle disconnect #3018
Fix refuel PFH not exiting on nozzle disconnect #3018
Conversation
👍 look good from my side |
@@ -29,6 +29,10 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f | |||
params ["_args", "_pfID"]; | |||
_args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"]; | |||
|
|||
if (_nozzle getVariable [QGVAR(isConnected), false]) exitWith { |
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.
Nozzle gets deleted by fnc_returnNozzle. So I'd rather check if _source is still connected.
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.
I don't think it's necessary, this PFH only starts when you attach the nozzle to some vehicle, and with this line it will remove the PFH when you disconnect it from the vehicle. That is before returning the nozzle, PFH will not exist when returning it anymore.
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.
Doesn't this line need a !
? If the nozzle is deleted the getVariable
will always default to false
.
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.
Sorry, your code doesn't reflect what you are saying. This PFH has to run while the _nozzle
is connected.
QGVAR(isConnected)
is set to true
for _nozzle
in fnc_connectNozzleAction which is calling fnc_refuel
. So you would add the PFH and remove it next time it executes.
So either negate your condition,
or query QGVAR(sink)
on _nozzle
which is also set here but gets cleared on disconnecting
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.
Ah yes, that is my bad, forgot a !
, fixing.
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.
Looks better
Fix refuel PFH not exiting on nozzle disconnect
Fixes #3009