AsYetUntitled / Framework

Altis Life RPG mission framework for Arma 3 originally made by @TAWTonic.
Other
245 stars 308 forks source link

fn_jerryCanRefuel - Cancel action you get a full canister #685

Open Avirex-Mai opened 4 years ago

Avirex-Mai commented 4 years ago

File: fn_jerryCanRefuel If you cancel the action while filling the canister, you will still get a full canister back.

ghost commented 4 years ago

CONFIRMED!

Also: Already found the issue: When comparing fn_jerryRefuel and fn_jerryCanRefuel it's easy to spot the mistake:

fn_jerryRefuel

    if (!alive player) exitWith {};
    if (life_interrupted) exitWith {};

fn_jerryCanRefuel

        if (!alive player) exitWith {life_action_inUse = false;};
        if (life_interrupted) exitWith {life_interrupted = false; life_action_inUse = false;};

By setting life_action_inUse and life_interrupted to false directly within the exitWith the check after the loop fails:

    if (!alive player || life_istazed || life_isknocked) exitWith {life_action_inUse = false;};
    if (player getVariable ["restrained",false]) exitWith {life_action_inUse = false;};
    if (!isNil "_badDistance") exitWith {titleText[localize "STR_ISTR_Lock_TooFar","PLAIN"]; life_action_inUse = false;};
    if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};

The if-condition is not met and hence it goes straight to call fn_handleInv and hence giving you full fuel canister even if action is cancled.

Solution: Simple copy'n'paste of the fn_jerrRefuel: Remove life_action_inUse and life_interrupted set to false within the exitWith to correctly trigger the if() condition.

ghost commented 4 years ago

fixed with merge of #686 - can be closed (I guess?)

Avirex-Mai commented 4 years ago

fixed with merge of #686 - can be closed (I guess?)

BoGuu commented 4 years ago

Will need to duplicate this commit onto v5.X.X, then can close :)

ghost commented 4 years ago

Will need to duplicate this commit onto v5.X.X, then can close :)

689