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_ScenarioFrameworkActionOnResourceChanged.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_ContainerActionTitle
()]
2
class
SCR_ScenarioFrameworkActionOnResourceChanged
:
SCR_ScenarioFrameworkActionBase
3
{
4
[
Attribute
(
desc
:
"Target entity to manipulate supply (Optional if action is attached on Slot that spawns target entity)"
)]
5
ref
SCR_ScenarioFrameworkGet
m_Getter;
6
7
[
Attribute
(
desc
:
"Actions that will be executed on compartment entered"
,
UIWidgets
.Auto)]
8
ref array<ref SCR_ScenarioFrameworkActionBase> m_aActions;
9
10
[
Attribute
(defvalue:
"0"
,
desc
:
"Activation Percentage"
,
params
:
"0 inf 0.01"
)]
11
float
m_iActivationPercentage;
12
13
[
Attribute
(defvalue:
"0"
,
desc
:
"Operator"
, uiwidget:
UIWidgets
.ComboBox, enumType:
SCR_EScenarioFrameworkComparisonOperator
)]
14
SCR_EScenarioFrameworkComparisonOperator
m_eComparisonOperator;
15
16
protected
IEntity
m_SupplyHolderEntity
;
17
18
//------------------------------------------------------------------------------------------------
19
override
void
OnActivate
(
IEntity
object
)
20
{
21
if
(!CanActivate())
22
return
;
23
24
if
(!ValidateInputEntity(
object
, m_Getter,
m_SupplyHolderEntity
))
25
return
;
26
27
SCR_ResourceComponent resourceComponent;
28
SCR_ResourceContainer
supplyContainer =
GetContainer
(
m_SupplyHolderEntity
, resourceComponent);
29
if
(!supplyContainer)
30
{
31
if
(
object
)
32
PrintFormat
(
"ScenarioFramework Action: No resource container found for Action %1 attached on %2."
,
this
,
object
.
GetName
(), level:
LogLevel
.ERROR);
33
else
34
PrintFormat
(
"ScenarioFramework Action: No resource container Managers found for Action %1."
,
this
, level:
LogLevel
.ERROR);
35
36
return
;
37
}
38
39
supplyContainer.
GetOnResourcesChanged
().Insert(
OnResourceChanged
);
40
}
41
42
//------------------------------------------------------------------------------------------------
43
void
OnResourceChanged
(
SCR_ResourceContainer
container,
float
previousValue)
44
{
45
float
current = (container.
GetResourceValue
() / container.
GetMaxResourceValue
()) * 100;
46
47
if
(
48
((m_eComparisonOperator ==
SCR_EScenarioFrameworkComparisonOperator
.LESS_THAN) && (current < m_iActivationPercentage)) ||
49
((m_eComparisonOperator ==
SCR_EScenarioFrameworkComparisonOperator
.LESS_OR_EQUAL) && (current <= m_iActivationPercentage)) ||
50
((m_eComparisonOperator ==
SCR_EScenarioFrameworkComparisonOperator
.EQUAL) && (current == m_iActivationPercentage)) ||
51
((m_eComparisonOperator ==
SCR_EScenarioFrameworkComparisonOperator
.GREATER_OR_EQUAL) && (current >= m_iActivationPercentage)) ||
52
((m_eComparisonOperator ==
SCR_EScenarioFrameworkComparisonOperator
.GREATER_THEN) && (current > m_iActivationPercentage))
53
)
54
{
55
foreach
(
SCR_ScenarioFrameworkActionBase
action : m_aActions)
56
{
57
action.Init(
m_SupplyHolderEntity
);
58
}
59
}
60
}
61
62
//------------------------------------------------------------------------------------------------
67
SCR_ResourceContainer
GetContainer
(notnull
IEntity
entity, out SCR_ResourceComponent component)
68
{
69
component = SCR_ResourceComponent.Cast(entity.FindComponent(SCR_ResourceComponent));
70
SCR_ResourceContainer
container;
71
72
if
(component)
73
{
74
container = component.GetContainer(
EResourceType
.SUPPLIES);
75
if
(container)
76
return
container;
77
}
78
79
IEntity
iteratedEntity = entity.
GetChildren
();
80
while
(iteratedEntity)
81
{
82
component = SCR_ResourceComponent.Cast(iteratedEntity.
FindComponent
(SCR_ResourceComponent));
83
if
(component)
84
{
85
container = component.GetContainer(
EResourceType
.SUPPLIES);
86
if
(container)
87
return
container;
88
}
89
90
iteratedEntity = iteratedEntity.
GetSibling
();
91
}
92
93
return
null;
94
}
95
96
//------------------------------------------------------------------------------------------------
97
override
array<ref SCR_ScenarioFrameworkActionBase>
GetSubActions
()
98
{
99
return
m_aActions;
100
}
101
}
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_EScenarioFrameworkComparisonOperator
SCR_EScenarioFrameworkComparisonOperator
Definition
SCR_EScenarioFrameworkComparisonOperator.c:2
GetName
string GetName()
Definition
SCR_NotificationSenderComponent.c:15
EResourceType
EResourceType
Definition
SCR_ResourceContainer.c:2
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetChildren
proto external IEntity GetChildren()
IEntity::GetSibling
proto external IEntity GetSibling()
SCR_ContainerActionTitle
Definition
SCR_ContainerActionTitle.c:2
SCR_ResourceContainer
Definition
SCR_ResourceContainer.c:35
SCR_ResourceContainer::GetResourceValue
float GetResourceValue()
Definition
SCR_ResourceContainer.c:95
SCR_ResourceContainer::GetMaxResourceValue
float GetMaxResourceValue()
Definition
SCR_ResourceContainer.c:101
SCR_ResourceContainer::GetOnResourcesChanged
ScriptInvoker GetOnResourcesChanged()
Definition
SCR_ResourceContainer.c:322
SCR_ScenarioFrameworkActionBase
Definition
SCR_ScenarioFrameworkActionBase.c:3
SCR_ScenarioFrameworkActionOnResourceChanged
Definition
SCR_ScenarioFrameworkActionOnResourceChanged.c:3
SCR_ScenarioFrameworkActionOnResourceChanged::m_SupplyHolderEntity
IEntity m_SupplyHolderEntity
Definition
SCR_ScenarioFrameworkActionOnResourceChanged.c:16
SCR_ScenarioFrameworkActionOnResourceChanged::GetContainer
SCR_ResourceContainer GetContainer(notnull IEntity entity, out SCR_ResourceComponent component)
Definition
SCR_ScenarioFrameworkActionOnResourceChanged.c:67
SCR_ScenarioFrameworkActionOnResourceChanged::OnResourceChanged
void OnResourceChanged(SCR_ResourceContainer container, float previousValue)
Definition
SCR_ScenarioFrameworkActionOnResourceChanged.c:43
SCR_ScenarioFrameworkActionOnResourceChanged::GetSubActions
override array< ref SCR_ScenarioFrameworkActionBase > GetSubActions()
Definition
SCR_ScenarioFrameworkActionOnResourceChanged.c:97
SCR_ScenarioFrameworkActionOnResourceChanged::OnActivate
override void OnActivate(IEntity object)
Definition
SCR_ScenarioFrameworkActionOnResourceChanged.c:19
SCR_ScenarioFrameworkGet
Definition
SCR_ScenarioFrameworkGet.c:3
UIWidgets
Definition
attributes.c:40
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
PrintFormat
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
ScenarioFramework
Actions
ResourceComponentActions
SCR_ScenarioFrameworkActionOnResourceChanged.c
Generated by
1.17.0