4 static const float MAX_LADDER_TEST_DISTANCE = 5.0;
5 static const float MAX_LADDER_ENTRY_ANGLE = 75.0;
6 protected IEntity m_pLadderOwner;
8 [
Attribute(
"0", UIWidgets.EditBox,
"Which ladder component to use",
"0 inf")]
9 protected int m_iLadderComponentIndex;
11 protected override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
13 array<Managed> ladderComponents = {};
14 pOwnerEntity.FindComponents(LadderComponent, ladderComponents);
15 if (!ladderComponents.IsIndexValid(m_iLadderComponentIndex))
17 Print(
"m_iLadderComponentIndex : " + m_iLadderComponentIndex +
" is not an index valid", LogLevel.ERROR);
21 m_pLadderOwner = pOwnerEntity;
24 protected SCR_CharacterCommandHandlerComponent FindCommandHandler(IEntity pUser)
26 ChimeraCharacter character = ChimeraCharacter.Cast(pUser);
30 CharacterAnimationComponent animationComponent = character.GetCharacterController().GetAnimationComponent();
31 if (!animationComponent)
34 return SCR_CharacterCommandHandlerComponent.Cast(animationComponent.FindComponent(SCR_CharacterCommandHandlerComponent));
37 protected override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
39 ChimeraCharacter character = ChimeraCharacter.Cast(pUserEntity);
40 CharacterControllerComponent controller = character.GetCharacterController();
41 controller.TryUseLadder(m_pLadderOwner, m_iLadderComponentIndex, MAX_LADDER_TEST_DISTANCE, MAX_LADDER_ENTRY_ANGLE);
44 protected override bool CanBePerformedScript(IEntity user)
46 ChimeraCharacter character = ChimeraCharacter.Cast(user);
50 CharacterControllerComponent controller = character.GetCharacterController();
51 return controller && controller.CanUseLadder(m_pLadderOwner, m_iLadderComponentIndex, MAX_LADDER_TEST_DISTANCE, MAX_LADDER_ENTRY_ANGLE);
54 protected override bool CanBeShownScript(IEntity user)
60 SCR_CharacterCommandHandlerComponent cmdHandler = FindCommandHandler(user);
61 return cmdHandler && !cmdHandler.GetCommandLadder();
66 protected override bool HasLocalEffectOnlyScript()