Skip to content

AI Control Keybinds #496

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

Merged
merged 59 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
419aea9
Keybinds
ampersand38 Dec 28, 2020
e17e525
Added exit on no selection
ampersand38 Jan 12, 2021
69cd852
Update addons/editor/initKeybinds.sqf
ampersand38 Jan 17, 2021
943868e
Unnecessary parentheses
ampersand38 Jan 17, 2021
839de51
`_index` is not used
ampersand38 Jan 17, 2021
a79cd99
Incorrect spelling
ampersand38 Jan 17, 2021
d8bc649
Merge branch 'unit-control-keybinds' of https://github.com/ampersand3…
ampersand38 Jan 17, 2021
831a906
Localize
ampersand38 Jan 17, 2021
f2046a9
Just handled
ampersand38 Jan 17, 2021
773f82f
getPosFromScreen already exists
ampersand38 Jan 17, 2021
e4c4589
Add Watch Curator Camera and Force Fire
ampersand38 Jan 17, 2021
e5382e4
Update addons/editor/initKeybinds.sqf
ampersand38 Jan 18, 2021
e8352b8
Update addons/editor/stringtable.xml
ampersand38 Jan 18, 2021
b9a3785
Update addons/editor/initKeybinds.sqf
ampersand38 Jan 18, 2021
c51b2f5
Allow commanding non-main-turrets
ampersand38 Jan 20, 2021
eb1a0c9
Fire individual gunners and driver horn
ampersand38 Jan 20, 2021
ba4f532
tabs to spaces
ampersand38 Jan 20, 2021
5417948
actually tabs to spaces
ampersand38 Jan 20, 2021
ca1543c
Fixed super rapid fire
ampersand38 Jan 20, 2021
2ad7e54
Merge remote-tracking branch 'upstream/master' into unit-control-keyb…
ampersand38 Feb 25, 2021
8b3c25b
use checkAIFeature
ampersand38 Mar 25, 2021
fcdf540
localize and use if instead of select
ampersand38 Mar 25, 2021
41b8a41
use isNotEqualTo
ampersand38 Mar 25, 2021
a938a9f
Move to a function
ampersand38 Mar 25, 2021
32badb6
Change to _endTime so then the check is just CBA_missionTime >= _endTime
ampersand38 Mar 25, 2021
197b8a9
don't use select/apply with forEach
ampersand38 Mar 25, 2021
c91f79c
draw hint lines and icons
ampersand38 Mar 25, 2021
e94f544
ignore players
ampersand38 Mar 25, 2021
ad7189a
return _pfhID
ampersand38 Mar 25, 2021
c08db31
remove testing code
ampersand38 Apr 20, 2021
fe0b0a4
Indentation
ampersand38 Apr 20, 2021
8a91f43
change hints to flexible system based on Draw3D EH
ampersand38 Apr 21, 2021
db44fcc
faster copy array
ampersand38 Apr 21, 2021
774d80c
Merge branch 'master' into unit-control-keybinds
ampersand38 Jul 1, 2021
ad8a2e7
Merge branch 'master' into unit-control-keybinds
ampersand38 Oct 22, 2021
22ee0a3
Toggle PATH for vehicle without selecting driver
ampersand38 Oct 22, 2021
2d365f7
Fix FFV unit shooting
ampersand38 Oct 22, 2021
2adf9b1
Merge remote-tracking branch 'upstream/master' into unit-control-keyb…
ampersand38 Jan 11, 2023
7e264cd
controls category
ampersand38 Jan 11, 2023
75128f9
tooltips
ampersand38 Jan 11, 2023
23e2f77
remove old hint code
ampersand38 Jan 11, 2023
603c4a3
fix tank cancel watch
ampersand38 Jan 11, 2023
dfa37a0
restructured hint fnc
ampersand38 Jan 11, 2023
2b31143
only 1 icon needed per key press
ampersand38 Jan 11, 2023
8fe17ba
handle hovering over non-object entity
ampersand38 Jan 12, 2023
8251c21
Merge remote-tracking branch 'upstream/master' into unit-control-keyb…
ampersand38 Jan 22, 2023
e65d358
don't block other keybinds
ampersand38 Jan 22, 2023
37fcc84
Merge remote-tracking branch 'upstream/master' into unit-control-keyb…
ampersand38 Jan 22, 2023
d70241a
Add drawHint common function
mharis001 Jan 28, 2023
5c339ed
Use drawHint and general cleanup
mharis001 Jan 28, 2023
eb6567a
Fix typo
mharis001 Jan 28, 2023
069cc8f
fix tank commander
ampersand38 Feb 28, 2023
bb4e9f3
extract to common fncs
ampersand38 Feb 28, 2023
c5cfeba
add fnc_firstTurretUnit
ampersand38 Feb 28, 2023
b0562cf
curator force fire using common fncs
ampersand38 Feb 28, 2023
acc1ead
prep canFire
ampersand38 Feb 28, 2023
75a5346
Rework firing functions and general cleanup
mharis001 Mar 7, 2023
6b0f4ed
Use CBA_fnc_isTurnedOut
mharis001 Mar 7, 2023
cac3185
Change force fire description wording
mharis001 Mar 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/common/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ PREP(getActiveTree);
PREP(getAllTurrets);
PREP(getArtilleryETA);
PREP(getCargoPositionsCount);
PREP(getCursorPosition);
PREP(getDefaultInventory);
PREP(getDLC);
PREP(getLightingSelections);
Expand Down
38 changes: 38 additions & 0 deletions addons/common/functions/fnc_getCursorPosition.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "script_component.hpp"
/*
* Author: Ampersand
* Returns ASL position of curator cursor.
* If cursor is over an object or building, the surface intersection position is returned.
* If the curator map is open, the ground level position is returned.
*
* Arguments:
* None
*
* Return Value:
* Position ASL <ARRAY>
*
* Example:
* [] call zen_common_fnc_getCursorPosition
*
* Public: No
*/

