Skip to content
This repository was archived by the owner on Nov 15, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions CSharpSourceCode/AbilitySystem/AbilityManagerMissionLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class AbilityManagerMissionLogic : MissionLogic
private bool _disableCombatActionsAfterCast;
private float _elapsedTimeSinceLastActivation;
private bool _wieldOffHandStaff;
private IInputContext _inputContext => Mission.InputManager; //Easy way to access gamekeys

public delegate void OnHideOutBossFightInit();
public event OnHideOutBossFightInit OnInitHideOutBossFight;

Expand All @@ -66,6 +68,7 @@ public override void OnBehaviorInitialize()
{
base.OnBehaviorInitialize();
Mission.OnItemPickUp += OnItemPickup;

}

public void InitHideOutBossFight()
Expand All @@ -82,6 +85,7 @@ public override void EarlyStart()
_quickCastMenuKey = HotKeyManager.GetCategory(nameof(TORGameKeyContext)).GetGameKey("QuickCastSelectionMenu");
_quickCast = HotKeyManager.GetCategory(nameof(TORGameKeyContext)).GetGameKey("QuickCast");
_specialMoveKey = HotKeyManager.GetCategory(nameof(TORGameKeyContext)).GetGameKey("CareerAbilityCast");
_keyContext.GetGameKey(25).ControllerKey.ChangeKey(InputKey.Invalid); // Unbinding view Character Controller key from controller.
}

public override void OnPreMissionTick(float dt)
Expand Down Expand Up @@ -381,7 +385,7 @@ private void HandleInput(float dt)
break;
case AbilityModeState.Targeting:
{
if (Input.IsKeyPressed(InputKey.LeftMouseButton))
if (_inputContext.IsGameKeyPressed(9)) //Check's if attack gamekey is pressed (default left mouse for kb&m and Right Trigger for controller)
{
bool flag = _abilityComponent.CurrentAbility.Crosshair == null ||
!_abilityComponent.CurrentAbility.Crosshair.IsVisible ||
Expand All @@ -401,7 +405,7 @@ private void HandleInput(float dt)
}
}
}
else if (Input.IsKeyPressed(_quickCastMenuKey.KeyboardKey.InputKey) || Input.IsKeyPressed(_quickCastMenuKey.ControllerKey.InputKey))
else if (Input.IsKeyPressed(_quickCastMenuKey.KeyboardKey.InputKey) || Input.IsKeyPressed(_quickCastMenuKey.ControllerKey.InputKey)) //Could be checked with _inputContext.IsGameKeyPressed(109) for both the controller and keyboard but need testing since these gamekeys are introduced by the mod
{
EnableQuickSelectionMenuMode();
}
Expand Down Expand Up @@ -771,4 +775,4 @@ public enum AbilityModeState
Targeting,
Casting
}
}
}
6 changes: 3 additions & 3 deletions CSharpSourceCode/GameManagers/TORGameKeyContext.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using TaleWorlds.Core;
using TaleWorlds.DotNet;
using TaleWorlds.InputSystem;
Expand All @@ -16,7 +16,7 @@ public class TORGameKeyContext : GameKeyContext
public const int CareerAbilityCast = (int)TorKeyMap.CareerAbilityCast;
public TORGameKeyContext() : base(nameof(TORGameKeyContext),120) // I don't exactly know why they do it, but they seem to cast the id enums of "GameKey" to strings, and then read them out. So the first 108 positions are blocked since their names are predefined of the GameKey enum.
{
RegisterGameKey(new GameKey(QuickCastSelectionMenu, "QuickCastSelectionMenu", nameof(TORGameKeyContext), InputKey.Q, nameof(TORGameKeyContext)));
RegisterGameKey(new GameKey(QuickCastSelectionMenu, "QuickCastSelectionMenu", nameof(TORGameKeyContext), InputKey.Q, InputKey.ControllerLLeft, nameof(TORGameKeyContext))); //Registered d-pad left as Quickcast menu button.
RegisterGameKey(new GameKey(QuickCast, "QuickCast", nameof(TORGameKeyContext), InputKey.MiddleMouseButton, nameof(TORGameKeyContext)));
RegisterGameKey(new GameKey(CareerAbilityCast, "CareerAbilityCast", nameof(TORGameKeyContext), InputKey.LeftAlt, nameof(TORGameKeyContext)));
}
Expand All @@ -28,4 +28,4 @@ public enum TorKeyMap
QuickCast=110,
CareerAbilityCast = 111
}
}
}