Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 9f87da4

Browse files
committed
Added Controller::IsKeyboardOnlyControlled
1 parent 2ab81b4 commit 9f87da4

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ This can be accessed via the new Lua (R/W) `SettingsMan` property `AIUpdateInter
631631

632632
- Added alternate version of `Scene` Lua function `CalculatePath(startPos, endPos, movePathToGround, digStrength, team)` that works as the previous one, but lets you specify the team to calculate the path for, allowing you to ignore doors on your team.
633633

634+
- Added `Controller` Lua function `IsKeyboardOnlyControlled` that tells you whether the `Controller` is being controlled by keyboard only. Previously the only way to do this was to check that it's not mouse controlled and not gamepad controlled.
634635
</details>
635636

636637
<details><summary><b>Changed</b></summary>

Lua/LuaBindingsSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ namespace RTE {
5454
.def("IsPlayerControlled", &Controller::IsPlayerControlled)
5555
.def("RelativeCursorMovement", &Controller::RelativeCursorMovement)
5656
.def("IsMouseControlled", &Controller::IsMouseControlled)
57+
.def("IsKeyboardOnlyControlled", &Controller::IsKeyboardOnlyControlled)
5758
.def("IsGamepadControlled", &Controller::IsGamepadControlled)
5859
.def("SetState", &Controller::SetState)
5960
.def("IsState", &Controller::IsState)

System/Controller.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ namespace RTE {
124124
return m_Player != Players::NoPlayer && g_UInputMan.GetControlScheme(m_Player)->GetDevice() == InputDevice::DEVICE_MOUSE_KEYB;
125125
}
126126

127+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
128+
129+
bool Controller::IsKeyboardOnlyControlled() const {
130+
return m_Player != Players::NoPlayer && g_UInputMan.GetControlScheme(m_Player)->GetDevice() == InputDevice::DEVICE_KEYB_ONLY;
131+
}
132+
127133
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
128134

129135
bool Controller::IsGamepadControlled() const {

System/Controller.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ namespace RTE {
244244
/// <returns>Whether this is using mouse input at all.</returns>
245245
bool IsMouseControlled() const;
246246

247+
/// <summary>
248+
/// Indicates whether this is only listening to keyboard input.
249+
/// </summary>
250+
/// <returns>Whether this is only using keyboard input.</returns>
251+
bool IsKeyboardOnlyControlled() const;
252+
247253
/// <summary>
248254
/// Indicates whether this is listening to gamepad at all.
249255
/// </summary>

0 commit comments

Comments
 (0)