if (ctrlShown ((findDisplay 312) displayCtrl 50)) then {
// Curator map
private _pos2d = (((findDisplay 312) displayCtrl 50) ctrlMapScreenToWorld getMousePosition);
_pos2d set [2, getTerrainHeightASL _pos2d];
_pos2d
} else {
// Check elevated position
private _pos3d = AGLToASL (screenToWorld getMousePosition);
private _position0 = AGLToASL positionCameraToWorld [0, 0, 0];
private _intersections = lineIntersectsSurfaces [_position0, _pos3d, cameraOn, objNull, true, 1, "GEOM"];

if !(_intersections isEqualTo []) then {
(_intersections # 0) params ["_intersectPosASL", "", "_intersectObject", ""];
if !(isNull _intersectObject) then {
_pos3d = _intersectPosASL;
};
};
_pos3d
};
57 changes: 57 additions & 0 deletions addons/editor/initKeybinds.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,60 @@
};
};
}, {}, [0, [false, false, false]]] call CBA_fnc_addKeybind; // Default: Unbound

[ELSTRING(main,DisplayName), QGVAR(watchCursor), [LSTRING(WatchCursor), LSTRING(WatchCursor_Description)], {
if (!isNull curatorCamera && {!GETMVAR(RscDisplayCurator_search,false)}) then {
curatorMouseOver params ["_type", "_entity", "_index"];
private _isCancelling = (_type == "OBJECT") && {_entity in SELECTED_OBJECTS};
private _gunners = (SELECTED_OBJECTS apply {gunner vehicle _x}) - [objNull];

private _cursorPosASL = call EFUNC(common,getCursorPosition);
{
[QEGVAR(common,doWatch), [_x, [ASLToAGL _cursorPosASL, objNull] select _isCancelling], _x] call CBA_fnc_targetEvent;
} forEach _gunners;

true // handled, prevents vanilla eject
};
}, {}, [0, [false, false, false]]] call CBA_fnc_addKeybind; // Default: Unbound

[ELSTRING(main,DisplayName), QGVAR(moveToCursor), [LSTRING(MoveToCursor), LSTRING(MoveToCursor_Description)], {
if (!isNull curatorCamera && {!GETMVAR(RscDisplayCurator_search,false)}) then {
private _cursorPosASL = call EFUNC(common,getCursorPosition);

{
if (!isNull driver _x) then {
[QEGVAR(common,doMove), [_x, ASLToAGL _cursorPosASL], _x] call CBA_fnc_targetEvent;
};
} forEach SELECTED_OBJECTS;

true // handled, prevents vanilla eject
};
}, {}, [0, [false, false, false]]] call CBA_fnc_addKeybind; // Default: Unbound

[ELSTRING(main,DisplayName), QGVAR(toggleAIPATH), [LSTRING(ToggleAIPATH), LSTRING(ToggleAIPATH_Description)], {
if (!isNull curatorCamera && {!GETMVAR(RscDisplayCurator_search,false) && {count SELECTED_OBJECTS > 0}}) then {
private _disabled = 0;
private _enabled = 0;
private _drivers = (SELECTED_OBJECTS apply {driver vehicle _x}) - [objNull];
_drivers = _drivers arrayIntersect _drivers;

{
private _isAIEnalbedPATH = _x getVariable [QEGVAR(common,isAIEnalbedPATH), true];
private _AIEvent = [QEGVAR(common,enableAI), QEGVAR(common,disableAI)] select _isAIEnalbedPATH;
[_AIEvent, [_x, "PATH"], _x] call CBA_fnc_targetEvent;
_x setVariable [QEGVAR(common,isAIEnalbedPATH), !_isAIEnalbedPATH, true];
if (_isAIEnalbedPATH) then {
_disabled = _disabled + 1;
} else {;
_enabled = _enabled + 1;
};
} forEach _drivers;

private _message = "PATH " +
(["", format [" - disabled: %1", _disabled]] select (_disabled > 0)) +
(["", format [" - enabled: %1", _enabled]] select (_enabled > 0));
[_message] call EFUNC(common,showMessage);

true // handled, prevents vanilla eject
};
}, {}, [0, [false, false, false]]] call CBA_fnc_addKeybind; // Default: Unbound
18 changes: 18 additions & 0 deletions addons/editor/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,23 @@
<Japanese>全編集可アイコンの視認性を切り替えます。一時的な処理軽減や整理に使用できます。</Japanese>
<Polish>Przełącza widoczność wszsytkich ustawionych ikon, przydatne by tymczasowo zmniejszyć lag, bądź niepotrzebne zaśmiecenie ekranu gdy znajduje się na nim dużo ikon.</Polish>
</Key>
<Key ID="STR_ZEN_Editor_WatchCursor">
<English>Watch Cursor</English>
</Key>
<Key ID="STR_ZEN_Editor_WatchCursor_Description">
<English>Makes all selected units watch the cursor location. Pressing this command with the cursor over a selected unit will cancel the watch target.</English>
</Key>
<Key ID="STR_ZEN_Editor_MoveToCursor">
<English>Move To Cursor</English>
</Key>
<Key ID="STR_ZEN_Editor_MoveToCursor_Description">
<English>Makes all selected units move to the cursor location. Units will return to formation and waypoint afterward.</English>
</Key>
<Key ID="STR_ZEN_Editor_ToggleAIPATH">
<English>Toggle AI PATH</English>
</Key>
<Key ID="STR_ZEN_Editor_ToggleAIPATH_Description">
<English>Makes all selected units start or stop moving. Does not affect aiming or shooting.</English>
</Key>
</Package>
</Project>