Skip to content

Commit db856e7

Browse files
committed
Refactor Logger module usage and improve shift key input handling in GrappleGun
Improves GrappleGun shift input and refactors Logger path - Enhances shift key detection for GrappleGun's precise rope control, using a more robust method for increased reliability. - Updates GrappleGun scripts to reference a common, centralized path for the Logger module. - Removes an obsolete Lua binding for the shift key, as direct shift state checking is now preferred. - Includes minor code cleanup in the input mapping settings UI.
1 parent ee4131d commit db856e7

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

Data/Base.rte/Devices/Tools/GrappleGun/Grapple.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local RopePhysics = require("Devices.Tools.GrappleGun.Scripts.RopePhysics")
77
local RopeRenderer = require("Devices.Tools.GrappleGun.Scripts.RopeRenderer")
88
local RopeInputController = require("Devices.Tools.GrappleGun.Scripts.RopeInputController")
99
local RopeStateManager = require("Devices.Tools.GrappleGun.Scripts.RopeStateManager")
10-
local Logger = require("Devices.Tools.GrappleGun.Scripts.Logger")
10+
local Logger = require("Scripts.Logger")
1111

1212
function Create(self)
1313
Logger.info("Grapple Create() - Starting initialization")

Data/Base.rte/Devices/Tools/GrappleGun/Scripts/RopeInputController.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ function RopeInputController.handleShiftMousewheelControls(grappleInstance, cont
238238

239239
Logger.debug("RopeInputController.handleShiftMousewheelControls() - Equipment and attachment checks passed")
240240

241-
-- Check for actual keyboard SHIFT key
242-
local shiftHeld = controller:IsState(Controller.KEYBOARD_SHIFT)
243-
Logger.debug("RopeInputController.handleShiftMousewheelControls() - Keyboard SHIFT held (KEYBOARD_SHIFT): %s", tostring(shiftHeld))
241+
-- Check for actual SHIFT key using UInputMan
242+
local shiftHeld = UInputMan:FlagShiftState()
243+
Logger.debug("RopeInputController.handleShiftMousewheelControls() - SHIFT key held (UInputMan): %s", tostring(shiftHeld))
244244

245245
if not shiftHeld then
246246
return false

Source/Lua/LuaBindingsInput.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ LuaBindingRegisterFunctionDefinitionForType(InputLuaBindings, InputElements) {
4444
luabind::value("INPUT_JUMP", InputElements::INPUT_JUMP),
4545
luabind::value("INPUT_CROUCH", InputElements::INPUT_PRONE), // awful, but script compat
4646
luabind::value("INPUT_PRONE", InputElements::INPUT_PRONE),
47-
luabind::value("INPUT_SHIFT", InputElements::INPUT_SHIFT),
4847
luabind::value("INPUT_WALKCROUCH", InputElements::INPUT_CROUCH),
4948
luabind::value("INPUT_NEXT", InputElements::INPUT_NEXT),
5049
luabind::value("INPUT_PREV", InputElements::INPUT_PREV),

Source/Menus/SettingsInputMappingGUI.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using namespace RTE;
1313
std::array<InputElements, 7> SettingsInputMappingGUI::m_InputElementsUsedByMouse = {InputElements::INPUT_FIRE, InputElements::INPUT_PIEMENU_ANALOG, InputElements::INPUT_AIM, InputElements::INPUT_AIM_UP, InputElements::INPUT_AIM_DOWN, InputElements::INPUT_AIM_LEFT, InputElements::INPUT_AIM_RIGHT};
1414

1515
SettingsInputMappingGUI::SettingsInputMappingGUI(GUIControlManager* parentControlManager) :
16-
m_GUIControlManager(parentControlManager) {
16+
m_GUIControlManager(parentControlManager) {
1717
m_InputMappingSettingsBox = dynamic_cast<GUICollectionBox*>(m_GUIControlManager->GetControl("CollectionBoxPlayerInputMapping"));
1818
m_InputMappingSettingsBox->SetVisible(false);
1919

@@ -40,25 +40,22 @@ SettingsInputMappingGUI::SettingsInputMappingGUI(GUIControlManager* parentContro
4040
if (m_InputMapButton[i]) {
4141
// Optionally, initialize button text or state here if needed
4242
}
43-
m_InputMapLabel[i]->SetText(c_InputElementNames[i]);
4443
}
4544

46-
m_InputMapButton[i] = dynamic_cast<GUIButton*>(m_GUIControlManager->GetControl("ButtonInputKey" + std::to_string(i + 1)));
47-
}
48-
m_InputMappingCaptureBox = dynamic_cast<GUICollectionBox*>(m_GUIControlManager->GetControl("CollectionBoxInputCapture"));
49-
m_InputMappingCaptureBox->SetVisible(false);
45+
m_InputMappingCaptureBox = dynamic_cast<GUICollectionBox*>(m_GUIControlManager->GetControl("CollectionBoxInputCapture"));
46+
m_InputMappingCaptureBox->SetVisible(false);
5047

51-
GUICollectionBox* settingsRootBox = dynamic_cast<GUICollectionBox*>(m_GUIControlManager->GetControl("CollectionBoxSettingsBase"));
52-
m_InputMappingCaptureBox->SetPositionAbs(settingsRootBox->GetXPos() + ((settingsRootBox->GetWidth() - m_InputMappingCaptureBox->GetWidth()) / 2), settingsRootBox->GetYPos() + ((settingsRootBox->GetHeight() - m_InputMappingCaptureBox->GetHeight()) / 2));
48+
GUICollectionBox* settingsRootBox = dynamic_cast<GUICollectionBox*>(m_GUIControlManager->GetControl("CollectionBoxSettingsBase"));
49+
m_InputMappingCaptureBox->SetPositionAbs(settingsRootBox->GetXPos() + ((settingsRootBox->GetWidth() - m_InputMappingCaptureBox->GetWidth()) / 2), settingsRootBox->GetYPos() + ((settingsRootBox->GetHeight() - m_InputMappingCaptureBox->GetHeight()) / 2));
5350

54-
m_InputElementCapturingInputNameLabel = dynamic_cast<GUIButton*>(m_GUIControlManager->GetControl("ButtonLabelInputMappingName"));
51+
m_InputElementCapturingInputNameLabel = dynamic_cast<GUIButton*>(m_GUIControlManager->GetControl("ButtonLabelInputMappingName"));
5552

56-
m_InputConfigWizardMenu = std::make_unique<SettingsInputMappingWizardGUI>(parentControlManager);
53+
m_InputConfigWizardMenu = std::make_unique<SettingsInputMappingWizardGUI>(parentControlManager);
5754

58-
m_ConfiguringPlayer = Players::NoPlayer;
59-
m_ConfiguringPlayerInputScheme = nullptr;
60-
m_ConfiguringManually = false;
61-
m_InputElementCapturingInput = InputElements::INPUT_COUNT;
55+
m_ConfiguringPlayer = Players::NoPlayer;
56+
m_ConfiguringPlayerInputScheme = nullptr;
57+
m_ConfiguringManually = false;
58+
m_InputElementCapturingInput = InputElements::INPUT_COUNT;
6259
}
6360

6461
bool SettingsInputMappingGUI::IsEnabled() const {

0 commit comments

Comments
 (0)