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_AISmartActionComponent.c
Go to the documentation of this file.
1
class
SCR_AISmartActionComponentClass
:
AISmartActionComponentClass
2
{
3
}
4
5
void
SCR_AIActionUserInvoker_Callback
(AIAgent actionUser);
6
typedef
func
SCR_AIActionUserInvoker_Callback
;
7
typedef
ScriptInvokerBase<SCR_AIActionUserInvoker_Callback>
SCR_AIActionUserInvoker
;
8
9
class
SCR_AISmartActionComponent
:
AISmartActionComponent
10
{
11
protected
ref
SCR_AIActionUserInvoker
Event_EOnActionEnd
;
12
protected
ref
SCR_AIActionUserInvoker
Event_EOnActionFailed
;
13
protected
SCR_CharacterDamageManagerComponent
m_pDamageManager
;
14
15
//------------------------------------------------------------------------------------------------
18
void
ReserveAction
(AIAgent owner)
19
{
20
// listen on death of the owner
21
IEntity
ent = owner.GetControlledEntity();
22
if
(!ent)
23
return
;
24
m_pDamageManager
=
SCR_CharacterDamageManagerComponent
.Cast(ent.
FindComponent
(
SCR_CharacterDamageManagerComponent
));
25
if
(
m_pDamageManager
)
26
m_pDamageManager
.GetOnDamageStateChanged().Insert(
OnDamageStateChanged
);
27
SetActionAccessible(
false
);
28
}
29
30
//------------------------------------------------------------------------------------------------
32
void
ReleaseAction
()
33
{
34
if
(
m_pDamageManager
)
35
{
36
m_pDamageManager
.GetOnDamageStateChanged().Remove(
OnDamageStateChanged
);
37
m_pDamageManager
= null;
38
}
39
SetActionAccessible(
true
);
40
}
41
42
//------------------------------------------------------------------------------------------------
44
void
OnDamageStateChanged
(
EDamageState
state)
45
{
46
if
(state ==
EDamageState
.DESTROYED)
47
ReleaseAction
();
48
}
49
50
//------------------------------------------------------------------------------------------------
51
override
void
OnActionEnd
(
IEntity
owner)
52
{
53
super.OnActionEnd(owner);
54
ReleaseAction
();
55
if
(
Event_EOnActionEnd
)
56
Event_EOnActionEnd
.Invoke(GetUser());
57
}
58
59
//------------------------------------------------------------------------------------------------
60
override
void
OnActionFailed
(
IEntity
owner)
61
{
62
super.OnActionFailed(owner);
63
ReleaseAction
();
64
if
(
Event_EOnActionEnd
)
65
Event_EOnActionFailed
.Invoke(GetUser());
66
}
67
68
//------------------------------------------------------------------------------------------------
71
// Invokers for the completion of the smartaction to be used by the children //
72
SCR_AIActionUserInvoker
GetOnActionEnd
(
bool
createNew =
true
)
73
{
74
if
(!
Event_EOnActionEnd
&& createNew)
75
Event_EOnActionEnd
=
new
SCR_AIActionUserInvoker
();
76
return
Event_EOnActionEnd
;
77
}
78
79
//------------------------------------------------------------------------------------------------
82
SCR_AIActionUserInvoker
GetOnActionFailed
(
bool
createNew =
true
)
83
{
84
if
(!
Event_EOnActionFailed
&& createNew)
85
Event_EOnActionFailed
=
new
SCR_AIActionUserInvoker
();
86
return
Event_EOnActionFailed
;
87
}
88
89
//------------------------------------------------------------------------------------------------
90
override
void
OnDelete
(
IEntity
owner)
91
{
92
if
(
m_pDamageManager
)
93
m_pDamageManager
.GetOnDamageStateChanged().Remove(
OnDamageStateChanged
);
94
}
95
}
SCR_AIActionUserInvoker
ScriptInvokerBase< SCR_AIActionUserInvoker_Callback > SCR_AIActionUserInvoker
Definition
SCR_AISmartActionComponent.c:7
SCR_AIActionUserInvoker_Callback
func SCR_AIActionUserInvoker_Callback
Definition
SCR_AISmartActionComponent.c:6
func
func
Definition
SCR_AIThreatSystem.c:6
AISmartActionComponentClass
Definition
AISmartActionComponentClass.c:13
AISmartActionComponent
Definition
AISmartActionComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_AISmartActionComponentClass
Definition
SCR_AISmartActionComponent.c:2
SCR_AISmartActionComponent
Definition
SCR_AISmartActionComponent.c:10
SCR_AISmartActionComponent::Event_EOnActionFailed
ref SCR_AIActionUserInvoker Event_EOnActionFailed
Definition
SCR_AISmartActionComponent.c:12
SCR_AISmartActionComponent::OnDamageStateChanged
void OnDamageStateChanged(EDamageState state)
Definition
SCR_AISmartActionComponent.c:44
SCR_AISmartActionComponent::GetOnActionEnd
SCR_AIActionUserInvoker GetOnActionEnd(bool createNew=true)
Definition
SCR_AISmartActionComponent.c:72
SCR_AISmartActionComponent::Event_EOnActionEnd
ref SCR_AIActionUserInvoker Event_EOnActionEnd
Definition
SCR_AISmartActionComponent.c:11
SCR_AISmartActionComponent::m_pDamageManager
SCR_CharacterDamageManagerComponent m_pDamageManager
Definition
SCR_AISmartActionComponent.c:13
SCR_AISmartActionComponent::OnActionFailed
override void OnActionFailed(IEntity owner)
Definition
SCR_AISmartActionComponent.c:60
SCR_AISmartActionComponent::OnActionEnd
override void OnActionEnd(IEntity owner)
Definition
SCR_AISmartActionComponent.c:51
SCR_AISmartActionComponent::ReleaseAction
void ReleaseAction()
Definition
SCR_AISmartActionComponent.c:32
SCR_AISmartActionComponent::ReserveAction
void ReserveAction(AIAgent owner)
Definition
SCR_AISmartActionComponent.c:18
SCR_AISmartActionComponent::GetOnActionFailed
SCR_AIActionUserInvoker GetOnActionFailed(bool createNew=true)
Definition
SCR_AISmartActionComponent.c:82
SCR_AISmartActionComponent::OnDelete
override void OnDelete(IEntity owner)
Definition
SCR_AISmartActionComponent.c:90
SCR_CharacterDamageManagerComponent
Definition
SCR_CharacterDamageManagerComponent.c:19
EDamageState
EDamageState
Definition
EDamageState.c:13
scripts
Game
AI
Components
SCR_AISmartActionComponent.c
Generated by
1.17.0