Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
john681611 committed Mar 27, 2024
1 parent f48ebaa commit d99bb4f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 7 additions & 3 deletions addons/common/fnc_keyPressedQTE.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Example:
["↑"] call CBA_fnc_keyPressedQTE;
Returns:
None
<BOOLEAN> - True if QTE is running
Author:
john681611
Expand All @@ -21,8 +21,9 @@ Author:

params ["_eventQTE"];

if !(missionNamespace getVariable [QGVAR(QTERunning), false]) exitWith {};
if !(_eventQTE in ["", "", "", ""]) exitWith {};
if !(missionNamespace getVariable [QGVAR(QTERunning), false]) exitWith {
false
};


private _args = GVAR(QTEArgs) get "args";
Expand All @@ -42,6 +43,7 @@ if (GVAR(QTEHistory) isEqualTo _qteSequence) exitWith {
} else {
[_args, _elapsedTime] call _onFinish;
};
true
};

if (GVAR(QTEHistory) isNotEqualTo (_qteSequence select [0, count GVAR(QTEHistory)])) then {
Expand All @@ -54,3 +56,5 @@ if (_onDisplay isEqualType "") then {
} else {
[_args, _qteSequence, GVAR(QTEHistory)] call _onDisplay;
};

true
12 changes: 6 additions & 6 deletions addons/common/fnc_runQTE.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Description:
Parameters:
_object - <OBJECT>
_args - Extra arguments passed to the _on... functions<ARRAY>
_onDisplay - Code callback on displayable event passed [_args, _qte_sequence, _qte_history]. <CODE, STRING>
_onDisplay - Code callback on displayable event passed [_args, _qte_sequence, _qte_history]. <CODE, STRING>
_onFinish - Code callback on Quick-Time Event completed passed [_args, _elapsedTime]. <CODE, STRING>
_onFinish - Code callback on Quick-Time Event timeout/outranged passed [_args, _elapsedTime]. <CODE, STRING>
_qte_sequence - Quick-Time sequence made up of ["↑", "↓", "→", "←"] <ARRAY>
_max_distance - max interaction distance from attached object <NUMBER> (default: 10)
_timeout - ingame timeout <NUMBER> (default: 30)
_qte_sequence - Quick-Time sequence made up of ["↑", "↓", "→", "←"] <ARRAY>
_max_distance - max interaction distance from attached object <NUMBER> (default: 10)
_timeout - ingame timeout <NUMBER> (default: 30)
Example:
[car,
Expand All @@ -34,7 +34,7 @@ Example:
["↑", "↓", "→", "←"]] call CBA_fnc_runQTE
Returns:
Nil
<BOOELAN> - True if the QTE was started, false if it was already running.
Author:
john681611
Expand Down Expand Up @@ -83,7 +83,7 @@ GVAR(QTEArgs) = createHashMapFromArray _qteArgsArray;
} else {
[_args, _elapsedTime] call _onFail;
};
}, _this] call CBA_fnc_waitUntilAndExecute;
}, []] call CBA_fnc_waitUntilAndExecute;

if (_onDisplay isEqualType "") then {
[_onDisplay, [_args, _qte_sequence, []]] call CBA_fnc_localEvent;
Expand Down

0 comments on commit d99bb4f

Please sign in to comment.