Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_LadderUserAction.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
2
class
SCR_LadderUserAction
:
ScriptedUserAction
3
{
4
static
const
float
MAX_LADDER_TEST_DISTANCE = 5.0;
5
static
const
float
MAX_LADDER_ENTRY_ANGLE = 75.0;
6
7
[
Attribute
(
"0"
,
UIWidgets
.EditBox,
"Which ladder component to use"
,
"0 inf"
)]
8
protected
int
m_iLadderComponentIndex
;
9
10
protected
override
void
Init
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
11
{
12
array<Managed> ladderComponents = {};
13
pOwnerEntity.
FindComponents
(
LadderComponent
, ladderComponents);
14
if
(!ladderComponents.IsIndexValid(
m_iLadderComponentIndex
))
15
{
16
Print
(
"m_iLadderComponentIndex : "
+
m_iLadderComponentIndex
+
" is not an index valid"
,
LogLevel
.ERROR);
17
return
;
18
}
19
}
20
21
protected
SCR_CharacterCommandHandlerComponent
FindCommandHandler
(
IEntity
pUser)
22
{
23
ChimeraCharacter
character =
ChimeraCharacter
.Cast(pUser);
24
if
(!character)
25
return
null;
26
27
CharacterAnimationComponent
animationComponent = character.GetCharacterController().GetAnimationComponent();
28
if
(!animationComponent)
29
return
null;
30
31
return
SCR_CharacterCommandHandlerComponent.Cast(animationComponent.
FindComponent
(SCR_CharacterCommandHandlerComponent));
32
}
33
34
protected
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
35
{
36
ChimeraCharacter
character =
ChimeraCharacter
.Cast(pUserEntity);
37
CharacterControllerComponent controller = character.GetCharacterController();
38
controller.TryUseLadder(
GetOwner
(),
m_iLadderComponentIndex
, MAX_LADDER_TEST_DISTANCE, MAX_LADDER_ENTRY_ANGLE);
39
}
40
41
protected
override
bool
CanBePerformedScript
(
IEntity
user)
42
{
43
ChimeraCharacter
character =
ChimeraCharacter
.Cast(user);
44
if
(!character)
45
return
false
;
46
47
CharacterControllerComponent controller = character.GetCharacterController();
48
return
controller && controller.CanUseLadder(
GetOwner
(),
m_iLadderComponentIndex
, MAX_LADDER_TEST_DISTANCE, MAX_LADDER_ENTRY_ANGLE);
49
}
50
51
protected
override
bool
CanBeShownScript
(
IEntity
user)
52
{
53
// Already on a ladder
54
SCR_CharacterCommandHandlerComponent cmdHandler =
FindCommandHandler
(user);
55
return
cmdHandler && !cmdHandler.GetCommandLadder();
56
}
57
60
protected
override
bool
HasLocalEffectOnlyScript
()
61
{
62
return
true
;
63
}
64
};
BaseUserAction::GetOwner
proto external IEntity GetOwner()
Returns the parent entity of this action.
CharacterAnimationComponent
Definition
CharacterAnimationComponent.c:13
ChimeraCharacter
Definition
ChimeraCharacter.c:13
GenericComponent
Definition
GenericComponent.c:13
GenericComponent::FindComponent
proto external GenericComponent FindComponent(typename typeName)
IEntity
Definition
IEntity.c:13
IEntity::FindComponents
proto external int FindComponents(typename typeName, notnull array< Managed > outComponents)
LadderComponent
Definition
LadderComponent.c:13
SCR_LadderUserAction
Definition
SCR_LadderUserAction.c:3
SCR_LadderUserAction::FindCommandHandler
SCR_CharacterCommandHandlerComponent FindCommandHandler(IEntity pUser)
Definition
SCR_LadderUserAction.c:21
SCR_LadderUserAction::Init
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Definition
SCR_LadderUserAction.c:10
SCR_LadderUserAction::HasLocalEffectOnlyScript
override bool HasLocalEffectOnlyScript()
Definition
SCR_LadderUserAction.c:60
SCR_LadderUserAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_LadderUserAction.c:34
SCR_LadderUserAction::m_iLadderComponentIndex
int m_iLadderComponentIndex
Definition
SCR_LadderUserAction.c:8
SCR_LadderUserAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_LadderUserAction.c:41
SCR_LadderUserAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_LadderUserAction.c:51
ScriptedUserAction
Definition
ScriptedUserAction.c:13
UIWidgets
Definition
attributes.c:40
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UserActions
SCR_LadderUserAction.c
Generated by
1.17.0