From f93455982f01f6c721b49f24862bbc451891eea4 Mon Sep 17 00:00:00 2001 From: Kex Date: Thu, 8 May 2025 23:30:29 +0200 Subject: [PATCH] Improve CanBePerformed check for loiter-based gestures --- .../Commands/SCR_ContinuousLoiterCommand.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 addons/core/scripts/Game/ACE_Core/Commanding/Commands/SCR_ContinuousLoiterCommand.c diff --git a/addons/core/scripts/Game/ACE_Core/Commanding/Commands/SCR_ContinuousLoiterCommand.c b/addons/core/scripts/Game/ACE_Core/Commanding/Commands/SCR_ContinuousLoiterCommand.c new file mode 100644 index 00000000..68da6e7f --- /dev/null +++ b/addons/core/scripts/Game/ACE_Core/Commanding/Commands/SCR_ContinuousLoiterCommand.c @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------------------------ +[BaseContainerProps(), SCR_BaseGroupCommandTitleField("m_sCommandName")] +modded class SCR_ContinuousLoiterCommand : SCR_BaseRadialCommand +{ + //------------------------------------------------------------------------------------------------ + override bool CanBePerformed(notnull SCR_ChimeraCharacter user) + { + if (!super.CanBePerformed(user)) + return false; + + SCR_CharacterControllerComponent userCharController = SCR_CharacterControllerComponent.Cast(user.GetCharacterController()); + if (!userCharController) + return false; + + CharacterCommandHandlerComponent userCommandHandler = user.GetCommandHandler(); + if (!userCommandHandler) + return false; + + return !userCharController.IsUnconscious() + && !userCharController.IsSwimming() + && !userCharController.IsFalling() + && !userCommandHandler.GetTargetLadder() + && !user.IsInVehicle(); + } +}