Conversation
addons/common/fnc_runQTE.sqf
Outdated
| if (!GVAR(settingsInitFinished)) exitWith { | ||
| // only run this after the settings are initialized | ||
| GVAR(runAtSettingsInitialized) pushBack [FUNC(runQTE), _this]; | ||
| }; |
There was a problem hiding this comment.
For now leave this aside, or bring it up-to-date with CBA.
addons/common/fnc_runQTE.sqf
Outdated
| TRACE_1("QTE already running qeueing up", GVAR(QTERunning)); | ||
| [{ | ||
| !GVAR(QTERunning) | ||
| }, { | ||
| _this call FUNC(runQTE); | ||
| }, _this] call CBA_fnc_waitUntilAndExecute; | ||
| }; | ||
|
|
||
| private _display = findDisplay 46; | ||
|
|
||
| if (isNull _display) exitWith { | ||
| TRACE_1("Waiting for main display to be ready", isNull (_display)); | ||
| [{ | ||
| !isNull (findDisplay 46) | ||
| }, { | ||
| _this call FUNC(runQTE); | ||
| }, _this] call CBA_fnc_waitUntilAndExecute; |
There was a problem hiding this comment.
Imo it should be up to the user to check whenever it's ready. This should only return false or an error code that it couldn't run. The removal of these waitUntilAndExecute would make the _onDisplay event redundant.
The display on which the QTE is drawn should be an argument, so that people can run it wherever they want to (e.g. Zeus interface). Because of comment below, this is no longer relevant.
addons/common/fnc_runQTE.sqf
Outdated
| private _inputKeys = [DIK_UP, DIK_DOWN, DIK_LEFT, DIK_RIGHT]; | ||
| switch (GVAR(QTEInputKeys)) do { | ||
| case 1: { | ||
| _inputKeys = [DIK_W, DIK_S, DIK_A, DIK_D]; | ||
| }; | ||
| case 2: { | ||
| _inputKeys = [DIK_I, DIK_K, DIK_J, DIK_L]; | ||
| }; | ||
| case 3: { | ||
| _inputKeys = [DIK_NUMPAD8, DIK_NUMPAD2, DIK_NUMPAD4, DIK_NUMPAD6]; | ||
| }; | ||
| default { | ||
| _inputKeys = [DIK_UP, DIK_DOWN, DIK_LEFT, DIK_RIGHT]; | ||
| }; | ||
| }; |
There was a problem hiding this comment.
I really dislike this strongly. It uses CBA settings for keybind sets, when we can use CBA keybinds instead.
This would allow for way more flexibility and customisability, as 3rd party mods or mod makers could add their own extra keybinds.
Register 4 keybinds. Here's an example (strings would need to be localised and improved):
["QTE Keybinds", QGVAR(keyUpQTE), ["QTE up key", "Up key used in QTE events."], {
["↑"] call FUNC(keyPressedQTE); // return
}, {}, [DIK_UP, [false, false, false]]] call CBA_fnc_addKeybind;In fnc_keyPressedQTE, you'd check if the keypress is good or not:
params ["_eventQTE"];
// Check if the passed parameter is the next key in the QTE sequence
// If yes, continue
// If no, stopImo, we should make the QTE agonistic of the QTE chars themselves ("↑"). That should be configurable by the user. It will add an extra layer of complexity to the whole things, so we'll have to see if it's worth it.
There was a problem hiding this comment.
Let's keep it simple and start with assigning keys to "↑" etc then we can look at expanding to other keys.
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
|
@johnb432 |
addons/common/XEH_preInit.sqf
Outdated
|
|
||
| ADDON = true; | ||
|
|
||
| ["CBA QTE", "QTE_Up_Key", ["↑", "Up key used in QTE events."], {}, { |
There was a problem hiding this comment.
Personally have a problem with QTE events cuz it expands into Quick-Time Event events.
Making it Quick-Time Events ain't just 2 letters longer, I admit, but shouldn't matter:
Up key used in QTE events.
Up key used in Quick-Time Events.
| * [["↑", "↓", "→", "←"]] call ace_common_fnc_getFormattedQTESequence | ||
| * | ||
| * Public: Yes | ||
| */ |
There was a problem hiding this comment.
The other headers are formatted different from this one.
addons/common/fnc_keyPressedQTE.sqf
Outdated
| }; | ||
|
|
||
| if (_onDisplay isEqualType "") then { | ||
| [_onDisplay, [_args, _qte_seqence, GVAR(QTEHistory)]] call CBA_fnc_localEvent; |
There was a problem hiding this comment.
| [_onDisplay, [_args, _qte_seqence, GVAR(QTEHistory)]] call CBA_fnc_localEvent; | |
| [_onDisplay, [_args, _qte_sequence, GVAR(QTEHistory)]] call CBA_fnc_localEvent; |
addons/common/fnc_keyPressedQTE.sqf
Outdated
| if (_onDisplay isEqualType "") then { | ||
| [_onDisplay, [_args, _qte_seqence, GVAR(QTEHistory)]] call CBA_fnc_localEvent; | ||
| } else { | ||
| [_args, _qte_seqence, GVAR(QTEHistory)] call _onDisplay; |
There was a problem hiding this comment.
| [_args, _qte_seqence, GVAR(QTEHistory)] call _onDisplay; | |
| [_args, _qte_sequence, GVAR(QTEHistory)] call _onDisplay; |
addons/common/fnc_runQTE.sqf
Outdated
| _onDisplay - Code callback on displayable event passed [_args, _qte_seqence, _qte_history]. <CODE, STRING> | ||
| _onFinish - Code callback on QTE completed passed [_args, _elapsedTime]. <CODE, STRING> | ||
| _onFinish - Code callback on QTE timeout/outranged passed [_args, _elapsedTime]. <CODE, STRING> | ||
| _qte_seqence - QTE seqence usually made up of ["↑", "↓", "→", "←"] <ARRAY> |
There was a problem hiding this comment.
| _qte_seqence - QTE seqence usually made up of ["↑", "↓", "→", "←"] <ARRAY> | |
| _qte_seqence - QTE sequence usually made up of ["↑", "↓", "→", "←"] <ARRAY> |
addons/common/fnc_runQTE.sqf
Outdated
|
|
||
| Example: | ||
| [ | ||
| car, |
There was a problem hiding this comment.
A lot of tabs in this file at least.
| [5] call CBA_fnc_generateQTESequence; | ||
|
|
||
| Returns: | ||
| QTE seqence of requested length made up of ["↑", "↓", "→", "←"] <ARRAY> |
There was a problem hiding this comment.
| QTE seqence of requested length made up of ["↑", "↓", "→", "←"] <ARRAY> | |
| QTE sequence of requested length made up of ["↑", "↓", "→", "←"] <ARRAY> |
addons/common/fnc_keyPressedQTE.sqf
Outdated
| private _onFinish = GVAR(QTEArgs) get "onFinish"; | ||
| private _onFail = GVAR(QTEArgs) get "onFail"; | ||
| private _max_distance = GVAR(QTEArgs) get "max_distance"; | ||
| private _qte_seqence = GVAR(QTEArgs) get "qte_seqence"; |
There was a problem hiding this comment.
| private _qte_seqence = GVAR(QTEArgs) get "qte_seqence"; | |
| private _qte_sequence = GVAR(QTEArgs) get "qte_sequence"; |
addons/common/fnc_keyPressedQTE.sqf
Outdated
| GVAR(QTEHistory) pushBack _eventQTE; | ||
|
|
||
|
|
||
| if (GVAR(QTEHistory) isEqualTo _qte_seqence) exitWith { |
There was a problem hiding this comment.
| if (GVAR(QTEHistory) isEqualTo _qte_seqence) exitWith { | |
| if (GVAR(QTEHistory) isEqualTo _qte_sequence) exitWith { |
addons/common/fnc_keyPressedQTE.sqf
Outdated
| }; | ||
| }; | ||
|
|
||
| if !(GVAR(QTEHistory) isEqualTo (_qte_seqence select [0, count GVAR(QTEHistory)])) then { |
There was a problem hiding this comment.
| if !(GVAR(QTEHistory) isEqualTo (_qte_seqence select [0, count GVAR(QTEHistory)])) then { | |
| if !(GVAR(QTEHistory) isEqualTo (_qte_sequence select [0, count GVAR(QTEHistory)])) then { |
addons/common/fnc_runQTE.sqf
Outdated
| Parameters: | ||
| _object - <OBJECT> | ||
| _args - Extra arguments passed to the _on... functions<ARRAY> | ||
| _onDisplay - Code callback on displayable event passed [_args, _qte_seqence, _qte_history]. <CODE, STRING> |
There was a problem hiding this comment.
| _onDisplay - Code callback on displayable event passed [_args, _qte_seqence, _qte_history]. <CODE, STRING> | |
| _onDisplay - Code callback on displayable event passed [_args, _qte_sequence, _qte_history]. <CODE, STRING> |
johnb432
left a comment
There was a problem hiding this comment.
I haven't reviewed the functionality yet, this is mostly formatting related.
addons/common/fnc_keyPressedQTE.sqf
Outdated
| Process Quick-Time Key Press | ||
|
|
||
| Parameters: | ||
| _eventQTE - <STRING> |
There was a problem hiding this comment.
Argument needs description.
addons/common/fnc_keyPressedQTE.sqf
Outdated
| ["↑"] call CBA_fnc_keyPressedQTE; | ||
|
|
||
| Returns: | ||
| Nil |
There was a problem hiding this comment.
It would be None, but the whole point of using a function over an event is so that you can return something.
We want to "override" input if it's a valid QTE keypress, meaning that e.g. if you have bound your arrow up key to move forwards, you wouldn't move forwards while you are doing a QTE.
There was a problem hiding this comment.
Is this where we return true/false in terms of input override?
addons/common/fnc_runQTE.sqf
Outdated
| TRACE_1("QTE already running qeueing up",GVAR(QTERunning)); | ||
| [{ | ||
| !GVAR(QTERunning) | ||
| }, { | ||
| _this call FUNC(runQTE); | ||
| }, _this] call CBA_fnc_waitUntilAndExecute; |
There was a problem hiding this comment.
I'm still not a fan of this. Depending, we might have to wait indefinitely. It also means that multiple QTE can queue up, which could cause unforeseen headaches, albeit unlikely.
I think we'd be better off returning a boolean telling the caller if the QTE was successfully run or not.
addons/common/fnc_runQTE.sqf
Outdated
| ["start_time", _start_time], | ||
| ["timeout", _timeout] | ||
| ]; | ||
| GVAR(QTEArgs) = createHashMapObject [_qteArgsArray]; |
There was a problem hiding this comment.
As far as I can tell, there is no reason to use a hashmap object.
| GVAR(QTEArgs) = createHashMapObject [_qteArgsArray]; | |
| GVAR(QTEArgs) = createHashMapFromArray [_qteArgsArray]; |
addons/common/fnc_runQTE.sqf
Outdated
| } else { | ||
| [_args, _elapsedTime] call _onFail; | ||
| }; | ||
| }, _this] call CBA_fnc_waitUntilAndExecute; |
There was a problem hiding this comment.
You can't pass _this when using default arguments. The default arguments are not inserted into _this, you'll have to pass each argument individually in an array.
Regardless, _this here does not make sense. Pass [_object, _start_time, _timeout, _max_distance] and read those in the loop instead - unless reading from GVAR(QTEArgs) is faster?
rautamiekka
left a comment
There was a problem hiding this comment.
-
Most files use tabs instead of spaces.
-
The fnc headers are different from the ones in use. For ex: 698aee1
-
Apart from a couple extra tabs/spaces I added a suggestion for, lgtm.
addons/common/fnc_keyPressedQTE.sqf
Outdated
| [_onDisplay, [_args, _qte_sequence, GVAR(QTEHistory)]] call CBA_fnc_localEvent; | ||
| } else { | ||
| [_args, _qte_sequence, GVAR(QTEHistory)] call _onDisplay; |
There was a problem hiding this comment.
| [_onDisplay, [_args, _qte_sequence, GVAR(QTEHistory)]] call CBA_fnc_localEvent; | |
| } else { | |
| [_args, _qte_sequence, GVAR(QTEHistory)] call _onDisplay; | |
| [_onDisplay, [_args, _qte_sequence, GVAR(QTEHistory)]] call CBA_fnc_localEvent; | |
| } else { | |
| [_args, _qte_sequence, GVAR(QTEHistory)] call _onDisplay; |
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
|
Is there a linter in the repo I can run or format config just to save time on these formatting comments? |
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
|
Aside from the typo I saw, I played around with this. It's really nice, I like the configuration aspects to it too. I did a bunch of things with it and couldn't find a way to break it. Nice job. |
Co-authored-by: Mike-MF <TyroneMF@hotmail.com>
|
Is there anything that I need to do here now or is it just a case of wait? |
|
This system needs accessibility considerations.
|
Should I consider these must-haves before it can be merged? The original intent was for this to provide an activity for the player during ACE actions (bandaging, injecting, changing wheels etc) it was always intended that there would be a setting in ACE to set if completing the action would be required or just speed the action up a bit. There are use-cases where a simple timeout may not be appropriate eg any activity where the code must be completed within a set time otherwise failure. Its also possible to use something like Voice Attack so you can simply say the key code and it will input it in for you. |
imo number 1 is a must have. |
|
@Drofseh You, can now turn on an option to make all QTEs only one button. |
When merged this pull request will:
Provide Quick Time Events for players to enter in order to complete action (capability addition not change any existing functionality)
Respect the Submitting Content Guidelines
Migrated from Add Quick Time Events acemod/ACE3#9849